openid_connect 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openid_connect (0.2.1)
4
+ openid_connect (0.2.3)
5
5
  activemodel (>= 3)
6
6
  attr_required (>= 0.0.5)
7
7
  json (>= 1.4.3)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -13,7 +13,7 @@ module OpenIDConnect
13
13
  _claims_ = {}
14
14
  claims.each do |key, value|
15
15
  _claims_[key] = case value.to_s
16
- when 'optional'
16
+ when 'optional', 'voluntary'
17
17
  {
18
18
  :essential => false
19
19
  }
@@ -39,12 +39,14 @@ module OpenIDConnect
39
39
  end
40
40
 
41
41
  def required?(claim)
42
- accessible?(claim) && !optional?(claim)
42
+ accessible?(claim) && claims[claim].is_a?(Hash) && claims[claim][:essential]
43
43
  end
44
+ alias_method :essential?, :required?
44
45
 
45
46
  def optional?(claim)
46
- accessible?(claim) && claims[claim].is_a?(Hash) && claims[claim][:optional]
47
+ accessible?(claim) && !required?(claim)
47
48
  end
49
+ alias_method :voluntary?, :optional?
48
50
 
49
51
  def accessible?(claim)
50
52
  claims.try(:include?, claim)
@@ -32,7 +32,7 @@ describe OpenIDConnect::RequestObject do
32
32
  }
33
33
  end
34
34
  let(:jwtnized) do
35
- 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRfaWQiOiJjbGllbnRfaWQiLCJyZXNwb25zZV90eXBlIjoidG9rZW4gaWRfdG9rZW4iLCJyZWRpcmVjdF91cmkiOiJodHRwczovL2NsaWVudC5leGFtcGxlLmNvbSIsInNjb3BlIjoib3BlbmlkIGVtYWlsIiwic3RhdGUiOiJzdGF0ZTEyMzQiLCJub25jZSI6Im5vbmNlMTIzNCIsImRpc3BsYXkiOiJ0b3VjaCIsInByb21wdCI6Im5vbmUiLCJpZF90b2tlbiI6eyJjbGFpbXMiOnsiYWNyIjp7InZhbHVlcyI6WyIyIiwiMyIsIjQiXX19LCJtYXhfYWdlIjoxMH0sInVzZXJpbmZvIjp7ImNsYWltcyI6eyJuYW1lIjpudWxsLCJlbWFpbCI6eyJvcHRpb25hbCI6dHJ1ZX19fX0.ARgNywrsRkQtTFIqWnl38JLDYfb2g91yLY04l5-yQvQ'
35
+ 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRfaWQiOiJjbGllbnRfaWQiLCJyZXNwb25zZV90eXBlIjoidG9rZW4gaWRfdG9rZW4iLCJyZWRpcmVjdF91cmkiOiJodHRwczovL2NsaWVudC5leGFtcGxlLmNvbSIsInNjb3BlIjoib3BlbmlkIGVtYWlsIiwic3RhdGUiOiJzdGF0ZTEyMzQiLCJub25jZSI6Im5vbmNlMTIzNCIsImRpc3BsYXkiOiJ0b3VjaCIsInByb21wdCI6Im5vbmUiLCJpZF90b2tlbiI6eyJjbGFpbXMiOnsiYWNyIjp7InZhbHVlcyI6WyIyIiwiMyIsIjQiXX19LCJtYXhfYWdlIjoxMH0sInVzZXJpbmZvIjp7ImNsYWltcyI6eyJuYW1lIjp7ImVzc2VudGlhbCI6dHJ1ZX0sImVtYWlsIjp7ImVzc2VudGlhbCI6ZmFsc2V9fX19.MLTDQVPdhAdkJhboM06IRtjHJrvamJ_H2vFGRupXmTA'
36
36
  end
37
37
  let(:jsonized) do
38
38
  {
@@ -54,9 +54,11 @@ describe OpenIDConnect::RequestObject do
54
54
  },
55
55
  :userinfo => {
56
56
  :claims => {
57
- :name => nil,
57
+ :name => {
58
+ :essential => true
59
+ },
58
60
  :email => {
59
- :optional => true
61
+ :essential => false
60
62
  }
61
63
  }
62
64
  }
@@ -19,7 +19,7 @@ describe OpenIDConnect::ResponseObject::IdToken do
19
19
  describe 'attributes' do
20
20
  subject { klass }
21
21
  its(:required_attributes) { should == [:iss, :user_id, :aud, :exp, :iat] }
22
- its(:optional_attributes) { should == [:acr, :auth_time, :nonce, :at_hash] }
22
+ its(:optional_attributes) { should == [:acr, :auth_time, :nonce, :at_hash, :c_hash] }
23
23
  end
24
24
 
25
25
  describe '#verify!' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: