omniauth-shibboleth 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/lib/omniauth-shibboleth/version.rb +1 -1
- data/lib/omniauth/strategies/shibboleth.rb +5 -5
- data/spec/omniauth/strategies/shibboleth_spec.rb +51 -25
- data/spec/spec_helper.rb +1 -1
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmU0MzE3ZDc4YzBjMjA4ZDZhNjhkMGI1MmZmZDkyNGRjMTU2ZDcyOA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20c1c77307a9603a5313733f2c8475852f2727d1
|
4
|
+
data.tar.gz: 313fae3b26554a22341ab31ac26870737e82fed2
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZWFmNTJjYWYzOWE1YTA1ODFjMjUxY2ZmYmExOTU4MTdlOWU4OWNiMDFhZjJk
|
11
|
-
NzY2MmY4NTFmODUxNTNlZGMzODkwN2MxMTc0NzRiMTgzMjQwNTE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MGJjY2RmZWQzZjJlNzgzYmQ3YTdiNTA2YTNjMzFhYjZkYmYzMGUzYWMyNWM4
|
14
|
-
Yjc2NTkyNmYxYjU2NWI3OTdkODIyN2RkZjBjYzc4MWEyZGIyMTAzN2VlOTUz
|
15
|
-
NzE1NWRkNWZhNDUyNjQ3NTEzN2MyNTNhYzQyMmUzNGQ3NTM5MWY=
|
6
|
+
metadata.gz: 072bf6b32382982a02d9f7f6d95e9a38549eac6ca3d1f3001b2dd95d97fa50fb82fc9532bd7c617698e7e1f1a43010c3603b6a39dbbffaf0984d78da5fcf34ce
|
7
|
+
data.tar.gz: 685f71cc782f3ebfed15676c55b498be3cde4b94a1ebe3be39b4f9dfa8bad5ce6710f5c78202ee1f7573e85ac09cffa2e661835ab9cf05db9a1fc4d57216f501
|
@@ -25,20 +25,20 @@ module OmniAuth
|
|
25
25
|
|
26
26
|
def request_params
|
27
27
|
case options[:request_type]
|
28
|
-
when :env, :header
|
28
|
+
when :env, 'env', :header, 'header'
|
29
29
|
request.env
|
30
|
-
when :params
|
30
|
+
when :params, 'params'
|
31
31
|
request.params
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def request_param(key)
|
36
36
|
case options[:request_type]
|
37
|
-
when :env
|
37
|
+
when :env, 'env'
|
38
38
|
request.env[key]
|
39
|
-
when :header
|
39
|
+
when :header, 'header'
|
40
40
|
request.env["HTTP_#{key.upcase.gsub('-', '_')}"]
|
41
|
-
when :params
|
41
|
+
when :params, 'params'
|
42
42
|
request.params[key]
|
43
43
|
end
|
44
44
|
end
|
@@ -29,9 +29,9 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
29
29
|
get '/auth/shibboleth'
|
30
30
|
end
|
31
31
|
|
32
|
-
it '
|
33
|
-
last_response.status.
|
34
|
-
last_response.location.
|
32
|
+
it 'is expected to redirect to callback_url' do
|
33
|
+
expect(last_response.status).to eq(302)
|
34
|
+
expect(last_response.location).to eq('/auth/shibboleth/callback')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -41,22 +41,22 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
41
41
|
get '/auth/shibboleth/callback'
|
42
42
|
end
|
43
43
|
|
44
|
-
it '
|
45
|
-
last_response.status.
|
46
|
-
last_response.location.
|
44
|
+
it 'is expected to fail to get Shib-Session-ID environment variable' do
|
45
|
+
expect(last_response.status).to eq(302)
|
46
|
+
expect(last_response.location).to eq(failure_path)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
context 'with Shibboleth session' do
|
51
51
|
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, {}) }
|
52
52
|
|
53
|
-
it '
|
53
|
+
it 'is expected to set default omniauth.auth fields' do
|
54
54
|
@dummy_id = 'abcdefg'
|
55
55
|
@eppn = 'test@example.com'
|
56
56
|
@display_name = 'Test User'
|
57
57
|
strategy.call!(make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'eppn' => @eppn, 'displayName' => @display_name))
|
58
|
-
strategy.env['omniauth.auth']['uid'].
|
59
|
-
strategy.env['omniauth.auth']['info']['name'].
|
58
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq(@eppn)
|
59
|
+
expect(strategy.env['omniauth.auth']['info']['name']).to eq(@display_name)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -71,15 +71,15 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
71
71
|
let(:app){ lambda{|env| [404, {}, ['Awesome']]}}
|
72
72
|
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
|
73
73
|
|
74
|
-
it '
|
74
|
+
it 'is expected to set specified omniauth.auth fields' do
|
75
75
|
@dummy_id = 'abcdefg'
|
76
76
|
@uid = 'test'
|
77
77
|
@organization = 'Test Corporation'
|
78
78
|
@affiliation = 'faculty'
|
79
79
|
strategy.call!(make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'uid' => @uid, 'o' => @organization, 'affiliation' => @affiliation))
|
80
|
-
strategy.env['omniauth.auth']['uid'].
|
81
|
-
strategy.env['omniauth.auth']['extra']['raw_info']['o'].
|
82
|
-
strategy.env['omniauth.auth']['extra']['raw_info']['affiliation'].
|
80
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq(@uid)
|
81
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['o']).to eq(@organization)
|
82
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['affiliation']).to eq(@affiliation)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -87,13 +87,13 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
87
87
|
let(:options){ { :debug => true} }
|
88
88
|
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
|
89
89
|
|
90
|
-
it '
|
90
|
+
it 'is expected to raise environment variables' do
|
91
91
|
@dummy_id = 'abcdefg'
|
92
92
|
@eppn = 'test@example.com'
|
93
93
|
@display_name = 'Test User'
|
94
94
|
env = make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'eppn' => @eppn, 'displayName' => @display_name)
|
95
95
|
response = strategy.call!(env)
|
96
|
-
response[0].
|
96
|
+
expect(response[0]).to eq(200)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -108,7 +108,7 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
108
108
|
:extra_fields => [:o, :affiliation] } }
|
109
109
|
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
|
110
110
|
|
111
|
-
it '
|
111
|
+
it 'is expected to handle header variables' do
|
112
112
|
@dummy_id = 'abcdefg'
|
113
113
|
@display_name = 'Test User'
|
114
114
|
@uid = 'test'
|
@@ -116,10 +116,36 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
116
116
|
@affiliation = 'faculty'
|
117
117
|
env = make_env('/auth/shibboleth/callback', 'HTTP_SHIB_SESSION_ID' => @dummy_id, 'HTTP_DISPLAYNAME' => @display_name, 'HTTP_UID' => @uid, 'HTTP_O' => @organization, 'HTTP_AFFILIATION' => @affiliation)
|
118
118
|
response = strategy.call!(env)
|
119
|
-
strategy.env['omniauth.auth']['uid'].
|
120
|
-
strategy.env['omniauth.auth']['info']['name'].
|
121
|
-
strategy.env['omniauth.auth']['extra']['raw_info']['o'].
|
122
|
-
strategy.env['omniauth.auth']['extra']['raw_info']['affiliation'].
|
119
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq(@uid)
|
120
|
+
expect(strategy.env['omniauth.auth']['info']['name']).to eq(@display_name)
|
121
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['o']).to eq(@organization)
|
122
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['affiliation']).to eq(@affiliation)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context "with request_type = 'header'" do
|
127
|
+
let(:options){ {
|
128
|
+
:request_type => 'header',
|
129
|
+
:shib_session_id_field => 'Shib-Session-ID',
|
130
|
+
:shib_application_id_field => 'Shib-Application-ID',
|
131
|
+
:uid_field => :uid,
|
132
|
+
:name_field => :displayName,
|
133
|
+
:info_fields => {},
|
134
|
+
:extra_fields => [:o, :affiliation] } }
|
135
|
+
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
|
136
|
+
|
137
|
+
it 'is expected to handle header variables' do
|
138
|
+
@dummy_id = 'abcdefg'
|
139
|
+
@display_name = 'Test User'
|
140
|
+
@uid = 'test'
|
141
|
+
@organization = 'Test Corporation'
|
142
|
+
@affiliation = 'faculty'
|
143
|
+
env = make_env('/auth/shibboleth/callback', 'HTTP_SHIB_SESSION_ID' => @dummy_id, 'HTTP_DISPLAYNAME' => @display_name, 'HTTP_UID' => @uid, 'HTTP_O' => @organization, 'HTTP_AFFILIATION' => @affiliation)
|
144
|
+
response = strategy.call!(env)
|
145
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq(@uid)
|
146
|
+
expect(strategy.env['omniauth.auth']['info']['name']).to eq(@display_name)
|
147
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['o']).to eq(@organization)
|
148
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['affiliation']).to eq(@affiliation)
|
123
149
|
end
|
124
150
|
end
|
125
151
|
|
@@ -134,7 +160,7 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
134
160
|
:extra_fields => [:o, :affiliation] } }
|
135
161
|
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
|
136
162
|
|
137
|
-
it '
|
163
|
+
it 'is expected to handle params variables' do
|
138
164
|
@dummy_id = 'abcdefg'
|
139
165
|
@display_name = 'Test User'
|
140
166
|
@uid = 'test'
|
@@ -142,10 +168,10 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
142
168
|
@affiliation = 'faculty'
|
143
169
|
env = make_env('/auth/shibboleth/callback', 'QUERY_STRING' => "Shib-Session-ID=#{@dummy_id}&uid=#{@uid}&displayName=#{@display_name}&o=#{@organization}&affiliation=#{@affiliation}")
|
144
170
|
response = strategy.call!(env)
|
145
|
-
strategy.env['omniauth.auth']['uid'].
|
146
|
-
strategy.env['omniauth.auth']['info']['name'].
|
147
|
-
strategy.env['omniauth.auth']['extra']['raw_info']['o'].
|
148
|
-
strategy.env['omniauth.auth']['extra']['raw_info']['affiliation'].
|
171
|
+
expect(strategy.env['omniauth.auth']['uid']).to eq(@uid)
|
172
|
+
expect(strategy.env['omniauth.auth']['info']['name']).to eq(@display_name)
|
173
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['o']).to eq(@organization)
|
174
|
+
expect(strategy.env['omniauth.auth']['extra']['raw_info']['affiliation']).to eq(@affiliation)
|
149
175
|
end
|
150
176
|
end
|
151
177
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-shibboleth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toyokazu Akiyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.0
|
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.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack-test
|
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: :development
|
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: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
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'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.8'
|
62
62
|
type: :development
|
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: '2.8'
|
69
69
|
description: OmniAuth Shibboleth strategies for OmniAuth 1.x
|
@@ -74,12 +74,12 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- Gemfile
|
77
|
-
-
|
78
|
-
-
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
79
|
- lib/omniauth-shibboleth.rb
|
80
|
+
- lib/omniauth-shibboleth/version.rb
|
81
|
+
- lib/omniauth/strategies/shibboleth.rb
|
80
82
|
- omniauth-shibboleth.gemspec
|
81
|
-
- Rakefile
|
82
|
-
- README.md
|
83
83
|
- spec/omniauth/strategies/shibboleth_spec.rb
|
84
84
|
- spec/spec_helper.rb
|
85
85
|
homepage: ''
|
@@ -92,20 +92,21 @@ require_paths:
|
|
92
92
|
- lib
|
93
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.3.0
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: OmniAuth Shibboleth strategies for OmniAuth 1.x
|
109
109
|
test_files:
|
110
110
|
- spec/omniauth/strategies/shibboleth_spec.rb
|
111
111
|
- spec/spec_helper.rb
|
112
|
+
has_rdoc:
|