omniauth_openid_connect 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ffa620976c79075bcc1be6d53c4e4cd6f44cecb4c387902c07d2eeb633289aa
4
- data.tar.gz: 910ddf1c62c01806349f1079f20f2bb51b96cf95a74e98d584335a16dd7af6f6
3
+ metadata.gz: 9c030571ea9bcbd861ebe4d8455282c0b1b34c17af77294660b1c0123ed976ab
4
+ data.tar.gz: 2f4b2a8cd026797260f36e358ac7678a6827486889f23aab325d08e0d390b649
5
5
  SHA512:
6
- metadata.gz: a4268d78d21672332b24a63aea04b43a0f8c531c8a9e89f9187402406bbb4e5538b576cb60fcacecebf9b57e91c14b9f31136eee3aa7c6aeda7571130ad77b9b
7
- data.tar.gz: 858664147722cb80f5adf5b632ccde44ebfd79e29f0058be65a6bfe4847494cacec5255b96e646b3a18e2533489dc9a09fe31995e3aec0eebe9facbcbb37f69a
6
+ metadata.gz: afdf6363a18b019939a88abc612be51b20780fdeae2f1f300ef5e9df5a1002a97812b17360939e1ba9bb0b3bf4e54471e3da0ec6de858ac2afa40df15fdfb23d
7
+ data.tar.gz: e449bd59e5e75cfcce12ae27e5072fb8e3fe821e969a510856bbad0ed2553252345826ed16e97ecdbe1405a8c4be275195f759e71aed99fd699bf9509bffa0f3
@@ -1,3 +1,8 @@
1
+ # v0.3.5 (07.06.2020)
2
+
3
+ - bugfix: Info from decoded id_token is not exposed into `request.env['omniauth.auth']` [#61](https://github.com/m0n9oose/omniauth_openid_connect/pull/61)
4
+ - bugfix: NoMethodError (`undefined method 'count' for #<OpenIDConnect::ResponseObject::IdToken>`) [#60](https://github.com/m0n9oose/omniauth_openid_connect/pull/60)
5
+
1
6
  # v0.3.4 (21.05.2020)
2
7
 
3
8
  - Try to verify id_token when response_type is code [#44](https://github.com/m0n9oose/omniauth_openid_connect/pull/44)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module OpenIDConnect
5
- VERSION = '0.3.4'
5
+ VERSION = '0.3.5'
6
6
  end
7
7
  end
@@ -201,7 +201,15 @@ module OmniAuth
201
201
  end
202
202
 
203
203
  def user_info
204
- @user_info ||= access_token.userinfo!
204
+ return @user_info if @user_info
205
+
206
+ if access_token.id_token
207
+ decoded = decode_id_token(access_token.id_token).raw_attributes
208
+
209
+ @user_info = ::OpenIDConnect::ResponseObject::UserInfo.new access_token.userinfo!.raw_attributes.merge(decoded)
210
+ else
211
+ @user_info = access_token.userinfo!
212
+ end
205
213
  end
206
214
 
207
215
  def access_token
@@ -212,7 +220,7 @@ module OmniAuth
212
220
  client_auth_method: options.client_auth_method
213
221
  )
214
222
 
215
- verify_id_token!(decode_id_token(@access_token.id_token)) if configured_response_type == 'code'
223
+ verify_id_token!(@access_token.id_token) if configured_response_type == 'code'
216
224
 
217
225
  @access_token
218
226
  end
@@ -330,6 +338,8 @@ module OmniAuth
330
338
  end
331
339
 
332
340
  def verify_id_token!(id_token)
341
+ return unless id_token
342
+
333
343
  decode_id_token(id_token).verify!(issuer: options.issuer,
334
344
  client_id: client_options.identifier,
335
345
  nonce: stored_nonce)
@@ -185,9 +185,9 @@ module OmniAuth
185
185
  id_token = stub('OpenIDConnect::ResponseObject::IdToken')
186
186
  id_token.stubs(:raw_attributes).returns('sub' => 'sub', 'name' => 'name', 'email' => 'email')
187
187
  id_token.stubs(:verify!).with(issuer: strategy.options.issuer, client_id: @identifier, nonce: nonce).returns(true)
188
- ::OpenIDConnect::ResponseObject::IdToken.stubs(:decode).returns(id_token)
189
188
  id_token.expects(:verify!)
190
189
 
190
+ strategy.expects(:decode_id_token).twice.with(access_token.id_token).returns(id_token)
191
191
  strategy.call!('rack.session' => { 'omniauth.state' => state, 'omniauth.nonce' => nonce })
192
192
  strategy.callback_phase
193
193
  end
@@ -248,6 +248,7 @@ module OmniAuth
248
248
  ::OpenIDConnect::Discovery::Provider::Config.stubs(:discover!).with('https://example.com/').returns(config)
249
249
 
250
250
  id_token = stub('OpenIDConnect::ResponseObject::IdToken')
251
+ id_token.stubs(:raw_attributes).returns('sub' => 'sub', 'name' => 'name', 'email' => 'email')
251
252
  id_token.stubs(:verify!).with(issuer: 'https://example.com/', client_id: @identifier, nonce: nonce).returns(true)
252
253
  ::OpenIDConnect::ResponseObject::IdToken.stubs(:decode).returns(id_token)
253
254
 
@@ -587,7 +588,7 @@ module OmniAuth
587
588
 
588
589
  id_token = stub('OpenIDConnect::ResponseObject::IdToken')
589
590
  id_token.stubs(:verify!).returns(true)
590
- id_token.stubs(:raw_attributes, :to_h).returns(
591
+ id_token.stubs(:raw_attributes, :to_h).returns(
591
592
  {
592
593
  "iss": "http://server.example.com",
593
594
  "sub": "248289761001",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bohn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-05-21 00:00:00.000000000 Z
12
+ date: 2020-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable