devise_cas_authenticatable 1.0.0.alpha8 → 1.0.0.alpha10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -2
- data/Gemfile.lock +0 -12
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/devise_cas_authenticatable.gemspec +2 -23
- data/lib/devise_cas_authenticatable/model.rb +1 -1
- data/lib/devise_cas_authenticatable/routes.rb +2 -2
- data/lib/devise_cas_authenticatable/strategy.rb +1 -1
- data/lib/devise_cas_authenticatable.rb +16 -1
- data/spec/routes_spec.rb +3 -3
- data/spec/strategy_spec.rb +1 -1
- metadata +12 -110
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -14,15 +14,6 @@ GIT
|
|
14
14
|
sinatra (~> 1.0)
|
15
15
|
sqlite3 (~> 1.3.1)
|
16
16
|
|
17
|
-
PATH
|
18
|
-
remote: .
|
19
|
-
specs:
|
20
|
-
devise_cas_authenticatable (1.0.0.alpha7)
|
21
|
-
devise (>= 1.0.6)
|
22
|
-
devise
|
23
|
-
devise_cas_authenticatable
|
24
|
-
rubycas-client (>= 2.2.1)
|
25
|
-
|
26
17
|
GEM
|
27
18
|
remote: http://rubygems.org/
|
28
19
|
specs:
|
@@ -143,8 +134,6 @@ GEM
|
|
143
134
|
ruby-debug-base (0.10.4)
|
144
135
|
linecache (>= 0.3)
|
145
136
|
ruby-net-ldap (0.0.4)
|
146
|
-
rubycas-client (2.2.1)
|
147
|
-
activesupport
|
148
137
|
rubyzip (0.9.4)
|
149
138
|
selenium-webdriver (0.1.2)
|
150
139
|
childprocess (~> 0.1.5)
|
@@ -178,7 +167,6 @@ DEPENDENCIES
|
|
178
167
|
castronaut!
|
179
168
|
crypt-isaac
|
180
169
|
devise
|
181
|
-
devise_cas_authenticatable!
|
182
170
|
jeweler
|
183
171
|
launchy
|
184
172
|
mocha
|
data/Rakefile
CHANGED
@@ -34,7 +34,7 @@ begin
|
|
34
34
|
gemspec.add_runtime_dependency "devise", ">= 1.0.6"
|
35
35
|
gemspec.add_runtime_dependency "rubycas-client", ">= 2.2.1"
|
36
36
|
end
|
37
|
-
Jeweler::
|
37
|
+
Jeweler::RubygemsDotOrgTasks.new
|
38
38
|
rescue LoadError
|
39
39
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
40
40
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.alpha10
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{devise_cas_authenticatable}
|
8
|
-
s.version = "1.0.0.
|
8
|
+
s.version = "1.0.0.alpha10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nat Budin"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-06-08}
|
13
13
|
s.description = %q{CAS authentication module for Devise}
|
14
14
|
s.email = %q{natbudin@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -95,43 +95,22 @@ Gem::Specification.new do |s|
|
|
95
95
|
s.specification_version = 3
|
96
96
|
|
97
97
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
98
|
-
s.add_runtime_dependency(%q<devise_cas_authenticatable>, [">= 0"])
|
99
98
|
s.add_runtime_dependency(%q<devise>, [">= 0"])
|
100
99
|
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
101
100
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
102
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
103
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
104
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
105
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
106
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
107
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
108
101
|
s.add_runtime_dependency(%q<devise>, [">= 1.0.6"])
|
109
102
|
s.add_runtime_dependency(%q<rubycas-client>, [">= 2.2.1"])
|
110
103
|
else
|
111
|
-
s.add_dependency(%q<devise_cas_authenticatable>, [">= 0"])
|
112
104
|
s.add_dependency(%q<devise>, [">= 0"])
|
113
105
|
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
114
106
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
115
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
116
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
117
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
118
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
119
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
120
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
121
107
|
s.add_dependency(%q<devise>, [">= 1.0.6"])
|
122
108
|
s.add_dependency(%q<rubycas-client>, [">= 2.2.1"])
|
123
109
|
end
|
124
110
|
else
|
125
|
-
s.add_dependency(%q<devise_cas_authenticatable>, [">= 0"])
|
126
111
|
s.add_dependency(%q<devise>, [">= 0"])
|
127
112
|
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
128
113
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
129
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
130
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
131
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
132
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
133
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
134
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
135
114
|
s.add_dependency(%q<devise>, [">= 1.0.6"])
|
136
115
|
s.add_dependency(%q<rubycas-client>, [">= 2.2.1"])
|
137
116
|
end
|
@@ -19,7 +19,7 @@ module Devise
|
|
19
19
|
::Devise.cas_client.validate_service_ticket(ticket) unless ticket.has_been_validated?
|
20
20
|
|
21
21
|
if ticket.is_valid?
|
22
|
-
conditions = {
|
22
|
+
conditions = {::Devise.cas_username_column => ticket.response.user}
|
23
23
|
|
24
24
|
# We don't want to override Devise 1.1's find_for_authentication
|
25
25
|
resource = if respond_to?(:find_for_authentication)
|
@@ -6,7 +6,7 @@ if ActionController::Routing.name =~ /ActionDispatch/
|
|
6
6
|
|
7
7
|
def devise_cas_authenticatable(mapping, controllers)
|
8
8
|
# service endpoint for CAS server
|
9
|
-
get "
|
9
|
+
get "service", :to => "#{controllers[:cas_sessions]}#service", :as => "service"
|
10
10
|
|
11
11
|
resource :session, :only => [], :controller => controllers[:cas_sessions], :path => "" do
|
12
12
|
get :new, :path => mapping.path_names[:sign_in], :as => "new"
|
@@ -24,7 +24,7 @@ else
|
|
24
24
|
|
25
25
|
def cas_authenticatable(routes, mapping)
|
26
26
|
routes.with_options(:controller => 'devise/cas_sessions', :name_prefix => nil) do |session|
|
27
|
-
session.send(:"#{mapping.name}", '/', :action => 'service', :conditions => {:method => :get})
|
27
|
+
session.send(:"#{mapping.name}_service", '/', :action => 'service', :conditions => {:method => :get})
|
28
28
|
session.send(:"unregistered_#{mapping.name}_session", '/unregistered', :action => "unregistered", :conditions => {:method => :get})
|
29
29
|
session.send(:"new_#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'new', :conditions => {:method => :get})
|
30
30
|
session.send(:"#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'create', :conditions => {:method => :post})
|
@@ -19,7 +19,7 @@ module Devise
|
|
19
19
|
if resource = mapping.to.authenticate_with_cas_ticket(ticket)
|
20
20
|
success!(resource)
|
21
21
|
elsif ticket.is_valid?
|
22
|
-
redirect!(::Devise.
|
22
|
+
redirect!(::Devise.cas_unregistered_url(request.url, mapping), :username => ticket.response.user)
|
23
23
|
#fail!("The user #{ticket.response.user} is not registered with this site. Please use a different account.")
|
24
24
|
else
|
25
25
|
fail!(:invalid)
|
@@ -35,11 +35,15 @@ module Devise
|
|
35
35
|
# Should devise_cas_authenticatable attempt to create new user records for
|
36
36
|
# unknown usernames? True by default.
|
37
37
|
@@cas_create_user = true
|
38
|
+
|
39
|
+
# The model attribute used for query conditions. Should be the same as
|
40
|
+
# the rubycas-server username_column. :username by default
|
41
|
+
@@cas_username_column = :username
|
38
42
|
|
39
43
|
# Name of the parameter passed in the logout query
|
40
44
|
@@cas_destination_logout_param_name = nil
|
41
45
|
|
42
|
-
mattr_accessor :cas_base_url, :cas_login_url, :cas_logout_url, :cas_validate_url, :cas_create_user, :cas_destination_logout_param_name
|
46
|
+
mattr_accessor :cas_base_url, :cas_login_url, :cas_logout_url, :cas_validate_url, :cas_create_user, :cas_destination_logout_param_name, :cas_username_column
|
43
47
|
|
44
48
|
def self.cas_create_user?
|
45
49
|
cas_create_user
|
@@ -57,6 +61,15 @@ module Devise
|
|
57
61
|
end
|
58
62
|
|
59
63
|
def self.cas_service_url(base_url, mapping)
|
64
|
+
cas_action_url(base_url, mapping, "service")
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.cas_unregistered_url(base_url, mapping)
|
68
|
+
cas_action_url(base_url, mapping, "unregistered")
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
def self.cas_action_url(base_url, mapping, action)
|
60
73
|
u = URI.parse(base_url)
|
61
74
|
u.query = nil
|
62
75
|
u.path = if mapping.respond_to?(:fullpath)
|
@@ -64,6 +77,8 @@ module Devise
|
|
64
77
|
else
|
65
78
|
mapping.raw_path
|
66
79
|
end
|
80
|
+
u.path << "/"
|
81
|
+
u.path << action
|
67
82
|
u.to_s
|
68
83
|
end
|
69
84
|
end
|
data/spec/routes_spec.rb
CHANGED
@@ -3,15 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe Devise::CasSessionsController do
|
4
4
|
include RSpec::Rails::ControllerExampleGroup
|
5
5
|
|
6
|
-
it { should route(:get, "/users").to(:action => "service") }
|
6
|
+
it { should route(:get, "/users/service").to(:action => "service") }
|
7
7
|
it { should route(:get, "/users/sign_in").to(:action => "new") }
|
8
8
|
it { should route(:post, "/users/sign_in").to(:action => "create") }
|
9
9
|
it { should route(:get, "/users/sign_out").to(:action => "destroy") }
|
10
10
|
it { should route(:get, "/users/unregistered").to(:action => "unregistered") }
|
11
11
|
|
12
12
|
it "should have the right route names" do
|
13
|
-
controller.should respond_to("
|
14
|
-
controller.
|
13
|
+
controller.should respond_to("user_service_path", "new_user_session_path", "user_session_path", "destroy_user_session_path")
|
14
|
+
controller.user_service_path.should == "/users/service"
|
15
15
|
controller.new_user_session_path.should == "/users/sign_in"
|
16
16
|
controller.user_session_path.should == "/users/sign_in"
|
17
17
|
controller.destroy_user_session_path.should == "/users/sign_out"
|
data/spec/strategy_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
20
20
|
def cas_login_url
|
21
21
|
@cas_login_url ||= begin
|
22
22
|
uri = URI.parse(Devise.cas_base_url + "/login")
|
23
|
-
uri.query = Rack::Utils.build_nested_query(:service =>
|
23
|
+
uri.query = Rack::Utils.build_nested_query(:service => user_service_url)
|
24
24
|
uri.to_s
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_cas_authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -3702664344
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- alpha
|
11
|
-
-
|
12
|
-
version: 1.0.0.
|
11
|
+
- 10
|
12
|
+
version: 1.0.0.alpha10
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Nat Budin
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-
|
20
|
+
date: 2011-06-08 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -31,11 +31,11 @@ dependencies:
|
|
31
31
|
segments:
|
32
32
|
- 0
|
33
33
|
version: "0"
|
34
|
-
name:
|
34
|
+
name: devise
|
35
35
|
version_requirements: *id001
|
36
36
|
prerelease: false
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
type: :
|
38
|
+
type: :development
|
39
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
segments:
|
46
46
|
- 0
|
47
47
|
version: "0"
|
48
|
-
name:
|
48
|
+
name: ruby-debug
|
49
49
|
version_requirements: *id002
|
50
50
|
prerelease: false
|
51
51
|
- !ruby/object:Gem::Dependency
|
@@ -59,110 +59,12 @@ dependencies:
|
|
59
59
|
segments:
|
60
60
|
- 0
|
61
61
|
version: "0"
|
62
|
-
name: ruby-debug
|
63
|
-
version_requirements: *id003
|
64
|
-
prerelease: false
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
type: :development
|
67
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
|
-
requirements:
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
|
-
name: jeweler
|
77
|
-
version_requirements: *id004
|
78
|
-
prerelease: false
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
type: :development
|
81
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
|
-
requirements:
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
hash: 3
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
90
|
-
name: ruby-debug
|
91
|
-
version_requirements: *id005
|
92
|
-
prerelease: false
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
type: :development
|
95
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
|
-
requirements:
|
98
|
-
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
hash: 3
|
101
|
-
segments:
|
102
|
-
- 0
|
103
|
-
version: "0"
|
104
62
|
name: jeweler
|
105
|
-
version_requirements: *
|
106
|
-
prerelease: false
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
|
-
type: :development
|
109
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
|
-
requirements:
|
112
|
-
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
hash: 3
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
118
|
-
name: ruby-debug
|
119
|
-
version_requirements: *id007
|
120
|
-
prerelease: false
|
121
|
-
- !ruby/object:Gem::Dependency
|
122
|
-
type: :development
|
123
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
|
-
requirements:
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
hash: 3
|
129
|
-
segments:
|
130
|
-
- 0
|
131
|
-
version: "0"
|
132
|
-
name: jeweler
|
133
|
-
version_requirements: *id008
|
134
|
-
prerelease: false
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
-
type: :development
|
137
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
|
-
requirements:
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
hash: 3
|
143
|
-
segments:
|
144
|
-
- 0
|
145
|
-
version: "0"
|
146
|
-
name: ruby-debug
|
147
|
-
version_requirements: *id009
|
148
|
-
prerelease: false
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
type: :development
|
151
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
152
|
-
none: false
|
153
|
-
requirements:
|
154
|
-
- - ">="
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
hash: 3
|
157
|
-
segments:
|
158
|
-
- 0
|
159
|
-
version: "0"
|
160
|
-
name: jeweler
|
161
|
-
version_requirements: *id010
|
63
|
+
version_requirements: *id003
|
162
64
|
prerelease: false
|
163
65
|
- !ruby/object:Gem::Dependency
|
164
66
|
type: :runtime
|
165
|
-
requirement: &
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
166
68
|
none: false
|
167
69
|
requirements:
|
168
70
|
- - ">="
|
@@ -174,11 +76,11 @@ dependencies:
|
|
174
76
|
- 6
|
175
77
|
version: 1.0.6
|
176
78
|
name: devise
|
177
|
-
version_requirements: *
|
79
|
+
version_requirements: *id004
|
178
80
|
prerelease: false
|
179
81
|
- !ruby/object:Gem::Dependency
|
180
82
|
type: :runtime
|
181
|
-
requirement: &
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
182
84
|
none: false
|
183
85
|
requirements:
|
184
86
|
- - ">="
|
@@ -190,7 +92,7 @@ dependencies:
|
|
190
92
|
- 1
|
191
93
|
version: 2.2.1
|
192
94
|
name: rubycas-client
|
193
|
-
version_requirements: *
|
95
|
+
version_requirements: *id005
|
194
96
|
prerelease: false
|
195
97
|
description: CAS authentication module for Devise
|
196
98
|
email: natbudin@gmail.com
|