openid_connect 0.12.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/VERSION +1 -1
- data/lib/openid_connect/client.rb +2 -1
- data/lib/rack/oauth2/server/authorize/request_with_connect_params.rb +1 -0
- data/spec/helpers/crypto_spec_helper.rb +1 -1
- data/spec/openid_connect/client_spec.rb +23 -0
- data/spec/rack/oauth2/server/authorize/extension/code_and_id_token_and_token_spec.rb +11 -0
- data/spec/rack/oauth2/server/authorize/extension/code_and_id_token_spec.rb +11 -0
- data/spec/rack/oauth2/server/authorize/extension/id_token_and_token_spec.rb +11 -0
- data/spec/rack/oauth2/server/authorize/request_with_connect_params_spec.rb +45 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 578c7069558b2b2d8de668f316f0282e19f439e0
|
4
|
+
data.tar.gz: f4231dc452dc98badea4a43df6764d4de4823fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6a3722dfe462d799e874d9218f9e783e8f8f298cba3d686c3fbebe5c35bcd8b25eb124dc6bb4b622b8a4cbfa390ec670409ed99f943573addf3ab5034aabbd
|
7
|
+
data.tar.gz: d4ac8a152776e4cf5a3190f60b203a7ae2bb4566ee2632da8c4d0e651c4503d90c5acbdcebe88f0035440737f893069d0d37e059dde8af3aa6ce3ece0abd0982
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
@@ -9,6 +9,7 @@ module OpenIDConnect
|
|
9
9
|
|
10
10
|
def authorization_uri(params = {})
|
11
11
|
params[:scope] = setup_required_scope params[:scope]
|
12
|
+
params[:prompt] = Array(params[:prompt]).join(' ')
|
12
13
|
super
|
13
14
|
end
|
14
15
|
|
@@ -19,7 +20,7 @@ module OpenIDConnect
|
|
19
20
|
private
|
20
21
|
|
21
22
|
def setup_required_scope(scopes)
|
22
|
-
_scopes_ = Array(scopes).
|
23
|
+
_scopes_ = Array(scopes).join(' ').split(' ')
|
23
24
|
_scopes_ << 'openid' unless _scopes_.include?('openid')
|
24
25
|
_scopes_
|
25
26
|
end
|
@@ -8,7 +8,7 @@ module CryptoSpecHelper
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def private_key
|
11
|
-
@private_key ||= OpenSSL::PKey::RSA.new rsa_key.export(OpenSSL::Cipher
|
11
|
+
@private_key ||= OpenSSL::PKey::RSA.new rsa_key.export(OpenSSL::Cipher.new('DES-EDE3-CBC'), 'pass-phrase'), 'pass-phrase'
|
12
12
|
end
|
13
13
|
|
14
14
|
def ec_key
|
@@ -35,10 +35,12 @@ describe OpenIDConnect::Client do
|
|
35
35
|
|
36
36
|
describe '#authorization_uri' do
|
37
37
|
let(:scope) { nil }
|
38
|
+
let(:prompt) { nil }
|
38
39
|
let(:response_type) { nil }
|
39
40
|
let(:query) do
|
40
41
|
params = {
|
41
42
|
scope: scope,
|
43
|
+
prompt: prompt,
|
42
44
|
response_type: response_type
|
43
45
|
}.reject do |k,v|
|
44
46
|
v.blank?
|
@@ -97,6 +99,27 @@ describe OpenIDConnect::Client do
|
|
97
99
|
it { should == 'openid' }
|
98
100
|
end
|
99
101
|
end
|
102
|
+
|
103
|
+
describe 'prompt' do
|
104
|
+
subject do
|
105
|
+
query[:prompt]
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'when prompt is a scalar value' do
|
109
|
+
let(:prompt) { :login }
|
110
|
+
it { should == 'login' }
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'when prompt is a space-delimited string' do
|
114
|
+
let(:prompt) { 'login consent' }
|
115
|
+
it { should == 'login consent' }
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'when prompt is an array' do
|
119
|
+
let(:prompt) { [:login, :consent] }
|
120
|
+
it { should == 'login consent' }
|
121
|
+
end
|
122
|
+
end
|
100
123
|
end
|
101
124
|
|
102
125
|
describe '#access_token!' do
|
@@ -53,4 +53,15 @@ describe Rack::OAuth2::Server::Authorize::Extension::CodeAndIdTokenAndToken do
|
|
53
53
|
expect { response }.to raise_error AttrRequired::AttrMissing, "'access_token', 'code', 'id_token' required."
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
context 'when error response' do
|
58
|
+
let(:env) { Rack::MockRequest.env_for("/authorize?client_id=client_id") }
|
59
|
+
let(:request) { Rack::OAuth2::Server::Authorize::Extension::CodeAndIdTokenAndToken::Request.new env }
|
60
|
+
|
61
|
+
it 'should set protocol_params_location = :fragment' do
|
62
|
+
expect { request.bad_request! }.to raise_error(Rack::OAuth2::Server::Authorize::BadRequest) { |e|
|
63
|
+
e.protocol_params_location.should == :fragment
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
56
67
|
end
|
@@ -50,4 +50,15 @@ describe Rack::OAuth2::Server::Authorize::Extension::CodeAndIdToken do
|
|
50
50
|
expect { response }.to raise_error AttrRequired::AttrMissing, "'id_token' required."
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
context 'when error response' do
|
55
|
+
let(:env) { Rack::MockRequest.env_for("/authorize?client_id=client_id") }
|
56
|
+
let(:request) { Rack::OAuth2::Server::Authorize::Extension::CodeAndIdToken::Request.new env }
|
57
|
+
|
58
|
+
it 'should set protocol_params_location = :fragment' do
|
59
|
+
expect { request.bad_request! }.to raise_error(Rack::OAuth2::Server::Authorize::BadRequest) { |e|
|
60
|
+
e.protocol_params_location.should == :fragment
|
61
|
+
}
|
62
|
+
end
|
63
|
+
end
|
53
64
|
end
|
@@ -51,4 +51,15 @@ describe Rack::OAuth2::Server::Authorize::Extension::IdTokenAndToken do
|
|
51
51
|
expect { response }.to raise_error AttrRequired::AttrMissing, "'id_token' required."
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
context 'when error response' do
|
56
|
+
let(:env) { Rack::MockRequest.env_for("/authorize?client_id=client_id") }
|
57
|
+
let(:request) { Rack::OAuth2::Server::Authorize::Extension::IdTokenAndToken::Request.new env }
|
58
|
+
|
59
|
+
it 'should set protocol_params_location = :fragment' do
|
60
|
+
expect { request.bad_request! }.to raise_error(Rack::OAuth2::Server::Authorize::BadRequest) { |e|
|
61
|
+
e.protocol_params_location.should == :fragment
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
54
65
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rack::OAuth2::Server::Authorize::RequestWithConnectParams do
|
4
|
+
let(:base_params) do
|
5
|
+
{
|
6
|
+
client_id: 'client_id',
|
7
|
+
redirect_uri: 'https://client.example.com/callback'
|
8
|
+
}
|
9
|
+
end
|
10
|
+
let(:env) { Rack::MockRequest.env_for("/authorize?#{base_params.to_query}&#{params.to_query}") }
|
11
|
+
let(:request) { Rack::OAuth2::Server::Authorize::Request.new env }
|
12
|
+
subject { request }
|
13
|
+
|
14
|
+
describe 'prompt' do
|
15
|
+
context 'when a space-delimited string given' do
|
16
|
+
let(:params) do
|
17
|
+
{prompt: 'login consent'}
|
18
|
+
end
|
19
|
+
its(:prompt) { should == ['login', 'consent']}
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when a single string given' do
|
23
|
+
let(:params) do
|
24
|
+
{prompt: 'login'}
|
25
|
+
end
|
26
|
+
its(:prompt) { should == ['login']}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'max_age' do
|
31
|
+
context 'when numeric value given' do
|
32
|
+
let(:params) do
|
33
|
+
{max_age: '5'}
|
34
|
+
end
|
35
|
+
its(:max_age) { should == 5}
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when non-numeric string given' do
|
39
|
+
let(:params) do
|
40
|
+
{max_age: 'foo'}
|
41
|
+
end
|
42
|
+
its(:max_age) { should == 0}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openid_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -309,6 +309,7 @@ files:
|
|
309
309
|
- spec/rack/oauth2/server/authorize/extension/code_and_id_token_spec.rb
|
310
310
|
- spec/rack/oauth2/server/authorize/extension/id_token_and_token_spec.rb
|
311
311
|
- spec/rack/oauth2/server/authorize/extension/id_token_spec.rb
|
312
|
+
- spec/rack/oauth2/server/authorize/request_with_connect_params_spec.rb
|
312
313
|
- spec/rack/oauth2/server/token/authorization_code_spec.rb
|
313
314
|
- spec/rack/oauth2/server/token/refresh_token_spec.rb
|
314
315
|
- spec/spec_helper.rb
|
@@ -332,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
333
|
version: '0'
|
333
334
|
requirements: []
|
334
335
|
rubyforge_project:
|
335
|
-
rubygems_version: 2.
|
336
|
+
rubygems_version: 2.6.8
|
336
337
|
signing_key:
|
337
338
|
specification_version: 4
|
338
339
|
summary: OpenID Connect Server & Client Library
|
@@ -380,6 +381,7 @@ test_files:
|
|
380
381
|
- spec/rack/oauth2/server/authorize/extension/code_and_id_token_spec.rb
|
381
382
|
- spec/rack/oauth2/server/authorize/extension/id_token_and_token_spec.rb
|
382
383
|
- spec/rack/oauth2/server/authorize/extension/id_token_spec.rb
|
384
|
+
- spec/rack/oauth2/server/authorize/request_with_connect_params_spec.rb
|
383
385
|
- spec/rack/oauth2/server/token/authorization_code_spec.rb
|
384
386
|
- spec/rack/oauth2/server/token/refresh_token_spec.rb
|
385
387
|
- spec/spec_helper.rb
|