omniauth-cas 1.0.4 → 1.1.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/omniauth/cas/version.rb +1 -1
- data/lib/omniauth/strategies/cas.rb +6 -0
- data/lib/omniauth/strategies/cas/service_ticket_validator.rb +5 -10
- data/omniauth-cas.gemspec +1 -1
- data/spec/omniauth/strategies/cas_spec.rb +46 -58
- metadata +6 -8
- data/spec/fixtures/cas_success_jasig.xml +0 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjc3ZjA4OWRiNjhlNDgxMzcxNTEyYWIxODE1Y2U5ZWY2Y2U0YmU4MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmE0ZjRhNzRkYmM5NTYwNGE1M2QwNjgxNGFjODAyZjk3MDk0MTE4ZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWYwMGVjNWEzMzkzODlhOWEwNWY0MWExYTBiNWM2YjdlNGNlMDAyZjJlMjQx
|
10
|
+
YTdiZWRkMzJhODgwOTY2YjMzZTg2ZWZiOWVjYTNiN2NlMmUzZTNhYzFjZGYx
|
11
|
+
MGJiODI3OTdkMDBkMGM3YjA3MmU1YWFkNmQ0YTg0Y2E4NjAzYjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTkyYjcwZTQxMzE3NzNmYmFjOWE0ZjkyMDY4MzMxMjlhNDU1MTg2ZjQwYmFm
|
14
|
+
YzA2MzJkZGNlNjYzYmE2YjE3NjZiMTZiZGJkYzZkMzdlMzY3NjE1OWU5MjI1
|
15
|
+
MGYxZWQ1MDQ2NzhmNjUzNjVmNzJkMTc0OGJjMGIyOTYyN2MwOGM=
|
data/lib/omniauth/cas/version.rb
CHANGED
@@ -139,6 +139,12 @@ module OmniAuth
|
|
139
139
|
end.to_s
|
140
140
|
end
|
141
141
|
|
142
|
+
# Adds support for custom callback_paths
|
143
|
+
# See: https://github.com/intridea/omniauth/issues/630
|
144
|
+
def callback_path
|
145
|
+
options[:callback_path].is_a?(String) ? options[:callback_path] : (custom_path(:callback_path) || custom_path(:request_path) || "#{path_prefix}/#{name}/callback")
|
146
|
+
end
|
147
|
+
|
142
148
|
private
|
143
149
|
|
144
150
|
# Deletes Hash pairs with `nil` values.
|
@@ -41,20 +41,15 @@ module OmniAuth
|
|
41
41
|
|
42
42
|
{}.tap do |hash|
|
43
43
|
node.children.each do |e|
|
44
|
-
node_name = e.name.sub(/^cas:/, '')
|
45
44
|
unless e.kind_of?(Nokogiri::XML::Text) ||
|
46
|
-
|
45
|
+
e.name == 'cas:proxies' ||
|
46
|
+
e.name == 'proxies'
|
47
47
|
# There are no child elements
|
48
48
|
if e.element_children.count == 0
|
49
|
-
hash[
|
49
|
+
hash[e.name.sub(/^cas:/, '')] = e.content
|
50
50
|
elsif e.element_children.count
|
51
|
-
|
52
|
-
|
53
|
-
hash.merge! parse_user_info e
|
54
|
-
else
|
55
|
-
hash[node_name] = [] if hash[node_name].nil?
|
56
|
-
hash[node_name].push parse_user_info e
|
57
|
-
end
|
51
|
+
hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil?
|
52
|
+
hash[e.name.sub(/^cas:/, '')].push parse_user_info e
|
58
53
|
end
|
59
54
|
end
|
60
55
|
end
|
data/omniauth-cas.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Omniauth::Cas::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency 'omniauth', '~> 1.1.0'
|
19
|
-
gem.add_dependency 'nokogiri', '~> 1.
|
19
|
+
gem.add_dependency 'nokogiri', '~> 1.5'
|
20
20
|
gem.add_dependency 'addressable', '~> 2.3'
|
21
21
|
|
22
22
|
gem.add_development_dependency 'rake', '~> 0.9'
|
@@ -81,84 +81,72 @@ describe OmniAuth::Strategies::CAS, type: :strategy do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
describe 'GET /auth/cas/callback with a valid ticket' do
|
84
|
-
|
85
|
-
before do
|
86
|
-
stub_request(:get, /^http:\/\/cas.example.org:8080?\/serviceValidate\?([^&]+&)?ticket=593af/)
|
87
|
-
.with { |request| @request_uri = request.uri.to_s }
|
88
|
-
.to_return( body: File.read("spec/fixtures/#{xml_file_name}") )
|
89
|
-
|
90
|
-
get "/auth/cas/callback?ticket=593af&url=#{return_url}"
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'should strip the ticket parameter from the callback URL' do
|
94
|
-
@request_uri.scan('ticket=').length.should == 1
|
95
|
-
end
|
84
|
+
let(:return_url) { 'http://127.0.0.10/?some=parameter' }
|
96
85
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
service: 'http://example.org/auth/cas/callback?url=' + Rack::Utils.escape('http://127.0.0.10/?some=parameter')
|
102
|
-
})
|
103
|
-
end
|
86
|
+
before do
|
87
|
+
stub_request(:get, /^http:\/\/cas.example.org:8080?\/serviceValidate\?([^&]+&)?ticket=593af/)
|
88
|
+
.with { |request| @request_uri = request.uri.to_s }
|
89
|
+
.to_return( body: File.read('spec/fixtures/cas_success.xml') )
|
104
90
|
|
105
|
-
|
106
|
-
|
91
|
+
get "/auth/cas/callback?ticket=593af&url=#{return_url}"
|
92
|
+
end
|
107
93
|
|
108
|
-
|
94
|
+
it 'should strip the ticket parameter from the callback URL' do
|
95
|
+
@request_uri.scan('ticket=').length.should == 1
|
96
|
+
end
|
109
97
|
|
110
|
-
|
98
|
+
it 'should properly encode the service URL' do
|
99
|
+
WebMock.should have_requested(:get, 'http://cas.example.org:8080/serviceValidate')
|
100
|
+
.with(query: {
|
101
|
+
ticket: '593af',
|
102
|
+
service: 'http://example.org/auth/cas/callback?url=' + Rack::Utils.escape('http://127.0.0.10/?some=parameter')
|
103
|
+
})
|
104
|
+
end
|
111
105
|
|
112
|
-
|
106
|
+
context "request.env['omniauth.auth']" do
|
107
|
+
subject { last_request.env['omniauth.auth'] }
|
113
108
|
|
114
|
-
|
115
|
-
subject { last_request.env['omniauth.auth']['info'] }
|
109
|
+
it { should be_kind_of Hash }
|
116
110
|
|
117
|
-
|
111
|
+
its(:provider) { should == :cas }
|
118
112
|
|
119
|
-
|
120
|
-
its(:first_name) { should == 'Peter' }
|
121
|
-
its(:last_name) { should == 'Segel' }
|
122
|
-
its(:email) { should == 'psegel@intridea.com' }
|
123
|
-
its(:location) { should == 'Washington, D.C.' }
|
124
|
-
its(:image) { should == '/images/user.jpg' }
|
125
|
-
its(:phone) { should == '555-555-5555' }
|
126
|
-
end
|
113
|
+
its(:uid) { should == '54'}
|
127
114
|
|
128
|
-
|
129
|
-
|
115
|
+
context 'the info hash' do
|
116
|
+
subject { last_request.env['omniauth.auth']['info'] }
|
130
117
|
|
131
|
-
|
118
|
+
it { should have(6).items }
|
132
119
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
120
|
+
its(:name) { should == 'Peter Segel' }
|
121
|
+
its(:first_name) { should == 'Peter' }
|
122
|
+
its(:last_name) { should == 'Segel' }
|
123
|
+
its(:email) { should == 'psegel@intridea.com' }
|
124
|
+
its(:location) { should == 'Washington, D.C.' }
|
125
|
+
its(:image) { should == '/images/user.jpg' }
|
126
|
+
its(:phone) { should == '555-555-5555' }
|
127
|
+
end
|
137
128
|
|
138
|
-
|
139
|
-
|
129
|
+
context 'the extra hash' do
|
130
|
+
subject { last_request.env['omniauth.auth']['extra'] }
|
140
131
|
|
141
|
-
|
132
|
+
it { should have(3).items }
|
142
133
|
|
143
|
-
|
144
|
-
|
134
|
+
its(:user) { should == 'psegel' }
|
135
|
+
its(:employeeid) { should == '54' }
|
136
|
+
its(:hire_date) { should == '2004-07-13' }
|
145
137
|
end
|
146
138
|
|
147
|
-
|
148
|
-
|
149
|
-
end
|
150
|
-
end
|
139
|
+
context 'the credentials hash' do
|
140
|
+
subject { last_request.env['omniauth.auth']['credentials'] }
|
151
141
|
|
152
|
-
|
142
|
+
it { should have(1).items }
|
153
143
|
|
154
|
-
|
155
|
-
|
156
|
-
it_behaves_like :successful_validation
|
144
|
+
its(:ticket) { should == '593af' }
|
145
|
+
end
|
157
146
|
end
|
158
147
|
|
159
|
-
|
160
|
-
|
161
|
-
it_behaves_like :successful_validation
|
148
|
+
it 'should call through to the master app' do
|
149
|
+
last_response.body.should == 'true'
|
162
150
|
end
|
163
151
|
end
|
164
152
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-cas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Lindahl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.5'
|
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
|
-
version: '1.
|
40
|
+
version: '1.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: addressable
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- omniauth-cas.gemspec
|
161
161
|
- spec/fixtures/cas_failure.xml
|
162
162
|
- spec/fixtures/cas_success.xml
|
163
|
-
- spec/fixtures/cas_success_jasig.xml
|
164
163
|
- spec/omniauth/strategies/cas/configuration_spec.rb
|
165
164
|
- spec/omniauth/strategies/cas/service_ticket_validator_spec.rb
|
166
165
|
- spec/omniauth/strategies/cas_spec.rb
|
@@ -179,9 +178,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
178
|
version: '0'
|
180
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
180
|
requirements:
|
182
|
-
- - ! '
|
181
|
+
- - ! '>'
|
183
182
|
- !ruby/object:Gem::Version
|
184
|
-
version:
|
183
|
+
version: 1.3.1
|
185
184
|
requirements: []
|
186
185
|
rubyforge_project:
|
187
186
|
rubygems_version: 2.0.3
|
@@ -191,7 +190,6 @@ summary: CAS Strategy for OmniAuth
|
|
191
190
|
test_files:
|
192
191
|
- spec/fixtures/cas_failure.xml
|
193
192
|
- spec/fixtures/cas_success.xml
|
194
|
-
- spec/fixtures/cas_success_jasig.xml
|
195
193
|
- spec/omniauth/strategies/cas/configuration_spec.rb
|
196
194
|
- spec/omniauth/strategies/cas/service_ticket_validator_spec.rb
|
197
195
|
- spec/omniauth/strategies/cas_spec.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
|
2
|
-
<cas:authenticationSuccess>
|
3
|
-
<cas:user>psegel</cas:user>
|
4
|
-
<cas:attributes>
|
5
|
-
<cas:employeeid>54</cas:employeeid>
|
6
|
-
<cas:first_name>P. Segel</cas:first_name>
|
7
|
-
<cas:first_name>Peter</cas:first_name>
|
8
|
-
<cas:last_name>Segel</cas:last_name>
|
9
|
-
<cas:email>psegel@intridea.com</cas:email>
|
10
|
-
<cas:location>Washington, D.C.</cas:location>
|
11
|
-
<cas:image>/images/user.jpg</cas:image>
|
12
|
-
<cas:phone>555-555-5555</cas:phone>
|
13
|
-
<cas:hire_date>2004-07-13</cas:hire_date>
|
14
|
-
</cas:attributes>
|
15
|
-
</cas:authenticationSuccess>
|
16
|
-
</cas:serviceResponse>
|