casino-ldap_authenticator 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -42,7 +42,7 @@ class CASino::LDAPAuthenticator
|
|
42
42
|
@ldap.auth(@options[:admin_user], @options[:admin_password])
|
43
43
|
end
|
44
44
|
@user_plain = @ldap.bind_as(:base => @options[:base], :size => 1, :password => @password, :filter => user_filter)
|
45
|
-
if @user_plain
|
45
|
+
if @user_plain
|
46
46
|
include_attributes = @options[:extra_attributes].values + [username_attribute]
|
47
47
|
@user_plain = @ldap.search(:base => @options[:base], :filter => user_filter, :attributes => include_attributes)
|
48
48
|
if @user_plain.is_a?(Array)
|
@@ -43,9 +43,26 @@ describe CASino::LDAPAuthenticator do
|
|
43
43
|
subject.validate(username, password)
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
context 'when validation succeeds' do
|
47
|
+
before(:each) do
|
48
|
+
connection.stub(:bind_as).and_return(Net::LDAP::Entry.new)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'calls the #search method on the LDAP connection' do
|
52
|
+
connection.should_receive(:search).with(:base => options[:base], :filter => user_filter, :attributes => extra_attributes + [options[:username_attribute]])
|
53
|
+
subject.validate(username, password)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when validation fails' do
|
58
|
+
before(:each) do
|
59
|
+
connection.stub(:bind_as).and_return(false)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'does not call the #search method on the LDAP connection' do
|
63
|
+
connection.should_not_receive(:search)
|
64
|
+
subject.validate(username, password)
|
65
|
+
end
|
49
66
|
end
|
50
67
|
|
51
68
|
context 'when validation succeeds for user with missing data' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casino-ldap_authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|