devise_cas_authenticatable 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ spec/scenario/db/*.sqlite3
6
6
  spec/scenario/tmp/*
7
7
  log/*
8
8
  db/*
9
+ Gemfile.*lock
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog for devise\_cas\_authenticatable
2
2
 
3
+ ## Version 1.1.4 - January 23, 2013
4
+
5
+ * Bug fix: don't modify request.protocol when generating a logout_url (thanks [Tse-Ching Ho](https://github.com/tsechingho)!)
6
+
7
+ ## Version 1.1.3 - January 15, 2013
8
+
9
+ * Rails 4 compatibility fixes (thanks [Aaron Patterson](https://github.com/tenderlove)!)
10
+ * Support the service_url parameter in rubycas-client on logout (thanks [Kyle Ginavan](https://github.com/kylejginavan)!)
11
+
3
12
  ## Version 1.1.2 - May 23, 2012
4
13
 
5
14
  * Only do schema stuff if using Devise 2.0.x or below
data/Gemfile CHANGED
@@ -3,6 +3,9 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in devise_cas_authenticatable.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'rails', '~> 3.2.0'
7
+ gem 'devise', '~> 2.1.0'
8
+
6
9
  group :test do
7
10
  gem 'castronaut', :git => 'https://github.com/nbudin/castronaut.git', :branch => 'dam5s-merge'
8
11
  end
@@ -1,28 +1,25 @@
1
- class Devise::CasSessionsController < Devise::SessionsController
1
+ class Devise::CasSessionsController < Devise::SessionsController
2
2
  unloadable
3
-
3
+
4
4
  def new
5
5
  unless returning_from_cas?
6
6
  redirect_to(cas_login_url)
7
7
  end
8
8
  end
9
-
9
+
10
10
  def service
11
11
  redirect_to after_sign_in_path_for(warden.authenticate!(:scope => resource_name))
12
12
  end
13
-
13
+
14
14
  def unregistered
15
15
  end
16
-
16
+
17
17
  def destroy
18
- follow_url = nil
19
- destination_url = nil
20
-
21
18
  # Delete the ticket->session ID mapping if one exists for this session
22
19
  if ticket = session['cas_last_valid_ticket']
23
20
  ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.delete_session_index(ticket)
24
21
  end
25
-
22
+
26
23
  # if :cas_create_user is false a CAS session might be open but not signed_in
27
24
  # in such case we destroy the session here
28
25
  if signed_in?(resource_name)
@@ -31,39 +28,6 @@ class Devise::CasSessionsController < Devise::SessionsController
31
28
  reset_session
32
29
  end
33
30
 
34
- if ::Devise.cas_logout_url_param == 'destination'
35
- if !::Devise.cas_destination_url.blank?
36
- destination_url = Devise.cas_destination_url
37
- else
38
- destination_url = request.protocol
39
- destination_url << request.host
40
- destination_url << ":#{request.port.to_s}" unless request.port == 80
41
- destination_url << after_sign_out_path_for(resource_name)
42
- end
43
- end
44
-
45
- if ::Devise.cas_logout_url_param == 'follow'
46
- if !::Devise.cas_follow_url.blank?
47
- follow_url = Devise.cas_follow_url
48
- else
49
- follow_url = request.protocol
50
- follow_url << request.host
51
- follow_url << ":#{request.port.to_s}" unless request.port == 80
52
- follow_url << after_sign_out_path_for(resource_name)
53
- end
54
- end
55
-
56
- service_url = request.protocol
57
- service_url << request.host
58
- service_url << ":#{request.port.to_s}" unless request.port == 80
59
-
60
- logout_url = begin
61
- ::Devise.cas_client.logout_url(destination_url, follow_url, ::Devise.cas_service_url(service_url, devise_mapping))
62
- rescue ArgumentError
63
- # Older rubycas-clients don't accept a service_url
64
- ::Devise.cas_client.logout_url(destination_url, follow_url)
65
- end
66
-
67
31
  redirect_to(logout_url)
68
32
  end
69
33
 
@@ -112,7 +76,7 @@ class Devise::CasSessionsController < Devise::SessionsController
112
76
 
113
77
  ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.delete_session_index(session_index)
114
78
  end
115
-
79
+
116
80
  def session_store
117
81
  @session_store ||= (Rails.respond_to?(:application) && Rails.application.config.session_store)
118
82
  end
@@ -125,4 +89,45 @@ class Devise::CasSessionsController < Devise::SessionsController
125
89
  ::Devise.cas_client.add_service_to_login_url(::Devise.cas_service_url(request.url, devise_mapping))
126
90
  end
127
91
  helper_method :cas_login_url
92
+
93
+ def request_url
94
+ return @request_url if @request_url
95
+ @request_url = request.protocol.dup
96
+ @request_url << request.host
97
+ @request_url << ":#{request.port.to_s}" unless request.port == 80
98
+ @request_url
99
+ end
100
+
101
+ def destination_url
102
+ return unless ::Devise.cas_logout_url_param == 'destination'
103
+ if !::Devise.cas_destination_url.blank?
104
+ url = Devise.cas_destination_url
105
+ else
106
+ url = request_url.dup
107
+ url << after_sign_out_path_for(resource_name)
108
+ end
109
+ end
110
+
111
+ def follow_url
112
+ return unless ::Devise.cas_logout_url_param == 'follow'
113
+ if !::Devise.cas_follow_url.blank?
114
+ url = Devise.cas_follow_url
115
+ else
116
+ url = request_url.dup
117
+ url << after_sign_out_path_for(resource_name)
118
+ end
119
+ end
120
+
121
+ def service_url
122
+ ::Devise.cas_service_url(request_url.dup, devise_mapping)
123
+ end
124
+
125
+ def logout_url
126
+ begin
127
+ ::Devise.cas_client.logout_url(destination_url, follow_url, service_url)
128
+ rescue ArgumentError
129
+ # Older rubycas-clients don't accept a service_url
130
+ ::Devise.cas_client.logout_url(destination_url, follow_url)
131
+ end
132
+ end
128
133
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{devise_cas_authenticatable}
5
- s.version = "1.1.3"
5
+ s.version = "1.1.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Nat Budin", "Jeremy Haile"]
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  # This file is auto-generated from the current state of the database. Instead
2
3
  # of editing this file, please use the migrations feature of Active Record to
3
4
  # incrementally modify your database, and then regenerate this schema definition.
@@ -10,16 +11,27 @@
10
11
  #
11
12
  # It's strongly recommended to check this file into your version control system.
12
13
 
13
- ActiveRecord::Schema.define(:version => 20111002012903) do
14
+ ActiveRecord::Schema.define(:version => 20121009092400) do
14
15
 
15
16
  create_table "sessions", :force => true do |t|
16
17
  t.string "session_id", :null => false
17
18
  t.text "data"
18
- t.datetime "created_at"
19
- t.datetime "updated_at"
19
+ t.datetime "created_at", :null => false
20
+ t.datetime "updated_at", :null => false
20
21
  end
21
22
 
22
23
  add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
23
24
  add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
24
25
 
26
+ create_table "users", :force => true do |t|
27
+ t.string "username", :null => false
28
+ t.datetime "remember_created_at"
29
+ t.string "email"
30
+ t.datetime "created_at", :null => false
31
+ t.datetime "updated_at", :null => false
32
+ t.boolean "deactivated"
33
+ end
34
+
35
+ add_index "users", ["username"], :name => "index_users_on_username", :unique => true
36
+
25
37
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
4
4
  include RSpec::Rails::RequestExampleGroup
5
+ include Capybara::DSL
5
6
 
6
7
  before do
7
8
  Devise.cas_base_url = "http://www.example.com/cas_server"
@@ -123,11 +124,10 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
123
124
  User.find_by_username("newuser").should be_nil
124
125
 
125
126
  click_on "sign in using a different account"
126
- click_on "here"
127
127
  current_url.should == cas_login_url
128
128
  fill_in "Username", :with => "joeuser"
129
129
  fill_in "Password", :with => "joepassword"
130
130
  click_on "Login"
131
131
  current_url.should == root_url
132
132
  end
133
- end
133
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_cas_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-15 00:00:00.000000000 Z
13
+ date: 2013-01-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: devise
@@ -224,7 +224,6 @@ files:
224
224
  - Gemfile.devise15
225
225
  - Gemfile.devise20
226
226
  - Gemfile.devise21
227
- - Gemfile.lock
228
227
  - LICENSE
229
228
  - README.md
230
229
  - Rakefile
@@ -294,7 +293,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
293
  version: '0'
295
294
  segments:
296
295
  - 0
297
- hash: -757729412372819420
296
+ hash: -1377956398748229167
298
297
  required_rubygems_version: !ruby/object:Gem::Requirement
299
298
  none: false
300
299
  requirements:
data/Gemfile.lock DELETED
@@ -1,194 +0,0 @@
1
- GIT
2
- remote: https://github.com/nbudin/castronaut.git
3
- revision: 241723963154550c415112f7568c33a4cd9e6021
4
- branch: dam5s-merge
5
- specs:
6
- castronaut (0.7.5)
7
- activerecord (>= 2.0)
8
- activesupport (>= 2.0)
9
- builder (>= 2.0.0)
10
- crypt-isaac (~> 0.9)
11
- json (>= 1.5.1)
12
- sinatra (>= 1.0)
13
-
14
- PATH
15
- remote: .
16
- specs:
17
- devise_cas_authenticatable (1.1.3)
18
- devise (>= 1.0.6)
19
- rubycas-client (>= 2.2.1)
20
-
21
- GEM
22
- remote: http://rubygems.org/
23
- specs:
24
- actionmailer (3.1.2)
25
- actionpack (= 3.1.2)
26
- mail (~> 2.3.0)
27
- actionpack (3.1.2)
28
- activemodel (= 3.1.2)
29
- activesupport (= 3.1.2)
30
- builder (~> 3.0.0)
31
- erubis (~> 2.7.0)
32
- i18n (~> 0.6)
33
- rack (~> 1.3.5)
34
- rack-cache (~> 1.1)
35
- rack-mount (~> 0.8.2)
36
- rack-test (~> 0.6.1)
37
- sprockets (~> 2.1.0)
38
- activemodel (3.1.2)
39
- activesupport (= 3.1.2)
40
- builder (~> 3.0.0)
41
- i18n (~> 0.6)
42
- activerecord (3.1.2)
43
- activemodel (= 3.1.2)
44
- activesupport (= 3.1.2)
45
- arel (~> 2.2.1)
46
- tzinfo (~> 0.3.29)
47
- activeresource (3.1.2)
48
- activemodel (= 3.1.2)
49
- activesupport (= 3.1.2)
50
- activesupport (3.1.2)
51
- multi_json (~> 1.0)
52
- addressable (2.2.6)
53
- arel (2.2.1)
54
- bcrypt-ruby (3.0.1)
55
- builder (3.0.0)
56
- capybara (1.1.2)
57
- mime-types (>= 1.16)
58
- nokogiri (>= 1.3.3)
59
- rack (>= 1.0.0)
60
- rack-test (>= 0.5.4)
61
- selenium-webdriver (~> 2.0)
62
- xpath (~> 0.1.4)
63
- childprocess (0.2.2)
64
- ffi (~> 1.0.6)
65
- coderay (0.9.8)
66
- crypt-isaac (0.9.1)
67
- devise (2.1.2)
68
- bcrypt-ruby (~> 3.0)
69
- orm_adapter (~> 0.1)
70
- railties (~> 3.1)
71
- warden (~> 1.2.1)
72
- diff-lcs (1.1.3)
73
- erubis (2.7.0)
74
- ffi (1.0.11)
75
- hike (1.2.1)
76
- i18n (0.6.0)
77
- json (1.7.3)
78
- json_pure (1.6.1)
79
- launchy (2.0.5)
80
- addressable (~> 2.2.6)
81
- mail (2.3.0)
82
- i18n (>= 0.4.0)
83
- mime-types (~> 1.16)
84
- treetop (~> 1.4.8)
85
- metaclass (0.0.1)
86
- method_source (0.6.7)
87
- ruby_parser (>= 2.3.1)
88
- mime-types (1.17.2)
89
- mocha (0.10.0)
90
- metaclass (~> 0.0.1)
91
- multi_json (1.3.5)
92
- nokogiri (1.5.0)
93
- orm_adapter (0.4.0)
94
- polyglot (0.3.3)
95
- pry (0.9.7.3)
96
- coderay (~> 0.9.8)
97
- method_source (~> 0.6.7)
98
- ruby_parser (>= 2.3.1)
99
- slop (~> 2.1.0)
100
- rack (1.3.6)
101
- rack-cache (1.2)
102
- rack (>= 0.4)
103
- rack-mount (0.8.3)
104
- rack (>= 1.0.0)
105
- rack-protection (1.2.0)
106
- rack
107
- rack-ssl (1.3.2)
108
- rack
109
- rack-test (0.6.1)
110
- rack (>= 1.0)
111
- rails (3.1.2)
112
- actionmailer (= 3.1.2)
113
- actionpack (= 3.1.2)
114
- activerecord (= 3.1.2)
115
- activeresource (= 3.1.2)
116
- activesupport (= 3.1.2)
117
- bundler (~> 1.0)
118
- railties (= 3.1.2)
119
- railties (3.1.2)
120
- actionpack (= 3.1.2)
121
- activesupport (= 3.1.2)
122
- rack-ssl (~> 1.3.2)
123
- rake (>= 0.8.7)
124
- rdoc (~> 3.4)
125
- thor (~> 0.14.6)
126
- rake (0.9.2.2)
127
- rdoc (3.12)
128
- json (~> 1.4)
129
- rspec (2.7.0)
130
- rspec-core (~> 2.7.0)
131
- rspec-expectations (~> 2.7.0)
132
- rspec-mocks (~> 2.7.0)
133
- rspec-core (2.7.1)
134
- rspec-expectations (2.7.0)
135
- diff-lcs (~> 1.1.2)
136
- rspec-mocks (2.7.0)
137
- rspec-rails (2.7.0)
138
- actionpack (~> 3.0)
139
- activesupport (~> 3.0)
140
- railties (~> 3.0)
141
- rspec (~> 2.7.0)
142
- ruby_parser (2.3.1)
143
- sexp_processor (~> 3.0)
144
- rubycas-client (2.3.9)
145
- activesupport
146
- rubyzip (0.9.4)
147
- selenium-webdriver (2.13.0)
148
- childprocess (>= 0.2.1)
149
- ffi (~> 1.0.9)
150
- json_pure
151
- rubyzip
152
- sexp_processor (3.0.7)
153
- sham_rack (1.3.3)
154
- rack
155
- shoulda (2.11.3)
156
- sinatra (1.3.2)
157
- rack (~> 1.3, >= 1.3.6)
158
- rack-protection (~> 1.2)
159
- tilt (~> 1.3, >= 1.3.3)
160
- slop (2.1.0)
161
- sprockets (2.1.3)
162
- hike (~> 1.2)
163
- rack (~> 1.0)
164
- tilt (~> 1.1, != 1.3.0)
165
- sqlite3 (1.3.4)
166
- sqlite3-ruby (1.3.3)
167
- sqlite3 (>= 1.3.3)
168
- thor (0.14.6)
169
- tilt (1.3.3)
170
- treetop (1.4.10)
171
- polyglot
172
- polyglot (>= 0.3.1)
173
- tzinfo (0.3.31)
174
- warden (1.2.1)
175
- rack (>= 1.0)
176
- xpath (0.1.4)
177
- nokogiri (~> 1.3)
178
-
179
- PLATFORMS
180
- ruby
181
-
182
- DEPENDENCIES
183
- capybara
184
- castronaut!
185
- crypt-isaac
186
- devise_cas_authenticatable!
187
- launchy
188
- mocha
189
- pry
190
- rails (>= 3.0.7)
191
- rspec-rails
192
- sham_rack
193
- shoulda
194
- sqlite3-ruby