File tree Expand file tree Collapse file tree 2 files changed +7
-28
lines changed Expand file tree Collapse file tree 2 files changed +7
-28
lines changed Original file line number Diff line number Diff line change @@ -106,12 +106,7 @@ def fetch_jwks
106
106
end
107
107
res = conn . get 'https://appleid.apple.com/auth/keys'
108
108
if res . success?
109
- jwks = res . body
110
- if jwks . is_a? ( Hash )
111
- jwks
112
- else
113
- fail! ( :jwks_fetching_failed , JWTFetchingFailed . new ( "Invalid format of JWKS returned: #{ jwks } " ) )
114
- end
109
+ res . body
115
110
else
116
111
fail! ( :jwks_fetching_failed , JWTFetchingFailed . new ( 'HTTP Error when fetching JWKs' ) )
117
112
end
Original file line number Diff line number Diff line change 265
265
266
266
context 'fails nonce' do
267
267
before ( :each ) do
268
- expect ( subject ) . to receive ( :fail! ) . with ( :nonce_mismatch , instance_of ( OmniAuth ::Strategies ::OAuth2 ::CallbackError ) )
268
+ expect ( subject ) . to receive ( :fail! ) . with (
269
+ :nonce_mismatch ,
270
+ instance_of ( OmniAuth ::Strategies ::OAuth2 ::CallbackError )
271
+ ) . and_return ( [ 302 , { } , '' ] )
269
272
end
270
273
it 'when differs from session' do
271
274
subject . session [ 'omniauth.nonce' ] = 'abc'
357
360
expect ( subject ) . to receive ( :fail! ) . with (
358
361
:jwks_fetching_failed ,
359
362
instance_of ( OmniAuth ::Strategies ::Apple ::JWTFetchingFailed )
360
- )
363
+ ) . and_return ( [ 302 , { } , '' ] )
361
364
subject . info
362
365
end
363
366
end
376
379
expect ( subject ) . to receive ( :fail! ) . with (
377
380
:jwks_fetching_failed ,
378
381
instance_of ( Faraday ::ParsingError )
379
- )
380
- subject . info
381
- end
382
- end
383
-
384
- context 'when JWKS format is missing :keys' do
385
- before do
386
- stub_request ( :get , 'https://appleid.apple.com/auth/keys' ) . to_return (
387
- body : 'true' ,
388
- headers : {
389
- 'Content-Type' : 'application/json'
390
- }
391
- )
392
- end
393
-
394
- it do
395
- expect ( subject ) . to receive ( :fail! ) . with (
396
- :jwks_fetching_failed ,
397
- instance_of ( OmniAuth ::Strategies ::Apple ::JWTFetchingFailed )
398
- )
382
+ ) . and_return ( [ 302 , { } , '' ] )
399
383
subject . info
400
384
end
401
385
end
You can’t perform that action at this time.
0 commit comments