warden 1.2.7 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +27 -0
  3. data/.gitignore +6 -0
  4. data/.rspec +3 -0
  5. data/{History.rdoc → CHANGELOG.md} +74 -39
  6. data/Gemfile +2 -2
  7. data/LICENSE +2 -1
  8. data/README.md +18 -0
  9. data/Rakefile +3 -8
  10. data/lib/warden/config.rb +1 -1
  11. data/lib/warden/errors.rb +2 -2
  12. data/lib/warden/hooks.rb +1 -1
  13. data/lib/warden/manager.rb +2 -2
  14. data/lib/warden/mixins/common.rb +1 -1
  15. data/lib/warden/proxy.rb +24 -5
  16. data/lib/warden/session_serializer.rb +1 -1
  17. data/lib/warden/strategies/base.rb +2 -1
  18. data/lib/warden/test/helpers.rb +2 -2
  19. data/lib/warden/test/mock.rb +5 -5
  20. data/lib/warden/test/warden_helpers.rb +1 -1
  21. data/lib/warden/version.rb +2 -2
  22. data/lib/warden.rb +1 -1
  23. data/warden.gemspec +18 -18
  24. metadata +18 -36
  25. data/README.textile +0 -9
  26. data/spec/helpers/request_helper.rb +0 -52
  27. data/spec/helpers/strategies/fail_with_user.rb +0 -11
  28. data/spec/helpers/strategies/failz.rb +0 -9
  29. data/spec/helpers/strategies/invalid.rb +0 -9
  30. data/spec/helpers/strategies/pass.rb +0 -9
  31. data/spec/helpers/strategies/pass_with_message.rb +0 -9
  32. data/spec/helpers/strategies/password.rb +0 -14
  33. data/spec/helpers/strategies/single.rb +0 -13
  34. data/spec/spec_helper.rb +0 -26
  35. data/spec/warden/authenticated_data_store_spec.rb +0 -115
  36. data/spec/warden/config_spec.rb +0 -49
  37. data/spec/warden/errors_spec.rb +0 -48
  38. data/spec/warden/hooks_spec.rb +0 -374
  39. data/spec/warden/manager_spec.rb +0 -341
  40. data/spec/warden/proxy_spec.rb +0 -1051
  41. data/spec/warden/scoped_session_serializer.rb +0 -124
  42. data/spec/warden/session_serializer_spec.rb +0 -54
  43. data/spec/warden/strategies/base_spec.rb +0 -314
  44. data/spec/warden/strategies_spec.rb +0 -95
  45. data/spec/warden/test/helpers_spec.rb +0 -94
  46. data/spec/warden/test/mock_spec.rb +0 -16
  47. 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: b7e6c341f27479e6f36339e5d2c211277b4c0e664c960827c2044dd36b5c1c23
4
+ data.tar.gz: 62e22ba4d81a887444d60ff033c7a6b0a0a8e723771d15cee045ee83baece801
5
5
  SHA512:
