omniauth-cas 0.0.6.alpha → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +7 -0
- data/README.md +1 -2
- data/lib/omniauth/cas/version.rb +1 -1
- data/lib/omniauth/strategies/cas/service_ticket_validator.rb +4 -23
- data/omniauth-cas.gemspec +3 -3
- data/spec/omniauth/strategies/cas/service_ticket_validator_spec.rb +1 -1
- data/spec/omniauth/strategies/cas_spec.rb +3 -3
- metadata +28 -28
data/History.md
CHANGED
data/README.md
CHANGED
@@ -43,8 +43,7 @@ Other configuration options:
|
|
43
43
|
* `service_validate_url` - The URL to use to validate a user. Defaults to `'/serviceValidate'`
|
44
44
|
* `logout_url` - The URL to use to logout a user. Defaults to `'/logout'`
|
45
45
|
* `uid_key` - The user data attribute to use as your user's unique identifier. Defaults to `'user'` (which usually contains the user's login name)
|
46
|
-
* `ca_path` - Optional when `ssl` is `true`.
|
47
|
-
Defaults to something sensible on Ubuntu and OS X. See [Net::HTTP][net_http] for more details
|
46
|
+
* `ca_path` - Optional when `ssl` is `true`. Sets path of a CA certification directory. See [Net::HTTP][net_http] for more details
|
48
47
|
|
49
48
|
## Contributing
|
50
49
|
|
data/lib/omniauth/cas/version.rb
CHANGED
@@ -9,19 +9,6 @@ module OmniAuth
|
|
9
9
|
|
10
10
|
VALIDATION_REQUEST_HEADERS = { 'Accept' => '*/*' }
|
11
11
|
|
12
|
-
UbuntuCAPath = '/etc/ssl/certs'
|
13
|
-
OSXCAPath = '/opt/local/share/curl/curl-ca-bundle.crt'
|
14
|
-
|
15
|
-
DefaultCAPath = begin
|
16
|
-
if File.exists?(UbuntuCAPath)
|
17
|
-
UbuntuCAPath
|
18
|
-
elsif File.exists?(OSXCAPath)
|
19
|
-
OSXCAPath
|
20
|
-
else
|
21
|
-
nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
12
|
# Build a validator from a +configuration+, a
|
26
13
|
# +return_to+ URL, and a +ticket+.
|
27
14
|
#
|
@@ -30,7 +17,7 @@ module OmniAuth
|
|
30
17
|
# @param [String] ticket the service ticket to validate
|
31
18
|
def initialize(strategy, options, return_to_url, ticket)
|
32
19
|
@options = options
|
33
|
-
@uri =
|
20
|
+
@uri = URI.parse(strategy.service_validate_url(return_to_url, ticket))
|
34
21
|
end
|
35
22
|
|
36
23
|
# Request validation of the ticket from the CAS server's
|
@@ -89,22 +76,16 @@ module OmniAuth
|
|
89
76
|
# retrieves the `<cas:serviceResponse>` XML from the CAS server
|
90
77
|
def get_service_response_body
|
91
78
|
result = ''
|
92
|
-
|
93
79
|
http = Net::HTTP.new(@uri.host, @uri.port)
|
94
|
-
http.use_ssl =
|
95
|
-
|
80
|
+
http.use_ssl = @uri.port == 443 || @uri.instance_of?(URI::HTTPS)
|
96
81
|
if http.use_ssl?
|
97
82
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @options.disable_ssl_verification?
|
98
|
-
|
99
|
-
ca_path = @options.ca_path or DefaultCAPath
|
100
|
-
http.ca_path = ca_path if ca_path
|
83
|
+
http.ca_path = @options.ca_path
|
101
84
|
end
|
102
|
-
|
103
85
|
http.start do |c|
|
104
|
-
response = c.get
|
86
|
+
response = c.get "#{@uri.path}?#{@uri.query}", VALIDATION_REQUEST_HEADERS.dup
|
105
87
|
result = response.body
|
106
88
|
end
|
107
|
-
|
108
89
|
result
|
109
90
|
end
|
110
91
|
|
data/omniauth-cas.gemspec
CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency 'addressable', '~> 2.2'
|
21
21
|
|
22
22
|
gem.add_development_dependency 'rake', '~> 0.9'
|
23
|
-
gem.add_development_dependency 'webmock', '~> 1.
|
24
|
-
gem.add_development_dependency 'simplecov', '~> 0.
|
23
|
+
gem.add_development_dependency 'webmock', '~> 1.8.2'
|
24
|
+
gem.add_development_dependency 'simplecov', '~> 0.6.1'
|
25
25
|
gem.add_development_dependency 'rspec', '~> 2.8'
|
26
26
|
gem.add_development_dependency 'rack-test', '~> 0.6'
|
27
|
-
gem.add_development_dependency 'bourne', '~> 1.
|
27
|
+
gem.add_development_dependency 'bourne', '~> 1.1.1'
|
28
28
|
|
29
29
|
gem.add_development_dependency 'awesome_print'
|
30
30
|
|
@@ -22,7 +22,7 @@ describe OmniAuth::Strategies::CAS::ServiceTicketValidator do
|
|
22
22
|
|
23
23
|
describe "#user_info" do
|
24
24
|
before do
|
25
|
-
stub_request(:get, "https://example.org
|
25
|
+
stub_request(:get, "https://example.org/serviceValidate?").to_return(:status => 200, :body => '')
|
26
26
|
validator.user_info
|
27
27
|
end
|
28
28
|
it "should use the configured CA path" do
|
@@ -56,7 +56,7 @@ describe OmniAuth::Strategies::CAS, :type => :strategy do
|
|
56
56
|
|
57
57
|
describe 'GET /auth/cas/callback with an invalid ticket' do
|
58
58
|
before do
|
59
|
-
stub_request(:get, /^https:\/\/cas.example.org(:443)
|
59
|
+
stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=9391d/).
|
60
60
|
to_return( :body => File.read('spec/fixtures/cas_failure.xml') )
|
61
61
|
get '/auth/cas/callback?ticket=9391d'
|
62
62
|
end
|
@@ -72,7 +72,7 @@ describe OmniAuth::Strategies::CAS, :type => :strategy do
|
|
72
72
|
describe 'GET /auth/cas/callback with a valid ticket' do
|
73
73
|
let(:return_url) { "http://127.0.0.10/?some=parameter" }
|
74
74
|
before do
|
75
|
-
stub_request(:get, /^https:\/\/cas.example.org(:443)
|
75
|
+
stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=593af/).
|
76
76
|
with { |request| @request_uri = request.uri.to_s }.
|
77
77
|
to_return( :body => File.read('spec/fixtures/cas_success.xml') )
|
78
78
|
|
@@ -84,7 +84,7 @@ describe OmniAuth::Strategies::CAS, :type => :strategy do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should properly encode the service URL" do
|
87
|
-
WebMock.should have_requested(:get, "https://cas.example.org
|
87
|
+
WebMock.should have_requested(:get, "https://cas.example.org/serviceValidate")
|
88
88
|
.with(:query => {
|
89
89
|
:ticket => "593af",
|
90
90
|
:service => "http://example.org/auth/cas/callback?url=" + Rack::Utils.escape("http://127.0.0.10/?some=parameter")
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-cas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.6
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Derek Lindahl
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-08 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &2160743320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2160743320
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &2160742740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.5'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2160742740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: addressable
|
38
|
-
requirement: &
|
38
|
+
requirement: &2160742260 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.2'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2160742260
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &2160741700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,32 +54,32 @@ dependencies:
|
|
54
54
|
version: '0.9'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2160741700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: webmock
|
60
|
-
requirement: &
|
60
|
+
requirement: &2160741200 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: 1.8.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2160741200
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &2160740720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
76
|
+
version: 0.6.1
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2160740720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &2160740120 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '2.8'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2160740120
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rack-test
|
93
|
-
requirement: &
|
93
|
+
requirement: &2160739660 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,21 +98,21 @@ dependencies:
|
|
98
98
|
version: '0.6'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2160739660
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: bourne
|
104
|
-
requirement: &
|
104
|
+
requirement: &2160606980 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 1.1.1
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2160606980
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: awesome_print
|
115
|
-
requirement: &
|
115
|
+
requirement: &2160606580 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2160606580
|
124
124
|
description:
|
125
125
|
email:
|
126
126
|
- dlindahl@customink.com
|
@@ -163,9 +163,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
164
|
none: false
|
165
165
|
requirements:
|
166
|
-
- - ! '
|
166
|
+
- - ! '>='
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
168
|
+
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
171
|
rubygems_version: 1.8.10
|