Skip to content

Commit 0fc18bb

Browse files
Bump omniauth to 2.x
1 parent e923d9d commit 0fc18bb

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

omniauth-openid-connect.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
1919
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
2020
spec.require_paths = ["lib"]
2121

22-
spec.add_dependency 'omniauth', '~> 1.6'
22+
spec.add_dependency 'omniauth', '~> 2.1.4'
2323
spec.add_dependency 'openid_connect', '~> 2.2.0'
2424
spec.add_dependency 'addressable', '~> 2.5'
2525
spec.add_development_dependency 'bundler', '>= 1.5'

test/lib/omniauth/strategies/logout_token_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_backchannel_logout_phase
5454
callback.expects(:call)
5555
strategy.options.backchannel_logout_callback = callback
5656

57-
request.stubs(:path_info).returns('/auth/openidconnect/backchannel-logout')
57+
request.stubs(:path).returns('/auth/openidconnect/backchannel-logout')
5858
strategy.other_phase
5959
end
6060

@@ -66,7 +66,7 @@ def test_backchannel_logout_phase_invalid_issuer
6666
callback.expects(:call).never
6767
strategy.options.backchannel_logout_callback = callback
6868

69-
request.stubs(:path_info).returns('/auth/openidconnect/backchannel-logout')
69+
request.stubs(:path).returns('/auth/openidconnect/backchannel-logout')
7070
assert_raises(OmniAuth::OpenIDConnect::LogoutToken::InvalidIssuer) do
7171
strategy.perform_backchannel_logout!(encoded_logout_token)
7272
end
@@ -79,7 +79,7 @@ def test_backchannel_error_response
7979

8080
strategy.options.backchannel_logout_callback = -> {}
8181

82-
request.stubs(:path_info).returns('/auth/openidconnect/backchannel-logout')
82+
request.stubs(:path).returns('/auth/openidconnect/backchannel-logout')
8383
code, _headers, message = strategy.other_phase
8484
assert 400, code
8585
assert "foo", message.first
@@ -93,7 +93,7 @@ def test_backchannel_without_callback
9393

9494
strategy.options.backchannel_logout_callback = nil
9595

96-
request.stubs(:path_info).returns('/auth/openidconnect/backchannel-logout')
96+
request.stubs(:path).returns('/auth/openidconnect/backchannel-logout')
9797
strategy.other_phase
9898
end
9999
end

test/lib/omniauth/strategies/openid_connect_test.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_logout_phase_with_discovery
6767
config.stubs(:end_session_endpoint).returns('https://example.com/logout')
6868
::OpenIDConnect::Discovery::Provider::Config.stubs(:discover!).with('https://example.com/').returns(config)
6969

70-
request.stubs(:path_info).returns('/auth/openidconnect/logout')
70+
request.stubs(:path).returns('/auth/openidconnect/logout')
7171

7272
strategy.expects(:redirect).with(regexp_matches(expected_redirect))
7373
strategy.other_phase
@@ -102,7 +102,7 @@ def test_logout_phase_with_discovery_and_post_logout_redirect_uri
102102
config.stubs(:end_session_endpoint).returns('https://example.com/logout')
103103
::OpenIDConnect::Discovery::Provider::Config.stubs(:discover!).with('https://example.com/').returns(config)
104104

105-
request.stubs(:path_info).returns('/auth/openidconnect/logout')
105+
request.stubs(:path).returns('/auth/openidconnect/logout')
106106

107107
strategy.expects(:redirect).with(expected_redirect)
108108
strategy.other_phase
@@ -112,7 +112,7 @@ def test_logout_phase
112112
strategy.options.issuer = 'example.com'
113113
strategy.options.client_options.host = 'example.com'
114114

115-
request.stubs(:path_info).returns('/auth/openidconnect/logout')
115+
request.stubs(:path).returns('/auth/openidconnect/logout')
116116

