omniauth-openid-connect 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 6684f874a6e6cf6c99e102d128363c74aea21591
4
- data.tar.gz: 4eaaf78f7d3831ec4556bd6a11bbf48228619248
3
+ metadata.gz: 35259c91b0a952af5b6a7adf23b8f9ec8172f850
4
+ data.tar.gz: 9363495f6379fa1750ef1aae17496a87d7f41180
5
5
  SHA512:
6
- metadata.gz: e5cb9fc2011ceccc3eaa9b724c08177bca44c1c6f90824b89e439ec403d8dc1d133cca57626785767424707ac0667c634029dbb4420dd36ae885276c25d4e413
7
- data.tar.gz: d4cd21adc087562e0251137894288deda422c48eb5a1ecb2706d9702f8bb1c84ee476afdb8edfe52b3424e557febf55494a0d7178e319524081d56921b44c40e
6
+ metadata.gz: e779b236142b111fd5fe2cffe5f04802e7623a59f71ca078d2ea0548b1bfe8c74f254737583940376731fc1e052ed9e875a364cb89fdfbd03b1ec5bfa6a42ea9
7
+ data.tar.gz: 5d073d720718c9445cf7adc4ce37e9bd8140b81f3abe9e5024054ac4a81f8c7022592e74f7eac97993c835f87618ca16a985f80927e144018dca21668ceeee74
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module OpenIDConnect
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -168,22 +168,7 @@ module OmniAuth
168
168
  end
169
169
 
170
170
  def decode_id_token(id_token)
171
- header = JSON.parse(UrlSafeBase64.decode64(id_token.split('.').first))
172
- if header.has_key?('kid')
173
- keys = public_key.inject({}) do |keys, jwk|
174
- key = JSON::JWK.new(jwk)
175
- keys.merge! jwk['kid'] => key.to_key.public_key
176
- end
177
- ::OpenIDConnect::ResponseObject::IdToken.decode(id_token, keys[header[:kid]])
178
- else
179
- case public_key.class
180
- when JSON::JWK::Set
181
- jwk = JSON::JWK.new(public_key.first)
182
- ::OpenIDConnect::ResponseObject::IdToken.decode(id_token, jwk.to_key)
183
- else
184
- ::OpenIDConnect::ResponseObject::IdToken.decode(id_token, public_key)
185
- end
186
- end
171
+ ::OpenIDConnect::ResponseObject::IdToken.decode(id_token, public_key)
187
172
  end
188
173
 
189
174
 
@@ -232,7 +217,11 @@ module OmniAuth
232
217
 
233
218
  def parse_jwk_key(key)
234
219
  json = JSON.parse(key)
235
- JSON::JWK::Set.new json['keys']
220
+ if json.has_key?('keys')
221
+ JSON::JWK::Set.new json['keys']
222
+ else
223
+ JSON::JWK.new json
224
+ end
236
225
  end
237
226
 
238
227
  def decode(str)
@@ -313,13 +313,23 @@ class OmniAuth::Strategies::OpenIDConnectTest < StrategyTestCase
313
313
  assert(strategy.send :access_token)
314
314
  end
315
315
 
316
- def test_public_key_with_jwk
316
+ def test_public_key_with_jwks
317
317
  strategy.options.client_signing_alg = :RS256
318
318
  strategy.options.client_jwk_signing_key = File.read('./test/fixtures/jwks.json')
319
319
 
320
320
  assert_equal JSON::JWK::Set, strategy.public_key.class
321
321
  end
322
322
 
323
+ def test_public_key_with_jwk
324
+ strategy.options.client_signing_alg = :RS256
325
+ jwks_str = File.read('./test/fixtures/jwks.json')
326
+ jwks = JSON.parse(jwks_str)
327
+ jwk = jwks['keys'].first
328
+ strategy.options.client_jwk_signing_key = jwk.to_json
329
+
330
+ assert_equal JSON::JWK, strategy.public_key.class
331
+ end
332
+
323
333
  def test_public_key_with_x509
324
334
  strategy.options.client_signing_alg = :RS256
325
335
  strategy.options.client_x509_signing_key = File.read('./test/fixtures/test.crt')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-openid-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bohn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2015-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth