openid_connect 0.7.3 → 0.8.0

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: b2af2e4660f3ed9164a97f9722aadcee31b453b9
4
- data.tar.gz: d8dcc5d4d6ebf554d26de711bac82243b77b99a5
3
+ metadata.gz: 35d71b7a3743bd72c3f58f3ec42cb738154713ed
4
+ data.tar.gz: 5937a7527d73fb7a304da639aec619db2cbe3954
5
5
  SHA512:
6
- metadata.gz: c621d84e01d50971427ca67ae17d2dbeb99469071a69e41648ab8e6c408014564ac761630daca14f39f694a6be2c930d1ac9012655409eb6f73bdebea461cc4e
7
- data.tar.gz: 772e2c21bdfe671d5d882a7eb3c7b4878204d71be97a91e51738b68a21220d5c87982aa37f700f2171f94761893894e2654636769c1874d62b9034d6a7fd8f7d
6
+ metadata.gz: 9618737dec9685e33637aa65dad56f2b8d8392156459f93ae3f157bf54fe6332f07e9007778ebfe17b6279bd6e30a50ceea8ae56c2d75272b5cbcbb7cda24692
7
+ data.tar.gz: c5f72442ebc141bdbeaf8c7f1b0a1036a5b74d345411bf593cf2c9f21c79aecd44d56ef9df07e97dc1027495f6c0dbfbf54da191667013fb3d760133ec3111f9
data/.gitignore CHANGED
@@ -17,5 +17,6 @@ tmtags
17
17
  coverage*
18
18
  rdoc
19
19
  pkg
20
+ Gemfile.lock
20
21
 
21
22
  ## PROJECT::SPECIFIC
data/LICENSE CHANGED
@@ -1,5 +1,7 @@
1
1
  Copyright (c) 2011 nov matake
2
2
 
3
+ MIT License
4
+
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
5
7
  "Software"), to deal in the Software without restriction, including
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -4,16 +4,16 @@ Bundler::GemHelper.install_tasks
4
4
  require 'rspec/core/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
- namespace :cover_me do
8
- desc "Generates and opens code coverage report."
7
+ namespace :coverage do
8
+ desc "Open coverage report"
9
9
  task :report do
10
- require 'cover_me'
11
- CoverMe.complete!
10
+ require 'simplecov'
11
+ `open "#{File.join SimpleCov.coverage_path, 'index.html'}"`
12
12
  end
13
13
  end
14
14
 
15
15
  task :spec do
16
- Rake::Task['cover_me:report'].invoke unless ENV['TRAVIS_RUBY_VERSION']
16
+ Rake::Task[:'coverage:report'].invoke unless ENV['TRAVIS_RUBY_VERSION']
17
17
  end
18
18
 
19
- task default: :spec
19
+ task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.8.0
@@ -11,7 +11,6 @@ require 'attr_optional'
11
11
  require 'rack/oauth2'
12
12
  require 'rack/oauth2/server/authorize/request_with_connect_params'
13
13
  require 'rack/oauth2/server/id_token_response'
14
- require 'rack/oauth2/server/resource/error_with_connect_ext'
15
14
 
16
15
  module OpenIDConnect
17
16
  VERSION = ::File.read(
@@ -8,11 +8,11 @@ module OpenIDConnect
8
8
  @token_type = :bearer
9
9
  end
10
10
 
11
- def userinfo!(schema = :openid)
11
+ def userinfo!
12
12
  hash = resource_request do
13
- get client.userinfo_uri, schema: schema
13
+ get client.userinfo_uri
14
14
  end
15
- ResponseObject::UserInfo::OpenID.new hash
15
+ ResponseObject::UserInfo.new hash
16
16
  end
17
17
 
18
18
  private
@@ -18,21 +18,24 @@ module OpenIDConnect
18
18
  singular_attributes = [
19
19
  :application_type,
20
20
  :client_name,
21
- :token_endpoint_auth_method,
21
+ :jwks,
22
22
  :subject_type,
23
- :request_object_signing_alg,
24
- :userinfo_signed_response_alg,
25
- :userinfo_encrypted_response_alg,
26
- :userinfo_encrypted_response_enc,
27
23
  :id_token_signed_response_alg,
28
24
  :id_token_encrypted_response_alg,
29
25
  :id_token_encrypted_response_enc,
26
+ :userinfo_signed_response_alg,
27
+ :userinfo_encrypted_response_alg,
28
+ :userinfo_encrypted_response_enc,
29
+ :request_object_signing_alg,
30
+ :request_object_encryption_alg,
31
+ :request_object_encryption_enc,
32
+ :token_endpoint_auth_method,
33
+ :token_endpoint_auth_signing_alg,
30
34
  :default_max_age,
31
35
  :require_auth_time
32
36
  ] + singular_uri_attributes
33
37
  self.plurar_uri_attributes = [
34
38
  :redirect_uris,
35
- :post_logout_redirect_uris,
36
39
  :request_uris
37
40
  ]
38
41
  plurar_attributes = [
@@ -11,8 +11,10 @@ module OpenIDConnect
11
11
 
12
12
  def self.discover!(identifier)
13
13
  resource = case identifier
14
- when /^acct:/, /@/, /^https?:\/\//
14
+ when /^acct:/, /https?:\/\//
15
15
  identifier
16
+ when /@/
17
+ "acct:#{identifier}"
16
18
  else
17
19
  "https://#{identifier}"
18
20
  end
@@ -16,8 +16,6 @@ module OpenIDConnect
16
16
  :authorization_endpoint,
17
17
  :token_endpoint,
18
18
  :userinfo_endpoint,
19
- :check_session_endpoint,
20
- :end_session_endpoint,
21
19
  :registration_endpoint,
22
20
  :service_documentation,
23
21
  :op_policy_uri,
@@ -31,13 +29,14 @@ module OpenIDConnect
31
29
  ])
32
30
  attr_optional *(uri_attributes[:optional] + [
33
31
  :scopes_supported,
32
+ :response_modes_supported,
34
33
  :grant_types_supported,
35
34
  :acr_values_supported,
35
+ :id_token_encryption_alg_values_supported,
36
+ :id_token_encryption_enc_values_supported,
36
37
  :userinfo_signing_alg_values_supported,
37
38
  :userinfo_encryption_alg_values_supported,
38
39
  :userinfo_encryption_enc_values_supported,
39
- :id_token_encryption_alg_values_supported,
40
- :id_token_encryption_enc_values_supported,
41
40
  :request_object_signing_alg_values_supported,
42
41
  :request_object_encryption_alg_values_supported,
43
42
  :request_object_encryption_enc_values_supported,
@@ -34,4 +34,4 @@ end
34
34
 
35
35
  require 'openid_connect/request_object/claimable'
36
36
  require 'openid_connect/request_object/id_token'
37
- require 'openid_connect/request_object/userinfo'
37
+ require 'openid_connect/request_object/user_info'
@@ -0,0 +1,65 @@
1
+ module OpenIDConnect
2
+ class ResponseObject
3
+ class UserInfo < ConnectObject
4
+ attr_optional(
5
+ :sub,
6
+ :name,
7
+ :given_name,
8
+ :family_name,
9
+ :middle_name,
10
+ :nickname,
11
+ :preferred_username,
12
+ :profile,
13
+ :picture,
14
+ :website,
15
+ :email,
16
+ :email_verified,
17
+ :gender,
18
+ :birthdate,
19
+ :zoneinfo,
20
+ :locale,
21
+ :phone_number,
22
+ :phone_number_verified,
23
+ :address,
24
+ :updated_at
25
+ )
26
+ alias_method :subject, :sub
27
+ alias_method :subject=, :sub=
28
+
29
+ validates :email_verified, :phone_number_verified, allow_nil: true, inclusion: {in: [true, false]}
30
+ validates :gender, allow_nil: true, inclusion: {in: ['male', 'female']}
31
+ validates :zoneinfo, allow_nil: true, inclusion: {in: TZInfo::TimezoneProxy.all.collect(&:name)}
32
+ validates :profile, :picture, :website, allow_nil: true, url: true
33
+ validates :email, allow_nil: true, email: true
34
+ validates :updated_at, allow_nil: true, numericality: {only_integer: true}
35
+ validate :validate_address
36
+ validate :require_at_least_one_attributes
37
+ # TODO: validate locale
38
+
39
+ def initialize(attributes = {})
40
+ super
41
+ (all_attributes - [:email_verified, :phone_number_verified, :address, :updated_at]).each do |key|
42
+ self.send "#{key}=", self.send(key).try(:to_s)
43
+ end
44
+ self.updated_at = updated_at.try(:to_i)
45
+ end
46
+
47
+ def validate_address
48
+ errors.add :address, address.errors.full_messages.join(', ') if address.present? && !address.valid?
49
+ end
50
+
51
+ def address=(hash_or_address)
52
+ @address = case hash_or_address
53
+ when Hash
54
+ Address.new hash_or_address
55
+ when Address
56
+ hash_or_address
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ Dir[File.dirname(__FILE__) + '/user_info/*.rb'].each do |file|
64
+ require file
65
+ end
@@ -0,0 +1,10 @@
1
+ module OpenIDConnect
2
+ class ResponseObject
3
+ class UserInfo
4
+ class Address < ConnectObject
5
+ attr_optional :formatted, :street_address, :locality, :region, :postal_code, :country
6
+ validate :require_at_least_one_attributes
7
+ end
8
+ end
9
+ end
10
+ end
@@ -6,6 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.homepage = "https://github.com/nov/openid_connect"
7
7
  s.summary = %q{OpenID Connect Server & Client Library}
8
8
  s.description = %q{OpenID Connect Server & Client Library}
9
+ s.license = 'MIT'
10
+
9
11
  s.files = `git ls-files`.split("\n")
10
12
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
11
13
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -23,5 +25,5 @@ Gem::Specification.new do |s|
23
25
  s.add_development_dependency "rake", ">= 0.8"
24
26
  s.add_development_dependency "rspec", ">= 2"
25
27
  s.add_development_dependency "webmock", ">= 1.6.2"
26
- s.add_development_dependency "cover_me", ">= 1.2.0"
28
+ s.add_development_dependency "simplecov"
27
29
  end
@@ -1,5 +1,4 @@
1
1
  {
2
- "version": "3.0",
3
2
  "issuer": "https://connect-op.heroku.com",
4
3
  "authorization_endpoint": "https://connect-op.heroku.com/authorizations/new",
5
4
  "token_endpoint": "https://connect-op.heroku.com/access_tokens",
@@ -53,9 +53,7 @@ describe OpenIDConnect::AccessToken do
53
53
  shared_examples_for :access_token_error_handling do
54
54
  context 'when bad_request' do
55
55
  it 'should raise OpenIDConnect::Forbidden' do
56
- mock_json :get, endpoint, 'errors/invalid_request', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 400, params: {
57
- schema: 'openid'
58
- } do
56
+ mock_json :get, endpoint, 'errors/invalid_request', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 400 do
59
57
  expect { request }.to raise_error OpenIDConnect::BadRequest
60
58
  end
61
59
  end
@@ -63,9 +61,7 @@ describe OpenIDConnect::AccessToken do
63
61
 
64
62
  context 'when unauthorized' do
65
63
  it 'should raise OpenIDConnect::Unauthorized' do
66
- mock_json :get, endpoint, 'errors/invalid_access_token', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 401, params: {
67
- schema: 'openid'
68
- } do
64
+ mock_json :get, endpoint, 'errors/invalid_access_token', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 401 do
69
65
  expect { request }.to raise_error OpenIDConnect::Unauthorized
70
66
  end
71
67
  end
@@ -73,9 +69,7 @@ describe OpenIDConnect::AccessToken do
73
69
 
74
70
  context 'when forbidden' do
75
71
  it 'should raise OpenIDConnect::Forbidden' do
76
- mock_json :get, endpoint, 'errors/insufficient_scope', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 403, params: {
77
- schema: 'openid'
78
- } do
72
+ mock_json :get, endpoint, 'errors/insufficient_scope', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 403 do
79
73
  expect { request }.to raise_error OpenIDConnect::Forbidden
80
74
  end
81
75
  end
@@ -83,9 +77,7 @@ describe OpenIDConnect::AccessToken do
83
77
 
84
78
  context 'when unknown' do
85
79
  it 'should raise OpenIDConnect::HttpError' do
86
- mock_json :get, endpoint, 'errors/unknown', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 500, params: {
87
- schema: 'openid'
88
- } do
80
+ mock_json :get, endpoint, 'errors/unknown', :HTTP_AUTHORIZATION => 'Bearer access_token', status: 500 do
89
81
  expect { request }.to raise_error OpenIDConnect::HttpError
90
82
  end
91
83
  end
@@ -94,12 +86,10 @@ describe OpenIDConnect::AccessToken do
94
86
 
95
87
  describe '#userinfo!' do
96
88
  it do
97
- userinfo = mock_json :get, client.userinfo_uri, 'userinfo/openid', :HTTP_AUTHORIZATION => 'Bearer access_token', params: {
98
- schema: 'openid'
99
- } do
89
+ userinfo = mock_json :get, client.userinfo_uri, 'userinfo/openid', :HTTP_AUTHORIZATION => 'Bearer access_token' do
100
90
  access_token.userinfo!
101
91
  end
102
- userinfo.should be_instance_of OpenIDConnect::ResponseObject::UserInfo::OpenID
92
+ userinfo.should be_instance_of OpenIDConnect::ResponseObject::UserInfo
103
93
  end
104
94
 
105
95
  describe 'error handling' do
@@ -13,8 +13,6 @@ describe OpenIDConnect::Discovery::Provider::Config do
13
13
  config.authorization_endpoint.should == 'https://connect-op.heroku.com/authorizations/new'
14
14
  config.token_endpoint.should == 'https://connect-op.heroku.com/access_tokens'
15
15
  config.userinfo_endpoint.should == 'https://connect-op.heroku.com/userinfo'
16
- config.check_session_endpoint.should be_nil
17
- config.end_session_endpoint.should be_nil
18
16
  config.jwks_uri.should == 'https://connect-op.heroku.com/jwks.json'
19
17
  config.registration_endpoint.should == 'https://connect-op.heroku.com/connect/client'
20
18
  config.scopes_supported.should == ['openid', 'profile', 'email', 'address']
@@ -51,7 +51,7 @@ describe OpenIDConnect::Discovery::Provider do
51
51
 
52
52
  context 'when Email is given' do
53
53
  let(:identifier) { "nov@#{host}" }
54
- let(:resource) { identifier }
54
+ let(:resource) { "acct:#{identifier}" }
55
55
  it_behaves_like :discover_provider
56
56
  end
57
57
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe OpenIDConnect::ResponseObject::UserInfo::OpenID::Address do
4
- let(:klass) { OpenIDConnect::ResponseObject::UserInfo::OpenID::Address }
3
+ describe OpenIDConnect::ResponseObject::UserInfo::Address do
4
+ let(:klass) { OpenIDConnect::ResponseObject::UserInfo::Address }
5
5
 
6
6
  describe 'attributes' do
7
7
  subject { klass }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe OpenIDConnect::ResponseObject::UserInfo::OpenID do
4
- let(:klass) { OpenIDConnect::ResponseObject::UserInfo::OpenID }
3
+ describe OpenIDConnect::ResponseObject::UserInfo do
4
+ let(:klass) { OpenIDConnect::ResponseObject::UserInfo }
5
5
  let(:instance) { klass.new attributes }
6
6
  subject { instance }
7
7
 
@@ -29,7 +29,7 @@ describe OpenIDConnect::ResponseObject::UserInfo::OpenID do
29
29
  :phone_number,
30
30
  :phone_number_verified,
31
31
  :address,
32
- :updated_time
32
+ :updated_at
33
33
  ]
34
34
  end
35
35
  end
@@ -95,14 +95,14 @@ describe OpenIDConnect::ResponseObject::UserInfo::OpenID do
95
95
  let :attributes do
96
96
  {address: {}}
97
97
  end
98
- its(:address) { should be_a OpenIDConnect::ResponseObject::UserInfo::OpenID::Address }
98
+ its(:address) { should be_a OpenIDConnect::ResponseObject::UserInfo::Address }
99
99
  end
100
100
 
101
101
  context 'when Address is given' do
102
102
  let :attributes do
103
- {address: OpenIDConnect::ResponseObject::UserInfo::OpenID::Address.new}
103
+ {address: OpenIDConnect::ResponseObject::UserInfo::Address.new}
104
104
  end
105
- its(:address) { should be_a OpenIDConnect::ResponseObject::UserInfo::OpenID::Address }
105
+ its(:address) { should be_a OpenIDConnect::ResponseObject::UserInfo::Address }
106
106
  end
107
107
  end
108
108
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,8 @@
1
- require 'cover_me'
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ add_filter 'spec'
5
+ end
2
6
 
3
7
  require 'rspec'
4
8
  require 'openid_connect'
metadata CHANGED
@@ -1,211 +1,211 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-01 00:00:00.000000000 Z
11
+ date: 2014-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tzinfo
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: attr_required
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.0.5
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.0.5
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activemodel
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: validate_url
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: validate_email
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: json-jwt
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.5.5
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.5.5
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: swd
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.1.2
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.1.2
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: webfinger
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.0.2
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.0.2
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rack-oauth2
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: 1.0.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.0.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0.8'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.8'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '2'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '2'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: webmock
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - '>='
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: 1.6.2
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '>='
192
+ - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: 1.6.2
195
195
  - !ruby/object:Gem::Dependency
196
- name: cover_me
196
+ name: simplecov
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - '>='
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: 1.2.0
201
+ version: '0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - '>='
206
+ - - ">="
207
207
  - !ruby/object:Gem::Version
208
- version: 1.2.0
208
+ version: '0'
209
209
  description: OpenID Connect Server & Client Library
210
210
  email:
211
211
  - nov@matake.jp
@@ -213,9 +213,9 @@ executables: []
213
213
  extensions: []
214
214
  extra_rdoc_files: []
215
215
  files:
216
- - .gitignore
217
- - .rspec
218
- - .travis.yml
216
+ - ".gitignore"
217
+ - ".rspec"
218
+ - ".travis.yml"
219
219
  - Gemfile
220
220
  - LICENSE
221
221
  - README.rdoc
@@ -239,12 +239,11 @@ files:
239
239
  - lib/openid_connect/request_object.rb
240
240
  - lib/openid_connect/request_object/claimable.rb
241
241
  - lib/openid_connect/request_object/id_token.rb
242
- - lib/openid_connect/request_object/userinfo.rb
242
+ - lib/openid_connect/request_object/user_info.rb
243
243
  - lib/openid_connect/response_object.rb
244
244
  - lib/openid_connect/response_object/id_token.rb
245
- - lib/openid_connect/response_object/userinfo.rb
246
- - lib/openid_connect/response_object/userinfo/open_id.rb
247
- - lib/openid_connect/response_object/userinfo/open_id/address.rb
245
+ - lib/openid_connect/response_object/user_info.rb
246
+ - lib/openid_connect/response_object/user_info/address.rb
248
247
  - lib/rack/oauth2/server/authorize/error_with_connect_ext.rb
249
248
  - lib/rack/oauth2/server/authorize/extension/code_and_id_token.rb
250
249
  - lib/rack/oauth2/server/authorize/extension/code_and_id_token_and_token.rb
@@ -252,7 +251,6 @@ files:
252
251
  - lib/rack/oauth2/server/authorize/extension/id_token_and_token.rb
253
252
  - lib/rack/oauth2/server/authorize/request_with_connect_params.rb
254
253
  - lib/rack/oauth2/server/id_token_response.rb
255
- - lib/rack/oauth2/server/resource/error_with_connect_ext.rb
256
254
  - openid_connect.gemspec
257
255
  - spec/helpers/crypto_spec_helper.rb
258
256
  - spec/helpers/webmock_helper.rb
@@ -286,19 +284,19 @@ files:
286
284
  - spec/openid_connect/exception_spec.rb
287
285
  - spec/openid_connect/request_object_spec.rb
288
286
  - spec/openid_connect/response_object/id_token_spec.rb
289
- - spec/openid_connect/response_object/user_info/open_id/address_spec.rb
290
- - spec/openid_connect/response_object/user_info/open_id_spec.rb
287
+ - spec/openid_connect/response_object/user_info/address_spec.rb
288
+ - spec/openid_connect/response_object/user_info_spec.rb
291
289
  - spec/openid_connect_spec.rb
292
290
  - spec/rack/oauth2/server/authorize/extension/code_and_id_token_and_token_spec.rb
293
291
  - spec/rack/oauth2/server/authorize/extension/code_and_id_token_spec.rb
294
292
  - spec/rack/oauth2/server/authorize/extension/id_token_and_token_spec.rb
295
293
  - spec/rack/oauth2/server/authorize/extension/id_token_spec.rb
296
- - spec/rack/oauth2/server/resource/error_with_connect_ext_spec.rb
297
294
  - spec/rack/oauth2/server/token/authorization_code_spec.rb
298
295
  - spec/rack/oauth2/server/token/refresh_token_spec.rb
299
296
  - spec/spec_helper.rb
300
297
  homepage: https://github.com/nov/openid_connect
301
- licenses: []
298
+ licenses:
299
+ - MIT
302
300
  metadata: {}
303
301
  post_install_message:
304
302
  rdoc_options: []
@@ -306,17 +304,17 @@ require_paths:
306
304
  - lib
307
305
  required_ruby_version: !ruby/object:Gem::Requirement
308
306
  requirements:
309
- - - '>='
307
+ - - ">="
310
308
  - !ruby/object:Gem::Version
311
309
  version: '0'
312
310
  required_rubygems_version: !ruby/object:Gem::Requirement
313
311
  requirements:
314
- - - '>='
312
+ - - ">="
315
313
  - !ruby/object:Gem::Version
316
314
  version: '0'
317
315
  requirements: []
318
316
  rubyforge_project:
319
- rubygems_version: 2.0.3
317
+ rubygems_version: 2.2.0
320
318
  signing_key:
321
319
  specification_version: 4
322
320
  summary: OpenID Connect Server & Client Library
@@ -353,14 +351,13 @@ test_files:
353
351
  - spec/openid_connect/exception_spec.rb
354
352
  - spec/openid_connect/request_object_spec.rb
355
353
  - spec/openid_connect/response_object/id_token_spec.rb
356
- - spec/openid_connect/response_object/user_info/open_id/address_spec.rb
357
- - spec/openid_connect/response_object/user_info/open_id_spec.rb
354
+ - spec/openid_connect/response_object/user_info/address_spec.rb
355
+ - spec/openid_connect/response_object/user_info_spec.rb
358
356
  - spec/openid_connect_spec.rb
359
357
  - spec/rack/oauth2/server/authorize/extension/code_and_id_token_and_token_spec.rb
360
358
  - spec/rack/oauth2/server/authorize/extension/code_and_id_token_spec.rb
361
359
  - spec/rack/oauth2/server/authorize/extension/id_token_and_token_spec.rb
362
360
  - spec/rack/oauth2/server/authorize/extension/id_token_spec.rb
363
- - spec/rack/oauth2/server/resource/error_with_connect_ext_spec.rb
364
361
  - spec/rack/oauth2/server/token/authorization_code_spec.rb
365
362
  - spec/rack/oauth2/server/token/refresh_token_spec.rb
366
363
  - spec/spec_helper.rb
@@ -1,3 +0,0 @@
1
- Dir[File.dirname(__FILE__) + '/userinfo/*.rb'].each do |file|
2
- require file
3
- end
@@ -1,65 +0,0 @@
1
- module OpenIDConnect
2
- class ResponseObject
3
- module UserInfo
4
- class OpenID < ConnectObject
5
- attr_optional(
6
- :sub,
7
- :name,
8
- :given_name,
9
- :family_name,
10
- :middle_name,
11
- :nickname,
12
- :preferred_username,
13
- :profile,
14
- :picture,
15
- :website,
16
- :email,
17
- :email_verified,
18
- :gender,
19
- :birthdate,
20
- :zoneinfo,
21
- :locale,
22
- :phone_number,
23
- :phone_number_verified,
24
- :address,
25
- :updated_time
26
- )
27
- alias_method :subject, :sub
28
- alias_method :subject=, :sub=
29
-
30
- validates :email_verified, :phone_number_verified, allow_nil: true, inclusion: {in: [true, false]}
31
- validates :gender, allow_nil: true, inclusion: {in: ['male', 'female']}
32
- validates :zoneinfo, allow_nil: true, inclusion: {in: TZInfo::TimezoneProxy.all.collect(&:name)}
33
- validates :profile, :picture, :website, allow_nil: true, url: true
34
- validates :email, allow_nil: true, email: true
35
- validate :validate_address
36
- validate :require_at_least_one_attributes
37
- # TODO: validate locale
38
-
39
- def initialize(attributes = {})
40
- super
41
- (all_attributes - [:email_verified, :phone_number_verified, :address]).each do |key|
42
- self.send "#{key}=", self.send(key).try(:to_s)
43
- end
44
- end
45
-
46
- def validate_address
47
- errors.add :address, address.errors.full_messages.join(', ') if address.present? && !address.valid?
48
- end
49
-
50
- def address=(hash_or_address)
51
- @address = case hash_or_address
52
- when Hash
53
- Address.new hash_or_address
54
- when Address
55
- hash_or_address
56
- end
57
- end
58
- end
59
- end
60
- end
61
- end
62
-
63
- Dir[File.dirname(__FILE__) + '/open_id/*.rb'].each do |file|
64
- require file
65
- end
@@ -1,12 +0,0 @@
1
- module OpenIDConnect
2
- class ResponseObject
3
- module UserInfo
4
- class OpenID
5
- class Address < ConnectObject
6
- attr_optional :formatted, :street_address, :locality, :region, :postal_code, :country
7
- validate :require_at_least_one_attributes
8
- end
9
- end
10
- end
11
- end
12
- end
@@ -1,14 +0,0 @@
1
- module Rack
2
- module OAuth2
3
- module Server
4
- class Resource
5
- module ErrorWithConnectExt
6
- def invalid_schema!(description = 'The requested schema is invalid or unsupported', options = {})
7
- bad_request! :invalid_schema, description, options
8
- end
9
- end
10
- Request.send :include, ErrorWithConnectExt
11
- end
12
- end
13
- end
14
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper.rb'
2
-
3
- describe Rack::OAuth2::Server::Resource::ErrorWithConnectExt do
4
- let(:env) { Rack::MockRequest.env_for("/authorize?client_id=client_id") }
5
- let(:request) { Rack::OAuth2::Server::Resource::Request.new env }
6
-
7
- describe 'invalid_schema!' do
8
- it do
9
- expect { request.invalid_schema! }.to raise_error Rack::OAuth2::Server::Resource::BadRequest
10
- end
11
- end
12
- end