117117
strategy.expects(:call_app!)
118118
strategy.other_phase
@@ -164,7 +164,7 @@ def test_callback_phase(session: {}, params: {}, options: {}, userinfo: true, st
164164
state = SecureRandom.hex(16)
165165
nonce = SecureRandom.hex(16)
166166
request.stubs(:params).returns('code' => code, 'state' => state)
167-
request.stubs(:path_info).returns('')
167+
request.stubs(:path).returns('')
168168

169169
strategy.options.issuer = 'example.com'
170170
strategy.options.client_signing_alg = :RS256
@@ -249,7 +249,7 @@ def test_callback_phase_with_discovery
249249
jwks = JSON::JWK::Set.new(JSON.parse(File.read('test/fixtures/jwks.json'))['keys'])
250250

251251
request.stubs(:params).returns('code' => code, 'state' => state)
252-
request.stubs(:path_info).returns('')
252+
request.stubs(:path).returns('')
253253

254254
strategy.options.client_options.host = 'example.com'
255255
strategy.options.discovery = true
@@ -290,7 +290,7 @@ def test_callback_phase_with_error
290290
state = SecureRandom.hex(16)
291291
nonce = SecureRandom.hex(16)
292292
request.stubs(:params).returns('error' => 'invalid_request')
293-
request.stubs(:path_info).returns('')
293+
request.stubs(:path).returns('')
294294

295295
strategy.call!({'rack.session' => {'omniauth.state' => state, 'omniauth.nonce' => nonce}})
296296
strategy.expects(:fail!)
@@ -302,7 +302,7 @@ def test_callback_phase_with_invalid_state
302302
state = SecureRandom.hex(16)
303303
nonce = SecureRandom.hex(16)
304304
request.stubs(:params).returns('code' => code, 'state' => 'foobar')
305-
request.stubs(:path_info).returns('')
305+
request.stubs(:path).returns('')
306306

307307
strategy.call!('rack.session' => { 'omniauth.state' => state, 'omniauth.nonce' => nonce })
308308
result = strategy.callback_phase
@@ -316,7 +316,7 @@ def test_callback_phase_with_timeout
316316
state = SecureRandom.hex(16)
317317
nonce = SecureRandom.hex(16)
318318
request.stubs(:params).returns('code' => code, 'state' => state)
319-
request.stubs(:path_info).returns('')
319+
request.stubs(:path).returns('')
320320

321321
strategy.options.issuer = 'example.com'
322322

@@ -331,7 +331,7 @@ def test_callback_phase_with_etimeout
331331
state = SecureRandom.hex(16)
332332
nonce = SecureRandom.hex(16)
333333
request.stubs(:params).returns('code' => code, 'state' => state)
334-
request.stubs(:path_info).returns('')
334+
request.stubs(:path).returns('')
335335

336336
strategy.options.issuer = 'example.com'
337337

@@ -346,7 +346,7 @@ def test_callback_phase_with_socket_error
346346
state = SecureRandom.hex(16)
347347
nonce = SecureRandom.hex(16)
348348
request.stubs(:params).returns('code' => code, 'state' => state)
349-
request.stubs(:path_info).returns('')
349+
request.stubs(:path).returns('')
350350

351351
strategy.options.issuer = 'example.com'
352352

@@ -500,7 +500,7 @@ def test_state
500500
# the following should fail because the wrong state is passed to the callback
501501
code = SecureRandom.hex(16)
502502
request.stubs(:params).returns('code' => code, 'state' => 43)
503-
request.stubs(:path_info).returns('')
503+
request.stubs(:path).returns('')
504504
strategy.call!('rack.session' => session)
505505

506506
result = strategy.callback_phase
@@ -526,7 +526,7 @@ def test_option_client_auth_method
526526
token_type: 'Bearer',
527527
}.to_json
528528

529-
request.stubs(:path_info).returns('')
529+
request.stubs(:path).returns('')
530530
strategy.call!('rack.session' => { 'omniauth.state' => state, 'omniauth.nonce' => nonce })
531531

532532
id_token = stub('OpenIDConnect::ResponseObject::IdToken')

test/strategy_test_case.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def request
4040
request.stubs(:env).returns({})
4141
request.stubs(:scheme).returns({})
4242
request.stubs(:ssl?).returns(false)
43+
request.stubs(:path).returns('/')
4344
end
4445
end
4546

0 commit comments

Comments
 (0)