6
- metadata.gz: 2c6897e0cc915b2d3fe2dabf98f5c694a3cbc531974c61c578a579d388c21cca9755a39a6b322a25c41eb1526988c63a531afbe954f4a6075aa3d410cd9e5ef9
7
- data.tar.gz: f0a701673890402bf2717fb4ff356046a24ad85dbcf570e52b109fa9a741e18534a49690b0ff4e0ace9fba7c65ac24e17dd5324849af925ac0e27cf497b64246
6
+ metadata.gz: a6b602f560ebc6f04848c0c7e2d9017af8bf55c6cd6e6fec978e28e0463960761eaf488fabdba1b14d78bcf16e352a97d9b95b361142c3a4c14672517ca9e5b5
7
+ data.tar.gz: 9a6397e9d84063c8f7cf221c878b0657151a0cf01a6f98172b2ca0dfd1d5e7eddf7da9ce616f550928f5f14dcb073553379add7a006acc875fb162a7ce2a8210
@@ -0,0 +1,27 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Tests
9
+ on: [push, pull_request]
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby: [ '2.5', '2.6', '2.7' ]
17
+ name: Ruby ${{ matrix.ruby }}
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: 2.6
24
+ - name: Install dependencies
25
+ run: bundle install
26
+ - name: Run tests
27
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ pkg
3
+ .*~
4
+
5
+ *.gem
6
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
@@ -1,80 +1,114 @@
1
- == Version 1.2.7 / 2016-10-12
1
+ # CHANGELOG
2
+
3
+ ## Version 1.2.9 / 2020-08-31
4
+ * Avoid warning on uninitialized instance variable (#188)
5
+ * Bump rack to 2.2.3 (#190)
6
+ * Remove Gemfile.lock
7
+ * Resolve outstanding TODO entries (#179)
8
+ * A bunch of gem structure cleanup (thanks @olleolleolle)
9
+ * Set winning strategy when :warden is thrown (#174)
10
+ * Bump rack dependency to >= 2.0.9 due to CVEs
11
+
12
+ ## Version 1.2.8 / 2018-11-15
13
+
14
+ * Bugfix: Flips two lines to allow scopes authenticating from another without stepping on each other's toes. (PR #144)
15
+ * Update `rack` dependency to >= 2.0.6 due to security vulnerability
16
+ * Internal: Add Rubocop Lint checking
17
+ * Internal: Update RSpec to use `.rspec` file
18
+
19
+ ## Version 1.2.7 / 2016-10-12
20
+
2
21
  * Added 'frozen_string_literal' comment, bump ruby to 2.3
3
22
 
4
- == Version 1.2.6 / 2016-01-31
23
+ ## Version 1.2.6 / 2016-01-31
24
+
5
25
  * Separate test helpers to encapsulate Warden object mocking inside it's own class
6
26
 
7
- == Version 1.2.5 / 2016-01-28
27
+ ## Version 1.2.5 / 2016-01-28
28
+
8
29
  * Expands on the test helpers available to make it easier for testing gems
9
30
 
10
- == Version 1.2.3 / 2013-07-14
31
+ ## Version 1.2.3 / 2013-07-14
32
+
11
33
  * Fix an issue with lazy loaded sessions
12
34
 
13
- == Version 1.2.2 / 2013-07-12
35
+ ## Version 1.2.2 / 2013-07-12
36
+
14
37
  * Support nil session stores on logout
15
38
  * Fix strategies blowing up with undefined method base
16
39
 
17
- == Version 1.2.1 / 2012-06-16
40
+ ## Version 1.2.1 / 2012-06-16
41
+
18
42
  * Minor caching and speed improvements
19
43
  * Add support to #lock in the proxy
20
44
  * Add support to after_failed_fetch callback
21
45
 
22
- == Version 1.2.0 / 2012-05-08
46
+ ## Version 1.2.0 / 2012-05-08
47
+
23
48
  * Deprecate warden_cookies since it was never functional
24
49
  * Add support to serialize_from_session and serialize_into_session per scope
25
50
 
26
- == Version 1.1.1 / 2012-02-16
51
+ ## Version 1.1.1 / 2012-02-16
52
+
27
53
  * Allow run_callbacks as an option to set_user and user
28
54
 
29
- == Version 1.1.0 / 2011-11-02
55
+ ## Version 1.1.0 / 2011-11-02
56
+
30
57
  * Use the default scopes action when using a bare throw(:warden)
31
58
 
32
- == Version 1.0.6
59
+ ## Version 1.0.6
60
+
33
61
  * Remove gem files from the packaged gem
34
62
 
35
- == Version 1.0.3
63
+ ## Version 1.0.3
64
+
36
65
  * Do not renew session on user fetch
37
66
 
38
- == Version 1.0.2
67
+ ## Version 1.0.2
68
+
39
69
  * Added :intercept_401 to Warden::Config
40
70
 
41
- == Version 1.0.1
71
+ ## Version 1.0.1
72
+
42
73
  * Bug fix on strategies errors handler
43
74
 
44
- == Version 1.0.0
75
+ ## Version 1.0.0
76
+
45
77
  * Bump!
46
78
  * Allow strategies to configure if user should be stored or not
47
79
  * Force session id renewal when user is set
48
80
 
49
- == Version 0.10.7
81
+ ## Version 0.10.7
82
+
50
83
  * Performance boost. config object to use raw accessors
51
84
  * Add per strategy storage option
52
85
 
53
- == Version 0.10.6 / 0.10.7 / 2010-05-22
86
+ ## Version 0.10.6 / 0.10.7 / 2010-05-22
87
+
54
88
  * Bugfix set_user was not respecting logouts in hooks
55
89
 
56
- == Version 0.10.4 / 0.10.5 / 2010-05-20
90
+ ## Version 0.10.4 / 0.10.5 / 2010-05-20
57
91
  * Add action specifying in scope_defaults
58
92
 
59
- == Version 0.10.3 / 2010-03-01
93
+ ## Version 0.10.3 / 2010-03-01
60
94
  * Bugfix prevent halted winning strategy from being skipped in subsequent runs
61
95
 
62
- == Version 0.10.2 / 2010-03-26
96
+ ## Version 0.10.2 / 2010-03-26
63
97
  * Halt on fail!. Add fail to allow cascading
64
98
  * cache the winning strategy
65
99
  * Make the config object Dupable
66
100
 
67
- == Version 0.10.1 / 2010-03-23
101
+ ## Version 0.10.1 / 2010-03-23
68
102
  * Merge previous from master
69
103
  * tag
70
104
 
71
- == Version 0.10.0 / 2010-03-22
105
+ ## Version 0.10.0 / 2010-03-22
72
106
  * Allow default strategies to be set on the proxy
73
107
  * Provide each scope with it's own default strategies
74
108
  * Provide each scope with default set_user opts
75
109
  * depricate the Proxy#default_strategies= method
76
110
 
77
- == Version 0.9.5 / 2010-02-28
111
+ ## Version 0.9.5 / 2010-02-28
78
112
 
79
113
  * Add Warden.test_mode!
80
114
  * Add Warden.on_next_request
@@ -82,42 +116,42 @@
82
116
  ** login_as
83
117
  ** logout
84
118
 
85
- == Version 0.9.4 / 2010-02-23
119
+ ## Version 0.9.4 / 2010-02-23
86
120
 
87
121
  * Fix an issue where winning_strategy was not cleaned, allowing multiple scopes to sign in, even when the second one should not
88
122
 
89
- == Version 0.9.3 / 2010-02-17
123
+ ## Version 0.9.3 / 2010-02-17
90
124
 
91
125
  * Add prepend_ to all hooks (josevalim)
92
126
 
93
- == Version 0.9.2 / 2010-02-10
127
+ ## Version 0.9.2 / 2010-02-10
94
128
 
95
129
  * Ruby 1.9 compatibility changes (grimen)
96
130
 
97
- == Version 0.9.1 / 2010-02-09
131
+ ## Version 0.9.1 / 2010-02-09
98
132
 
99
133
  * Support for passing a custom message with Warden::Strategy::Base#success! as second optional (grimen)
100
134
 
101
- == Version 0.9.0 / 2010-01-21
135
+ ## Version 0.9.0 / 2010-01-21
102
136
 
103
137
  * Remove serializers and make strategies more powerful, including cache behavior (josevalim)
104
138
 
105
- == Version 0.8.1 / 2010-01-06
139
+ ## Version 0.8.1 / 2010-01-06
106
140
 
107
141
  * Fix a bug when silence missing serializers is set (josevalim)
108
142
 
109
- == Version 0.8.0 / 2010-01-06
143
+ ## Version 0.8.0 / 2010-01-06
110
144
 
111
145
  * enhancements
112
146
  * Add conditionals to callbacks (josevalim)
113
147
  * Extract Warden::Config from Warden::Manager (josevalim)
114
148
 
115
- == Version 0.7.0 / 2010-01-04
149
+ ## Version 0.7.0 / 2010-01-04
116
150
 
117
151
  * enhancements
118
152
  * Expose config in warden proxy (hassox)
119
153
 
120
- == Version 0.6.0 / 2009-11-16
154
+ ## Version 0.6.0 / 2009-11-16
121
155
 
122
156
  * enhancements
123
157
  * added serializers, including session serializer (set by default) and a cookie serializer (josevalim)
@@ -125,24 +159,27 @@
125
159
  * deprecation
126
160
  * serializer_into_session and serializer_from_session are deprecated, overwrite serialize and deserializer in Warden::Serializers::Session instead (josevalim)
127
161
 
128
- == Version 0.5.3 / 2009-11-10
162
+ ## Version 0.5.3 / 2009-11-10
163
+
129
164
  * bug fixes
130
165
  * authenticated? and unauthenticated? should return true or false, not the user or false. (hassox)
131
166
 
132
- == Version 0.5.2 / 2009-11-09
167
+ ## Version 0.5.2 / 2009-11-09
168
+
133
169
  * enhancements
134
170
  * authenticated? always try to serialize the user from session (josevalim)
135
171
  * stored_in_session? checks if user information is stored in session, without serializing (josevalim)
136
172
  * 401 behaves exactly like throw :warden (staugaard)
137
173
 
138
- === Version 0.5.1 / 2009-10-25
174
+ ## Version 0.5.1 / 2009-10-25
175
+
139
176
  * enhancements
140
- * Adds yeilding to authenticated? and unauthenticated? methods (hassox)
177
+ * Adds yielding to authenticated? and unauthenticated? methods (hassox)
141
178
  * Adds an option to silence missing strategies (josevalim)
142
179
  * Add an option to authenticate(!) to prevent storage of a user into the session (hassox)
143
180
  * allow custom :action to be thrown (josevalim)
144
181
 
145
- === Version 0.4.0 / 2009-10-12
182
+ ## Version 0.4.0 / 2009-10-12
146
183
 
147
184
  * enhancements
148
185
  * add Content-Type header to redirects (staugaard)
@@ -151,9 +188,7 @@
151
188
  * bug fixes
152
189
  * Do not consume opts twice, otherwise just the first will parse the scope (josevalim)
153
190
 
154
- === Version 0.3.2 / 2009-09-15
191
+ ## Version 0.3.2 / 2009-09-15
155
192
 
156
193
  * enhancements
157
194
  * add a hook for plugins to specify how they can clear the whole section
158
-
159
-
data/Gemfile CHANGED
@@ -4,9 +4,9 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rake'
7
- gem 'rack', '1.3'
7
+ gem 'pry'
8
8
 
9
9
  group :test do
10
- gem 'rspec', '~>3'
10
+ gem 'rspec', '~> 3'
11
11
  gem 'rack-test'
12
12
  end
data/LICENSE CHANGED
@@ -1,4 +1,5 @@
1
- Copyright (c) 2009 Daniel Neighman
1
+ Copyright (c) 2009-2017 Daniel Neighman
2
+ Copyright (c) 2017-2020 Justin Smestad
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining
4
5
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Warden
2
+
3
+ ## Getting Started
4
+
5
+ Please see the [Warden Wiki](https://github.com/wardencommunity/warden/wiki) 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)
data/lib/warden/config.rb CHANGED
@@ -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
data/lib/warden/errors.rb CHANGED
@@ -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
data/lib/warden/hooks.rb CHANGED
@@ -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
data/lib/warden/proxy.rb CHANGED
@@ -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
 
@@ -106,7 +111,7 @@ module Warden
106
111
  user
107
112
  end
108
113
 
109
- # Same API as authenticated, but returns a boolean instead of a user.
114
+ # Same API as authenticate, but returns a boolean instead of a user.
110
115
  # The difference between this method (authenticate?) and authenticated?
111
116
  # is that the former will run strategies if the user has not yet been
112
117
  # authenticated, and the second relies on already performed ones.
@@ -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
 
@@ -354,9 +365,12 @@ module Warden
354
365
  (strategies || args).each do |name|
355
366
  strategy = _fetch_strategy(name, scope)
356
367
  next unless strategy && !strategy.performed? && strategy.valid?
368
+ catch(:warden) do
369
+ _update_winning_strategy(strategy, scope)
370
+ end
357
371
 
358
- self.winning_strategy = @winning_strategies[scope] = strategy
359
372
  strategy._run!
373
+ _update_winning_strategy(strategy, scope)
360
374
  break if strategy.halted?
361
375
  end
362
376
  end
@@ -371,6 +385,11 @@ module Warden
371
385
  raise "Invalid strategy #{name}"
372
386
  end
373
387
  end
388
+
389
+ # Updates the winning strategy for a given scope
390
+ def _update_winning_strategy(strategy, scope)
391
+ self.winning_strategy = @winning_strategies[scope] = strategy
392
+ end
374
393
  end # Proxy
375
394
 
376
395
  end # Warden
@@ -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
@@ -45,6 +45,7 @@ module Warden
45
45
  @env, @scope = env, scope
46
46
  @status, @headers = nil, {}
47
47
  @halted, @performed = false, false
48
+ @result = nil
48
49
  end
49
50
 
50
51
  # The method that is called from above. This method calls the underlying authenticate! method
@@ -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.9"
5
5
  end
data/lib/warden.rb CHANGED
@@ -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'
data/warden.gemspec CHANGED
@@ -1,25 +1,25 @@
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
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.require_paths = ["lib"]
24
+ spec.add_dependency "rack", ">= 2.0.9"
24
25
  end
25
-