warden 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +5 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/{History.rdoc → CHANGELOG.md} +7 -3
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +40 -0
  8. data/LICENSE +1 -1
  9. data/README.md +18 -0
  10. data/Rakefile +3 -8
  11. data/lib/warden.rb +1 -1
  12. data/lib/warden/config.rb +1 -1
  13. data/lib/warden/errors.rb +2 -2
  14. data/lib/warden/hooks.rb +1 -1
  15. data/lib/warden/manager.rb +2 -2
  16. data/lib/warden/mixins/common.rb +1 -1
  17. data/lib/warden/proxy.rb +15 -4
  18. data/lib/warden/session_serializer.rb +1 -1
  19. data/lib/warden/strategies/base.rb +1 -1
  20. data/lib/warden/test/helpers.rb +2 -2
  21. data/lib/warden/test/mock.rb +5 -5
  22. data/lib/warden/test/warden_helpers.rb +1 -1
  23. data/lib/warden/version.rb +2 -2
  24. data/warden.gemspec +20 -18
  25. metadata +18 -33
  26. data/README.textile +0 -9
  27. data/spec/helpers/request_helper.rb +0 -52
  28. data/spec/helpers/strategies/fail_with_user.rb +0 -11
  29. data/spec/helpers/strategies/failz.rb +0 -9
  30. data/spec/helpers/strategies/invalid.rb +0 -9
  31. data/spec/helpers/strategies/pass.rb +0 -9
  32. data/spec/helpers/strategies/pass_with_message.rb +0 -9
  33. data/spec/helpers/strategies/password.rb +0 -14
  34. data/spec/helpers/strategies/single.rb +0 -13
  35. data/spec/spec_helper.rb +0 -26
  36. data/spec/warden/authenticated_data_store_spec.rb +0 -115
  37. data/spec/warden/config_spec.rb +0 -49
  38. data/spec/warden/errors_spec.rb +0 -48
  39. data/spec/warden/hooks_spec.rb +0 -374
  40. data/spec/warden/manager_spec.rb +0 -341
  41. data/spec/warden/proxy_spec.rb +0 -1051
  42. data/spec/warden/scoped_session_serializer.rb +0 -124
  43. data/spec/warden/session_serializer_spec.rb +0 -54
  44. data/spec/warden/strategies/base_spec.rb +0 -314
  45. data/spec/warden/strategies_spec.rb +0 -95
  46. data/spec/warden/test/helpers_spec.rb +0 -94
  47. data/spec/warden/test/mock_spec.rb +0 -16
  48. data/spec/warden/test/test_mode_spec.rb +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 62095c3b46348d469f28bc0b73c4e4d1dea3c772
4
- data.tar.gz: c95c0c03bd6f5cc31ebc20674d8f679331cfa6b4
2
+ SHA256:
3
+ metadata.gz: 98bbb4bde4e4b1168fd883823a9e63f81cb6be40c117d92fd461299f4de0f86a
4
+ data.tar.gz: 03ac0df2de9c151a6f5387700141248be127a82177d21da1f1fc2d00db10bc64
5
5
  SHA512:
6
- metadata.gz: 2c6897e0cc915b2d3fe2dabf98f5c694a3cbc531974c61c578a579d388c21cca9755a39a6b322a25c41eb1526988c63a531afbe954f4a6075aa3d410cd9e5ef9
7
- data.tar.gz: f0a701673890402bf2717fb4ff356046a24ad85dbcf570e52b109fa9a741e18534a49690b0ff4e0ace9fba7c65ac24e17dd5324849af925ac0e27cf497b64246
6
+ metadata.gz: 5d8d0d43d9f1a28d12ca7044608e175b08444a46c81c42a6c1ad351d517e45919a653005522c576bd4fe4d8de1d3b2472c52c5b524b32606bb2e69d82a533a33
7
+ data.tar.gz: 044152b6566f94d9bcdcd4fda5297decb19ed5146adaaee3bdd07b154d9b1e3b9d840c8da21b110add36f8f856f1879cf2547e12298f710b75c734269c86daff
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ pkg
3
+ .*~
4
+
5
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ install:
3
+ - bundle install
4
+ rvm:
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4.2
@@ -1,3 +1,9 @@
1
+ == Version 1.2.8 / 2018-11-15
2
+ * Bugfix: Flips two lines to allow scopes authenticating from another without stepping on each other's toes. (PR #144)
3
+ * Update `rack` dependency to >= 2.0.6 due to security vulnerability
4
+ * Internal: Add Rubocop Lint checking
5
+ * Internal: Update RSpec to use `.rspec` file
6
+
1
7
  == Version 1.2.7 / 2016-10-12
