devise_cas_authenticatable 1.8.0 → 1.9.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/devise_cas_authenticatable.gemspec +1 -1
- data/lib/devise_cas_authenticatable/memcache_checker.rb +11 -3
- data/spec/memcache_checker_spec.rb +1 -1
- data/spec/strategy_spec.rb +19 -19
- metadata +3 -3
- data/Gemfile +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e218be1e32158092b12200997cd9766d7bd44dc9
|
4
|
+
data.tar.gz: 06134730c16d3512594ee8d7958f0d8af8e9ad95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72cbc90c0c374573af01d0021a5ba0be3aa612fcb4493da084c56d8bb6c0469ef65d4ffb2055a508081bcd2f8086c8461f6662a935f68f1f36e47b36068eca4e
|
7
|
+
data.tar.gz: 3419752f94b6f9e5d44f3b51ded704c0da466c619109b267c76d9c527a2a7736ef9885829e9308f520884833870d45b7c8cadfe321145dafd3ef32c68698f7e8
|
data/CHANGELOG.md
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.devise21
|
@@ -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.
|
5
|
+
s.version = "1.9.0"
|
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,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'socket'
|
2
|
+
require 'timeout'
|
2
3
|
|
3
4
|
module DeviseCasAuthenticatable
|
4
5
|
class MemcacheChecker
|
@@ -17,14 +18,21 @@ module DeviseCasAuthenticatable
|
|
17
18
|
memcache_servers.each do |server|
|
18
19
|
host, port = server.split(":")
|
19
20
|
begin
|
20
|
-
|
21
|
+
try_connect host, port
|
22
|
+
|
21
23
|
return true
|
22
|
-
rescue Errno::ECONNREFUSED
|
24
|
+
rescue Errno::ECONNREFUSED, Timeout::Error
|
23
25
|
return false
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
30
|
+
def try_connect(host, port)
|
31
|
+
Timeout::timeout(1) do
|
32
|
+
TCPSocket.open(host, port)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
28
36
|
private
|
29
37
|
|
30
38
|
def session_store_class
|
@@ -37,7 +37,7 @@ describe DeviseCasAuthenticatable::MemcacheChecker do
|
|
37
37
|
subject(:alive?) { described_class.new(conf_double).alive? }
|
38
38
|
|
39
39
|
before do
|
40
|
-
|
40
|
+
DeviseCasAuthenticatable::MemcacheChecker.any_instance.stubs(:try_connect)
|
41
41
|
end
|
42
42
|
|
43
43
|
it { expect(alive?).to eq true }
|
data/spec/strategy_spec.rb
CHANGED
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
4
4
|
include RSpec::Rails::RequestExampleGroup
|
5
5
|
include Capybara::DSL
|
6
|
-
|
7
|
-
before do
|
6
|
+
|
7
|
+
before do
|
8
8
|
Devise.cas_base_url = "http://www.example.com/cas_server"
|
9
9
|
TestAdapter.reset_valid_users!
|
10
10
|
|
@@ -13,11 +13,11 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
13
13
|
u.username = "joeuser"
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
after do
|
18
18
|
visit destroy_user_session_url
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def cas_login_url
|
22
22
|
@cas_login_url ||= begin
|
23
23
|
uri = URI.parse(Devise.cas_base_url + "/login")
|
@@ -25,11 +25,11 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
25
25
|
uri.to_s
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def cas_logout_url
|
30
30
|
@cas_logout_url ||= Devise.cas_base_url + "/logout?service"
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def sign_into_cas(username, password)
|
34
34
|
visit root_url
|
35
35
|
current_url.should == cas_login_url
|
@@ -37,7 +37,7 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
37
37
|
fill_in "Password", :with => password
|
38
38
|
click_on "Login"
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
describe "GET /protected/resource" do
|
42
42
|
before { get '/' }
|
43
43
|
|
@@ -46,28 +46,28 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
46
46
|
response.should redirect_to(new_user_session_url)
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
describe "GET /users/sign_in" do
|
51
51
|
before { get new_user_session_url }
|
52
|
-
|
52
|
+
|
53
53
|
it 'should redirect to CAS server' do
|
54
54
|
response.should be_redirect
|
55
55
|
response.should redirect_to(cas_login_url)
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it "should sign in with valid user" do
|
60
60
|
sign_into_cas "joeuser", "joepassword"
|
61
61
|
current_url.should == root_url
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
it "should fail to sign in with an invalid user" do
|
65
65
|
sign_into_cas "invaliduser", "invalidpassword"
|
66
66
|
current_url.should_not == root_url
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "with a deactivated user" do
|
70
|
-
before do
|
70
|
+
before do
|
71
71
|
@user = User.first
|
72
72
|
@user.deactivated = true
|
73
73
|
@user.save!
|
@@ -78,13 +78,13 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
78
78
|
current_url.should == cas_logout_url
|
79
79
|
end
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
it "should register new CAS users if set up to do so" do
|
83
83
|
User.count.should == 1
|
84
84
|
TestAdapter.register_valid_user("newuser", "newpassword")
|
85
85
|
Devise.cas_create_user = true
|
86
86
|
sign_into_cas "newuser", "newpassword"
|
87
|
-
|
87
|
+
|
88
88
|
current_url.should == root_url
|
89
89
|
User.count.should == 2
|
90
90
|
User.find_by_username("newuser").should_not be_nil
|
@@ -102,7 +102,7 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
102
102
|
TestAdapter.register_valid_user("newuser", "newpassword")
|
103
103
|
Devise.cas_create_user = false
|
104
104
|
sign_into_cas "newuser", "newpassword"
|
105
|
-
|
105
|
+
|
106
106
|
current_url.should == root_url
|
107
107
|
User.count.should == 2
|
108
108
|
User.find_by_username("newuser").should_not be_nil
|
@@ -112,13 +112,13 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
it "should fail CAS login if user is unregistered and cas_create_user is false" do
|
117
117
|
User.count.should == 1
|
118
118
|
TestAdapter.register_valid_user("newuser", "newpassword")
|
119
119
|
Devise.cas_create_user = false
|
120
120
|
sign_into_cas "newuser", "newpassword"
|
121
|
-
|
121
|
+
|
122
122
|
current_url.should_not == root_url
|
123
123
|
User.count.should == 1
|
124
124
|
User.find_by_username("newuser").should be_nil
|
@@ -129,12 +129,12 @@ describe Devise::Strategies::CasAuthenticatable, :type => "acceptance" do
|
|
129
129
|
click_on "Login"
|
130
130
|
current_url.should == root_url
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
it "should work correctly with Devise trackable" do
|
134
134
|
user = User.first
|
135
135
|
user.update_attributes!(:last_sign_in_at => 1.day.ago, :last_sign_in_ip => "1.2.3.4", :sign_in_count => 41)
|
136
136
|
sign_into_cas "joeuser", "joepassword"
|
137
|
-
|
137
|
+
|
138
138
|
user.reload
|
139
139
|
user.last_sign_in_at.should >= 1.hour.ago
|
140
140
|
user.sign_in_count.should == 42
|
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.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Budin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
@@ -310,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
310
|
version: 1.3.1
|
311
311
|
requirements: []
|
312
312
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.4
|
313
|
+
rubygems_version: 2.6.4
|
314
314
|
signing_key:
|
315
315
|
specification_version: 4
|
316
316
|
summary: CAS authentication module for Devise
|
data/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in devise_cas_authenticatable.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem 'rails', '~> 3.2.0'
|
7
|
-
gem 'devise', '~> 2.1.0'
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'castronaut', :git => 'https://github.com/nbudin/castronaut.git', :branch => 'dam5s-merge'
|
11
|
-
gem 'minitest'
|
12
|
-
gem 'test-unit'
|
13
|
-
end
|