2
8
  * Added 'frozen_string_literal' comment, bump ruby to 2.3
3
9
 
@@ -137,7 +143,7 @@
137
143
 
138
144
  === Version 0.5.1 / 2009-10-25
139
145
  * enhancements
140
- * Adds yeilding to authenticated? and unauthenticated? methods (hassox)
146
+ * Adds yielding to authenticated? and unauthenticated? methods (hassox)
141
147
  * Adds an option to silence missing strategies (josevalim)
142
148
  * Add an option to authenticate(!) to prevent storage of a user into the session (hassox)
143
149
  * allow custom :action to be thrown (josevalim)
@@ -155,5 +161,3 @@
155
161
 
156
162
  * enhancements
157
163
  * add a hook for plugins to specify how they can clear the whole section
158
-
159
-
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rake'
7
- gem 'rack', '1.3'
7
+ gem 'rack', '>= 2.0.6'
8
8
 
9
9
  group :test do
10
10
  gem 'rspec', '~>3'
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ warden (1.2.8)
5
+ rack (>= 2.0.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ rack (2.0.6)
12
+ rack-test (0.7.0)
13
+ rack (>= 1.0, < 3)
14
+ rake (12.1.0)
15
+ rspec (3.6.0)
16
+ rspec-core (~> 3.6.0)
17
+ rspec-expectations (~> 3.6.0)
18
+ rspec-mocks (~> 3.6.0)
19
+ rspec-core (3.6.0)
20
+ rspec-support (~> 3.6.0)
21
+ rspec-expectations (3.6.0)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.6.0)
24
+ rspec-mocks (3.6.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.6.0)
27
+ rspec-support (3.6.0)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ rack (>= 2.0.6)
34
+ rack-test
35
+ rake
36
+ rspec (~> 3)
37
+ warden!
38
+
39
+ BUNDLED WITH
40
+ 1.17.1
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Daniel Neighman
1
+ Copyright (c) 2009-2017 Daniel Neighman
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,18 @@
1
+ # Warden
2
+
3
+ ## Getting Started
4
+
5
+ Please see the [Warden Wiki](https://wiki.github.com/hassox/warden) for overview documentation.
6
+
7
+ ## Maintainers
8
+
9
+ * Daniel Neighman (hassox)
10
+ * José Valim (josevalim)
11
+ * Justin Smestad (jsmestad)
12
+ * Whitney Smestad (whithub)
13
+
14
+ [A list of all contributors is available on Github.](https://github.com/hassox/warden/contributors)
15
+
16
+ ## LICENSE
17
+
18
+ See `LICENSE` file.
data/Rakefile CHANGED
@@ -1,13 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # frozen_string_literal: true
3
- require 'rubygems'
4
- require 'rake'
5
- $:.unshift File.join(File.dirname(__FILE__), "lib")
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
6
5
 
7
- require 'rspec/core'
8
- require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec)
9
7
 
10
8
  task :default => :spec
11
-
12
- desc "Run all specs in spec directory"
13
- RSpec::Core::RakeTask.new(:spec)
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  require 'forwardable'
4
4
 
5
5
  require 'warden/mixins/common'
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  module Warden
5
5
  # This class is yielded inside Warden::Manager. If you have a plugin and want to
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  module Warden
4
4
  class Proxy
5
5
  # Lifted from DataMapper's dm-validations plugin :)
@@ -39,7 +39,7 @@ module Warden
39
39
  end
40
40
 
41
41
  def each
42
- errors.map.each do |k,v|
42
+ errors.map.each do |_k,v|
43
43
  next if blank?(v)
44
44
  yield(v)
45
45
  end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  module Warden
4
4
  module Hooks
5
5
 
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  require 'warden/hooks'
4
4
  require 'warden/config'
5
5
 
@@ -22,7 +22,6 @@ module Warden
22
22
  @app, @config = app, Warden::Config.new(options)
23
23
  @config.default_strategies(*default_strategies) if default_strategies
24
24
  yield @config if block_given?
25
- self
26
25
  end
27
26
 
28
27
  # Invoke the application guarding for throw :warden.
@@ -33,6 +32,7 @@ module Warden
33
32
 
34
33
  env['warden'] = Proxy.new(env, self)
35
34
  result = catch(:warden) do
35
+ env['warden'].on_request
36
36
  @app.call(env)
37
37
  end
38
38
 
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  module Warden
4
4
  module Mixins
5
5
  module Common
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  module Warden
5
5
  class UserNotSet < RuntimeError; end
@@ -29,6 +29,11 @@ module Warden
29
29
  @env, @users, @winning_strategies, @locked = env, {}, {}, false
30
30
  @manager, @config = manager, manager.config.dup
31
31
  @strategies = Hash.new { |h,k| h[k] = {} }
32
+ end
33
+
34
+ # Run the on_request callbacks
35
+ # :api: private
36
+ def on_request
32
37
  manager._run_callbacks(:on_request, self)
33
38
  end
34
39
 
@@ -172,7 +177,13 @@ module Warden
172
177
 
173
178
  if opts[:store] != false && opts[:event] != :fetch
174
179
  options = env[ENV_SESSION_OPTIONS]
175
- options[:renew] = true if options
180
+ if options
181
+ if options.frozen?
182
+ env[ENV_SESSION_OPTIONS] = options.merge(:renew => true).freeze
183
+ else
184
+ options[:renew] = true
185
+ end
186
+ end
176
187
  session_serializer.store(user, scope)
177
188
  end
178
189
 
@@ -319,7 +330,7 @@ module Warden
319
330
  user = nil
320
331
 
321
332
  # Look for an existing user in the session for this scope.
322
- # If there was no user in the session. See if we can get one from the request.
333
+ # If there was no user in the session, see if we can get one from the request.
323
334
  return user, opts if user = user(opts.merge(:scope => scope))
324
335
  _run_strategies_for(scope, args)
325
336
 
@@ -355,8 +366,8 @@ module Warden
355
366
  strategy = _fetch_strategy(name, scope)
356
367
  next unless strategy && !strategy.performed? && strategy.valid?
357
368
 
358
- self.winning_strategy = @winning_strategies[scope] = strategy
359
369
  strategy._run!
370
+ self.winning_strategy = @winning_strategies[scope] = strategy
360
371
  break if strategy.halted?
361
372
  end
362
373
  end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  module Warden
4
4
  class SessionSerializer
5
5
  attr_reader :env
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  module Warden
4
4
  module Strategies
5
5
  # A strategy is a place where you can put logic related to authentication. Any strategy inherits
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  module Warden
5
5
  module Test
@@ -7,7 +7,7 @@ module Warden
7
7
  # These provide the ability to login and logout on any given request
8
8
  # Note: During the teardown phase of your specs you should include: Warden.test_reset!
9
9
  module Helpers
10
- def self.included(base)
10
+ def self.included(_base)
11
11
  ::Warden.test_mode!
12
12
  end
13
13
 
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'rack'
5
5
 
@@ -8,7 +8,7 @@ module Warden
8
8
  # A mock of an application to get a Warden object to test on
9
9
  # Note: During the teardown phase of your specs you should include: Warden.test_reset!
10
10
  module Mock
11
- def self.included(base)
11
+ def self.included(_base)
12
12
  ::Warden.test_mode!
13
13
  end
14
14
 
@@ -37,7 +37,7 @@ module Warden
37
37
  def app
38
38
  @app ||= begin
39
39
  opts = {
40
- failure_app: lambda {
40
+ failure_app: lambda { |_e|
41
41
  [401, { 'Content-Type' => 'text/plain' }, ['You Fail!']]
42
42
  },
43
43
  default_strategies: :password,
@@ -46,7 +46,7 @@ module Warden
46
46
  Rack::Builder.new do
47
47
  use Warden::Test::Mock::Session
48
48
  use Warden::Manager, opts, &proc {}
49
- run lambda { |e|
49
+ run lambda { |_e|
50
50
  [200, { 'Content-Type' => 'text/plain' }, ['You Win']]
51
51
  }
52
52
  end
@@ -55,7 +55,7 @@ module Warden
55
55
 
56
56
  class Session
57
57
  attr_accessor :app
58
- def initialize(app,configs = {})
58
+ def initialize(app, _configs={})
59
59
  @app = app
60
60
  end
61
61
 
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  module Warden
5
5
 
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  module Warden
4
- VERSION = "1.2.7"
4
+ VERSION = "1.2.8"
5
5
  end
@@ -1,25 +1,27 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # frozen_string_literal: true
3
3
 
4
- require './lib/warden/version'
4
+ lib = File.expand_path("../lib", __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'warden/version'
5
7
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{warden}
8
- s.version = Warden::VERSION.dup
9
- s.authors = ["Daniel Neighman"]
10
- s.email = %q{has.sox@gmail.com}
11
- s.license = "MIT"
12
- s.extra_rdoc_files = [
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "warden"
10
+ spec.version = Warden::VERSION.dup
11
+ spec.authors = ["Daniel Neighman", "Justin Smestad", "Whitney Smestad", "José Valim"]
12
+ spec.email = %q{hasox.sox@gmail.com justin.smestad@gmail.com whitcolorado@gmail.com}
13
+ spec.homepage = "https://github.com/hassox/warden"
14
+ spec.summary = "An authentication library compatible with all Rack-based frameworks"
15
+ spec.license = "MIT"
16
+ spec.extra_rdoc_files = [
13
17
  "LICENSE",
14
- "README.textile"
18
+ "README.md"
15
19
  ]
16
- s.files = Dir["**/*"] - Dir["*.gem"] - ["Gemfile.lock"]
17
- s.homepage = %q{http://github.com/hassox/warden}
18
- s.rdoc_options = ["--charset=UTF-8"]
19
- s.require_paths = ["lib"]
20
- s.rubyforge_project = %q{warden}
21
- s.rubygems_version = %q{1.3.7}
22
- s.summary = %q{Rack middleware that provides authentication for rack applications}
23
- s.add_dependency "rack", ">= 1.0"
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+ spec.rdoc_options = ["--charset=UTF-8"]
24
+ spec.require_paths = ["lib"]
25
+ spec.rubyforge_project = %q{warden}
26
+ spec.add_dependency "rack", ">= 2.0.6"
24
27
  end
25
-
metadata CHANGED
@@ -1,14 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warden
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
8
+ - Justin Smestad
9
+ - Whitney Smestad
10
+ - José Valim
8
11
  autorequire:
9
12
  bindir: bin
10
13
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
14
+ date: 2018-11-15 00:00:00.000000000 Z
12
15
  dependencies:
13
16
  - !ruby/object:Gem::Dependency
14
17
  name: rack
@@ -16,26 +19,30 @@ dependencies:
16
19
  requirements:
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: '1.0'
22
+ version: 2.0.6
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '1.0'
29
+ version: 2.0.6
27
30
  description:
28
- email: has.sox@gmail.com
31
+ email: hasox.sox@gmail.com justin.smestad@gmail.com whitcolorado@gmail.com
29
32
  executables: []
30
33
  extensions: []
31
34
  extra_rdoc_files:
32
35
  - LICENSE
33
- - README.textile
36
+ - README.md
34
37
  files:
38
+ - ".gitignore"
39
+ - ".rspec"
40
+ - ".travis.yml"
41
+ - CHANGELOG.md
35
42
  - Gemfile
36
- - History.rdoc
43
+ - Gemfile.lock
37
44
  - LICENSE
38
- - README.textile
45
+ - README.md
39
46
  - Rakefile
40
47
  - lib/warden.rb
41
48
  - lib/warden/config.rb
@@ -51,30 +58,8 @@ files:
51
58
  - lib/warden/test/mock.rb
52
59
  - lib/warden/test/warden_helpers.rb
53
60
  - lib/warden/version.rb
54
- - spec/helpers/request_helper.rb
55
- - spec/helpers/strategies/fail_with_user.rb
56
- - spec/helpers/strategies/failz.rb
57
- - spec/helpers/strategies/invalid.rb
58
- - spec/helpers/strategies/pass.rb
59
- - spec/helpers/strategies/pass_with_message.rb
60
- - spec/helpers/strategies/password.rb
61
- - spec/helpers/strategies/single.rb
62
- - spec/spec_helper.rb
63
- - spec/warden/authenticated_data_store_spec.rb
64
- - spec/warden/config_spec.rb
65
- - spec/warden/errors_spec.rb
66
- - spec/warden/hooks_spec.rb
67
- - spec/warden/manager_spec.rb
68
- - spec/warden/proxy_spec.rb
69
- - spec/warden/scoped_session_serializer.rb
70
- - spec/warden/session_serializer_spec.rb
71
- - spec/warden/strategies/base_spec.rb
72
- - spec/warden/strategies_spec.rb
73
- - spec/warden/test/helpers_spec.rb
74
- - spec/warden/test/mock_spec.rb
75
- - spec/warden/test/test_mode_spec.rb
76
61
  - warden.gemspec
77
- homepage: http://github.com/hassox/warden
62
+ homepage: https://github.com/hassox/warden
78
63
  licenses:
79
64
  - MIT
80
65
  metadata: {}
@@ -95,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
80
  version: '0'
96
81
  requirements: []
97
82
  rubyforge_project: warden
98
- rubygems_version: 2.6.8
83
+ rubygems_version: 2.7.6
99
84
  signing_key:
100
85
  specification_version: 4
101
- summary: Rack middleware that provides authentication for rack applications
86
+ summary: An authentication library compatible with all Rack-based frameworks
102
87
  test_files: []