devise_ldap_authenticatable 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -4
- data/Gemfile.lock +62 -8
- data/README.md +3 -10
- data/lib/devise_ldap_authenticatable/ldap_adapter.rb +83 -46
- data/lib/devise_ldap_authenticatable/model.rb +6 -0
- data/lib/devise_ldap_authenticatable/version.rb +1 -1
- data/test/rails_app/config/ldap_with_check_membership_off.yml +23 -0
- data/test/rails_app/config/ldap_with_check_membership_on.yml +23 -0
- data/test/rails_app/test/unit/user_test.rb +46 -11
- metadata +99 -8
data/Gemfile
CHANGED
@@ -5,8 +5,7 @@ gemspec
|
|
5
5
|
gem 'devise', '~> 2.0.0'
|
6
6
|
gem 'net-ldap', '~> 0.2.2'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
8
|
+
group :test do
|
9
|
+
gem 'ruby-debug', '>= 0.10.3', :platform => :mri_18
|
10
|
+
gem 'debugger', :platform => :ruby_19
|
12
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,92 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
devise_ldap_authenticatable (0.
|
5
|
-
devise (
|
4
|
+
devise_ldap_authenticatable (0.6.0)
|
5
|
+
devise (>= 2.0.0)
|
6
6
|
net-ldap (~> 0.2.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
+
actionpack (3.2.6)
|
12
|
+
activemodel (= 3.2.6)
|
13
|
+
activesupport (= 3.2.6)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
erubis (~> 2.7.0)
|
16
|
+
journey (~> 1.0.1)
|
17
|
+
rack (~> 1.4.0)
|
18
|
+
rack-cache (~> 1.2)
|
19
|
+
rack-test (~> 0.6.1)
|
20
|
+
sprockets (~> 2.1.3)
|
21
|
+
activemodel (3.2.6)
|
22
|
+
activesupport (= 3.2.6)
|
23
|
+
builder (~> 3.0.0)
|
24
|
+
activesupport (3.2.6)
|
25
|
+
i18n (~> 0.6)
|
26
|
+
multi_json (~> 1.0)
|
11
27
|
bcrypt-ruby (3.0.1)
|
28
|
+
builder (3.0.0)
|
12
29
|
columnize (0.3.6)
|
13
|
-
|
30
|
+
debugger (1.1.4)
|
31
|
+
columnize (>= 0.3.1)
|
32
|
+
debugger-linecache (~> 1.1.1)
|
33
|
+
debugger-ruby_core_source (~> 1.1.3)
|
34
|
+
debugger-linecache (1.1.1)
|
35
|
+
debugger-ruby_core_source (>= 1.1.1)
|
36
|
+
debugger-ruby_core_source (1.1.3)
|
37
|
+
devise (2.0.4)
|
14
38
|
bcrypt-ruby (~> 3.0)
|
15
39
|
orm_adapter (~> 0.0.3)
|
16
|
-
|
40
|
+
railties (~> 3.1)
|
41
|
+
warden (~> 1.1.1)
|
42
|
+
erubis (2.7.0)
|
43
|
+
hike (1.2.1)
|
44
|
+
i18n (0.6.0)
|
45
|
+
journey (1.0.4)
|
46
|
+
json (1.7.3)
|
17
47
|
linecache (0.46)
|
18
48
|
rbx-require-relative (> 0.0.4)
|
49
|
+
multi_json (1.3.6)
|
19
50
|
net-ldap (0.2.2)
|
20
|
-
orm_adapter (0.0.
|
21
|
-
rack (1.4.
|
51
|
+
orm_adapter (0.0.7)
|
52
|
+
rack (1.4.1)
|
53
|
+
rack-cache (1.2)
|
54
|
+
rack (>= 0.4)
|
55
|
+
rack-ssl (1.3.2)
|
56
|
+
rack
|
57
|
+
rack-test (0.6.1)
|
58
|
+
rack (>= 1.0)
|
59
|
+
railties (3.2.6)
|
60
|
+
actionpack (= 3.2.6)
|
61
|
+
activesupport (= 3.2.6)
|
62
|
+
rack-ssl (~> 1.3.2)
|
63
|
+
rake (>= 0.8.7)
|
64
|
+
rdoc (~> 3.4)
|
65
|
+
thor (>= 0.14.6, < 2.0)
|
66
|
+
rake (0.9.2.2)
|
22
67
|
rbx-require-relative (0.0.5)
|
68
|
+
rdoc (3.12)
|
69
|
+
json (~> 1.4)
|
23
70
|
ruby-debug (0.10.4)
|
24
71
|
columnize (>= 0.1)
|
25
72
|
ruby-debug-base (~> 0.10.4.0)
|
26
73
|
ruby-debug-base (0.10.4)
|
27
74
|
linecache (>= 0.3)
|
28
|
-
|
75
|
+
sprockets (2.1.3)
|
76
|
+
hike (~> 1.2)
|
77
|
+
rack (~> 1.0)
|
78
|
+
tilt (~> 1.1, != 1.3.0)
|
79
|
+
thor (0.15.3)
|
80
|
+
tilt (1.3.3)
|
81
|
+
warden (1.1.1)
|
29
82
|
rack (>= 1.0)
|
30
83
|
|
31
84
|
PLATFORMS
|
32
85
|
ruby
|
33
86
|
|
34
87
|
DEPENDENCIES
|
35
|
-
|
88
|
+
debugger
|
89
|
+
devise (~> 2.0.0)
|
36
90
|
devise_ldap_authenticatable!
|
37
91
|
net-ldap (~> 0.2.2)
|
38
92
|
ruby-debug (>= 0.10.3)
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Requirements
|
|
19
19
|
|
20
20
|
These gems are dependencies of the gem:
|
21
21
|
|
22
|
-
- Devise ~>
|
22
|
+
- Devise ~> 2.0.0
|
23
23
|
- net-ldap ~> 0.2.2
|
24
24
|
|
25
25
|
Installation
|
@@ -31,7 +31,7 @@ This will *only* work for Rails 3 applications.
|
|
31
31
|
|
32
32
|
In the Gemfile for your application:
|
33
33
|
|
34
|
-
gem "devise", "~>
|
34
|
+
gem "devise", "~> 2.0"
|
35
35
|
gem "devise_ldap_authenticatable"
|
36
36
|
|
37
37
|
To get the latest version, pull directly from github instead of the gem:
|
@@ -173,13 +173,6 @@ References
|
|
173
173
|
* [Devise](http://github.com/plataformatec/devise)
|
174
174
|
* [Warden](http://github.com/hassox/warden)
|
175
175
|
|
176
|
-
|
177
|
-
TODO
|
178
|
-
----
|
179
|
-
|
180
|
-
View on [Pivotal Tracker](http://www.pivotaltracker.com/projects/97318).
|
181
|
-
|
182
176
|
Released under the MIT license
|
183
177
|
|
184
|
-
Copyright (c) 2010 Curtis Schiewek, Daniel McNevin
|
185
|
-
|
178
|
+
Copyright (c) 2010 Curtis Schiewek, Daniel McNevin, Steven Xu
|
@@ -3,29 +3,33 @@ require "net/ldap"
|
|
3
3
|
module Devise
|
4
4
|
|
5
5
|
module LdapAdapter
|
6
|
-
|
6
|
+
|
7
7
|
def self.valid_credentials?(login, password_plaintext)
|
8
|
-
options = {:login => login,
|
9
|
-
:password => password_plaintext,
|
8
|
+
options = {:login => login,
|
9
|
+
:password => password_plaintext,
|
10
10
|
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
11
11
|
:admin => ::Devise.ldap_use_admin_to_bind}
|
12
|
-
|
12
|
+
|
13
13
|
resource = LdapConnect.new(options)
|
14
14
|
resource.authorized?
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def self.update_password(login, new_password)
|
18
18
|
options = {:login => login,
|
19
19
|
:new_password => new_password,
|
20
20
|
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
21
21
|
:admin => ::Devise.ldap_use_admin_to_bind}
|
22
|
-
|
22
|
+
|
23
23
|
resource = LdapConnect.new(options)
|
24
|
-
resource.change_password! if new_password.present?
|
24
|
+
resource.change_password! if new_password.present?
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.update_own_password(login, new_password, current_password)
|
28
|
+
set_ldap_param(login, :userpassword, new_password, current_password)
|
25
29
|
end
|
26
30
|
|
27
31
|
def self.ldap_connect(login)
|
28
|
-
options = {:login => login,
|
32
|
+
options = {:login => login,
|
29
33
|
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
30
34
|
:admin => ::Devise.ldap_use_admin_to_bind}
|
31
35
|
|
@@ -39,11 +43,29 @@ module Devise
|
|
39
43
|
def self.get_groups(login)
|
40
44
|
self.ldap_connect(login).user_groups
|
41
45
|
end
|
42
|
-
|
46
|
+
|
43
47
|
def self.get_dn(login)
|
44
48
|
self.ldap_connect(login).dn
|
45
49
|
end
|
46
50
|
|
51
|
+
def self.set_ldap_param(login, param, new_value, password = nil)
|
52
|
+
options = { :login => login,
|
53
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
54
|
+
:password => password }
|
55
|
+
|
56
|
+
resource = LdapConnect.new(options)
|
57
|
+
resource.set_param(param, new_value)
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.delete_ldap_param(login, param, password = nil)
|
61
|
+
options = { :login => login,
|
62
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
63
|
+
:password => password }
|
64
|
+
|
65
|
+
resource = LdapConnect.new(options)
|
66
|
+
resource.delete_param(param)
|
67
|
+
end
|
68
|
+
|
47
69
|
def self.get_ldap_param(login,param)
|
48
70
|
resource = self.ldap_connect(login)
|
49
71
|
resource.ldap_param_value(param)
|
@@ -69,18 +91,27 @@ module Devise
|
|
69
91
|
@ldap.base = ldap_config["base"]
|
70
92
|
@attribute = ldap_config["attribute"]
|
71
93
|
@ldap_auth_username_builder = params[:ldap_auth_username_builder]
|
72
|
-
|
94
|
+
|
73
95
|
@group_base = ldap_config["group_base"]
|
74
|
-
@
|
96
|
+
@check_group_membership = ldap_config.has_key?("check_group_membership") ? ldap_config["check_group_membership"] : ::Devise.ldap_check_group_membership
|
97
|
+
@required_groups = ldap_config["required_groups"]
|
75
98
|
@required_attributes = ldap_config["require_attribute"]
|
76
|
-
|
77
|
-
@ldap.auth ldap_config["admin_user"], ldap_config["admin_password"] if params[:admin]
|
78
|
-
|
99
|
+
|
100
|
+
@ldap.auth ldap_config["admin_user"], ldap_config["admin_password"] if params[:admin]
|
101
|
+
|
79
102
|
@login = params[:login]
|
80
103
|
@password = params[:password]
|
81
104
|
@new_password = params[:new_password]
|
82
105
|
end
|
83
106
|
|
107
|
+
def delete_param(param)
|
108
|
+
update_ldap [[:delete, param.to_sym, nil]]
|
109
|
+
end
|
110
|
+
|
111
|
+
def set_param(param, new_value)
|
112
|
+
update_ldap( { param.to_sym => new_value } )
|
113
|
+
end
|
114
|
+
|
84
115
|
def dn
|
85
116
|
DeviseLdapAuthenticatable::Logger.send("LDAP dn lookup: #{@attribute}=#{@login}")
|
86
117
|
ldap_entry = search_for_login
|
@@ -91,16 +122,17 @@ module Devise
|
|
91
122
|
end
|
92
123
|
end
|
93
124
|
|
94
|
-
|
95
|
-
|
125
|
+
def ldap_param_value(param)
|
126
|
+
filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)
|
96
127
|
ldap_entry = nil
|
97
128
|
@ldap.search(:filter => filter) {|entry| ldap_entry = entry}
|
98
129
|
|
99
|
-
if ldap_entry
|
130
|
+
if ldap_entry
|
100
131
|
if ldap_entry[param]
|
101
132
|
DeviseLdapAuthenticatable::Logger.send("Requested param #{param} has value #{ldap_entry.send(param)}")
|
102
133
|
value = ldap_entry.send(param)
|
103
134
|
value = value.first if value.is_a?(Array) and value.count == 1
|
135
|
+
value
|
104
136
|
else
|
105
137
|
DeviseLdapAuthenticatable::Logger.send("Requested param #{param} does not exist")
|
106
138
|
value = nil
|
@@ -109,8 +141,8 @@ module Devise
|
|
109
141
|
DeviseLdapAuthenticatable::Logger.send("Requested ldap entry does not exist")
|
110
142
|
value = nil
|
111
143
|
end
|
112
|
-
|
113
|
-
|
144
|
+
end
|
145
|
+
|
114
146
|
def authenticate!
|
115
147
|
@ldap.auth(dn, @password)
|
116
148
|
@ldap.bind
|
@@ -119,24 +151,24 @@ module Devise
|
|
119
151
|
def authenticated?
|
120
152
|
authenticate!
|
121
153
|
end
|
122
|
-
|
154
|
+
|
123
155
|
def authorized?
|
124
156
|
DeviseLdapAuthenticatable::Logger.send("Authorizing user #{dn}")
|
125
157
|
authenticated? && in_required_groups? && has_required_attribute?
|
126
158
|
end
|
127
|
-
|
159
|
+
|
128
160
|
def change_password!
|
129
161
|
update_ldap(:userpassword => Net::LDAP::Password.generate(:sha, @new_password))
|
130
162
|
end
|
131
163
|
|
132
|
-
def in_required_groups?
|
133
|
-
return true unless
|
134
|
-
|
164
|
+
def in_required_groups?
|
165
|
+
return true unless @check_group_membership
|
166
|
+
|
135
167
|
## FIXME set errors here, the ldap.yml isn't set properly.
|
136
|
-
return false if @required_groups.nil?
|
137
|
-
|
168
|
+
return false if @required_groups.nil?
|
169
|
+
|
138
170
|
admin_ldap = LdapConnect.admin
|
139
|
-
|
171
|
+
|
140
172
|
for group in @required_groups
|
141
173
|
if group.is_a?(Array)
|
142
174
|
group_attribute, group_name = group
|
@@ -154,9 +186,9 @@ module Devise
|
|
154
186
|
else
|
155
187
|
# AD optimization - extension will recursively check sub-groups with one query
|
156
188
|
# "(memberof:1.2.840.113556.1.4.1941:=group_name)"
|
157
|
-
search_result = admin_ldap.search(:base => dn,
|
189
|
+
search_result = admin_ldap.search(:base => dn,
|
158
190
|
:filter => Net::LDAP::Filter.ex("memberof:1.2.840.113556.1.4.1941", group_name),
|
159
|
-
:scope => Net::LDAP::SearchScope_BaseObject)
|
191
|
+
:scope => Net::LDAP::SearchScope_BaseObject)
|
160
192
|
# Will return the user entry if belongs to group otherwise nothing
|
161
193
|
unless search_result.length == 1 && search_result[0].dn.eql?(dn)
|
162
194
|
DeviseLdapAuthenticatable::Logger.send("User #{dn} is not in group: #{group_name }")
|
@@ -164,27 +196,27 @@ module Devise
|
|
164
196
|
end
|
165
197
|
end
|
166
198
|
end
|
167
|
-
|
199
|
+
|
168
200
|
return true
|
169
201
|
end
|
170
|
-
|
202
|
+
|
171
203
|
def has_required_attribute?
|
172
204
|
return true unless ::Devise.ldap_check_attributes
|
173
|
-
|
205
|
+
|
174
206
|
admin_ldap = LdapConnect.admin
|
175
|
-
|
207
|
+
|
176
208
|
user = find_ldap_user(admin_ldap)
|
177
|
-
|
209
|
+
|
178
210
|
@required_attributes.each do |key,val|
|
179
211
|
unless user[key].include? val
|
180
212
|
DeviseLdapAuthenticatable::Logger.send("User #{dn} did not match attribute #{key}:#{val}")
|
181
|
-
return false
|
213
|
+
return false
|
182
214
|
end
|
183
215
|
end
|
184
|
-
|
216
|
+
|
185
217
|
return true
|
186
218
|
end
|
187
|
-
|
219
|
+
|
188
220
|
def user_groups
|
189
221
|
admin_ldap = LdapConnect.admin
|
190
222
|
|
@@ -207,25 +239,25 @@ module Devise
|
|
207
239
|
@ldap.search(:filter => filter) {|entry| ldap_entry = entry}
|
208
240
|
ldap_entry
|
209
241
|
end
|
210
|
-
|
242
|
+
|
211
243
|
private
|
212
|
-
|
244
|
+
|
213
245
|
def self.admin
|
214
246
|
ldap = LdapConnect.new(:admin => true).ldap
|
215
|
-
|
247
|
+
|
216
248
|
unless ldap.bind
|
217
249
|
DeviseLdapAuthenticatable::Logger.send("Cannot bind to admin LDAP user")
|
218
250
|
raise DeviseLdapAuthenticatable::LdapException, "Cannot connect to admin LDAP user"
|
219
251
|
end
|
220
|
-
|
252
|
+
|
221
253
|
return ldap
|
222
254
|
end
|
223
|
-
|
255
|
+
|
224
256
|
def find_ldap_user(ldap)
|
225
257
|
DeviseLdapAuthenticatable::Logger.send("Finding user: #{dn}")
|
226
258
|
ldap.search(:base => dn, :scope => Net::LDAP::SearchScope_BaseObject).try(:first)
|
227
259
|
end
|
228
|
-
|
260
|
+
|
229
261
|
def update_ldap(ops)
|
230
262
|
operations = []
|
231
263
|
if ops.is_a? Hash
|
@@ -236,10 +268,15 @@ module Devise
|
|
236
268
|
operations = ops
|
237
269
|
end
|
238
270
|
|
239
|
-
|
240
|
-
|
271
|
+
if ::Devise.ldap_use_admin_to_bind
|
272
|
+
privileged_ldap = LdapConnect.admin
|
273
|
+
else
|
274
|
+
authenticate!
|
275
|
+
privileged_ldap = self.ldap
|
276
|
+
end
|
277
|
+
|
241
278
|
DeviseLdapAuthenticatable::Logger.send("Modifying user #{dn}")
|
242
|
-
|
279
|
+
privileged_ldap.modify(:dn => dn, :operations => operations)
|
243
280
|
end
|
244
281
|
|
245
282
|
end
|
@@ -22,6 +22,12 @@ module Devise
|
|
22
22
|
self[@login_with]
|
23
23
|
end
|
24
24
|
|
25
|
+
def change_password!(current_password)
|
26
|
+
raise "Need to set new password first" if @password.blank?
|
27
|
+
|
28
|
+
Devise::LdapAdapter.update_own_password(login_with, @password, current_password)
|
29
|
+
end
|
30
|
+
|
25
31
|
def reset_password!(new_password, new_password_confirmation)
|
26
32
|
if new_password == new_password_confirmation && ::Devise.ldap_update_password
|
27
33
|
Devise::LdapAdapter.update_password(login_with, new_password)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
authorizations: &AUTHORIZATIONS
|
2
|
+
## Authorization
|
3
|
+
group_base: ou=groups,dc=test,dc=com
|
4
|
+
check_group_membership: false
|
5
|
+
required_groups:
|
6
|
+
- cn=admins,ou=groups,dc=test,dc=com
|
7
|
+
- ["authorizationRole", "cn=users,ou=groups,dc=test,dc=com"]
|
8
|
+
require_attribute:
|
9
|
+
objectClass: inetOrgPerson
|
10
|
+
authorizationRole: blogAdmin
|
11
|
+
|
12
|
+
test: &TEST
|
13
|
+
host: localhost
|
14
|
+
port: 3389
|
15
|
+
attribute: cn
|
16
|
+
base: ou=people,dc=test,dc=com
|
17
|
+
admin_user: cn=admin,dc=test,dc=com
|
18
|
+
admin_password: secret
|
19
|
+
ssl: false
|
20
|
+
<<: *AUTHORIZATIONS
|
21
|
+
|
22
|
+
development:
|
23
|
+
<<: *TEST
|
@@ -0,0 +1,23 @@
|
|
1
|
+
authorizations: &AUTHORIZATIONS
|
2
|
+
## Authorization
|
3
|
+
group_base: ou=groups,dc=test,dc=com
|
4
|
+
check_group_membership: true
|
5
|
+
required_groups:
|
6
|
+
- cn=admins,ou=groups,dc=test,dc=com
|
7
|
+
- ["authorizationRole", "cn=users,ou=groups,dc=test,dc=com"]
|
8
|
+
require_attribute:
|
9
|
+
objectClass: inetOrgPerson
|
10
|
+
authorizationRole: blogAdmin
|
11
|
+
|
12
|
+
test: &TEST
|
13
|
+
host: localhost
|
14
|
+
port: 3389
|
15
|
+
attribute: cn
|
16
|
+
base: ou=people,dc=test,dc=com
|
17
|
+
admin_user: cn=admin,dc=test,dc=com
|
18
|
+
admin_password: secret
|
19
|
+
ssl: false
|
20
|
+
<<: *AUTHORIZATIONS
|
21
|
+
|
22
|
+
development:
|
23
|
+
<<: *TEST
|
@@ -127,21 +127,56 @@ class UserTest < ActiveSupport::TestCase
|
|
127
127
|
::Devise.ldap_check_group_membership = true
|
128
128
|
end
|
129
129
|
|
130
|
-
|
131
|
-
|
132
|
-
|
130
|
+
context "config check_group_membership is not defined" do
|
131
|
+
should "admin should be allowed in" do
|
132
|
+
should_be_validated @admin, "admin_secret"
|
133
|
+
end
|
133
134
|
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
should "admin should have the proper groups set" do
|
136
|
+
assert_contains(@admin.ldap_groups, /cn=admins/, "groups attribute not being set properly")
|
137
|
+
end
|
137
138
|
|
138
|
-
|
139
|
-
|
139
|
+
should "user should not be allowed in" do
|
140
|
+
should_not_be_validated @user, "secret"
|
141
|
+
end
|
142
|
+
|
143
|
+
should "not be validated if group with different attribute is removed" do
|
144
|
+
`ldapmodify #{ldap_connect_string} -f ../ldap/delete_authorization_role.ldif`
|
145
|
+
should_not_be_validated @admin, "admin_secret"
|
146
|
+
end
|
140
147
|
end
|
141
148
|
|
142
|
-
|
143
|
-
|
144
|
-
|
149
|
+
context "config file check_group_membership is defined" do
|
150
|
+
setup do
|
151
|
+
default_devise_settings!
|
152
|
+
reset_ldap_server!
|
153
|
+
end
|
154
|
+
|
155
|
+
context "check_group_membership is turned on" do
|
156
|
+
setup do
|
157
|
+
::Devise.ldap_config = "#{Rails.root}/config/ldap_with_check_membership_on.yml"
|
158
|
+
|
159
|
+
::Devise.ldap_check_group_membership = false
|
160
|
+
end
|
161
|
+
|
162
|
+
# Config file value has precedence over ldap_check_group_membership
|
163
|
+
should "user should not be allowed in" do
|
164
|
+
should_not_be_validated @user, "secret"
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "check_group_membership is turned off" do
|
169
|
+
setup do
|
170
|
+
::Devise.ldap_config = "#{Rails.root}/config/ldap_with_check_membership_off.yml"
|
171
|
+
|
172
|
+
::Devise.ldap_check_group_membership = true
|
173
|
+
end
|
174
|
+
|
175
|
+
# Config file value has precedence over ldap_check_group_membership
|
176
|
+
should "user should be allowed in" do
|
177
|
+
should_be_validated @user, "secret"
|
178
|
+
end
|
179
|
+
end
|
145
180
|
end
|
146
181
|
end
|
147
182
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_ldap_authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-06-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: devise
|
18
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,15 @@ dependencies:
|
|
23
23
|
version: 2.0.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 2.0.0
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: net-ldap
|
29
|
-
requirement:
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
30
35
|
none: false
|
31
36
|
requirements:
|
32
37
|
- - ~>
|
@@ -34,7 +39,12 @@ dependencies:
|
|
34
39
|
version: 0.2.2
|
35
40
|
type: :runtime
|
36
41
|
prerelease: false
|
37
|
-
version_requirements:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.2.2
|
38
48
|
description: Devise extension to allow authentication via LDAP
|
39
49
|
email: curtis.schiewek@gmail.com
|
40
50
|
executables: []
|
@@ -97,6 +107,8 @@ files:
|
|
97
107
|
- test/rails_app/config/initializers/session_store.rb
|
98
108
|
- test/rails_app/config/ldap.yml
|
99
109
|
- test/rails_app/config/ldap_with_boolean_ssl.yml
|
110
|
+
- test/rails_app/config/ldap_with_check_membership_off.yml
|
111
|
+
- test/rails_app/config/ldap_with_check_membership_on.yml
|
100
112
|
- test/rails_app/config/ldap_with_erb.yml
|
101
113
|
- test/rails_app/config/ldap_with_uid.yml
|
102
114
|
- test/rails_app/config/locales/devise.en.yml
|
@@ -157,8 +169,87 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
169
|
version: '0'
|
158
170
|
requirements: []
|
159
171
|
rubyforge_project:
|
160
|
-
rubygems_version: 1.8.
|
172
|
+
rubygems_version: 1.8.24
|
161
173
|
signing_key:
|
162
174
|
specification_version: 3
|
163
175
|
summary: Devise extension to allow authentication via LDAP
|
164
|
-
test_files:
|
176
|
+
test_files:
|
177
|
+
- test/devise_ldap_authenticatable_test.rb
|
178
|
+
- test/ldap/base.ldif
|
179
|
+
- test/ldap/clear.ldif
|
180
|
+
- test/ldap/local.schema
|
181
|
+
- test/ldap/openldap-data/run/.gitkeep
|
182
|
+
- test/ldap/run-server.sh
|
183
|
+
- test/ldap/server.pem
|
184
|
+
- test/ldap/slapd-ssl-test.conf
|
185
|
+
- test/ldap/slapd-test.conf
|
186
|
+
- test/rails_app/Gemfile
|
187
|
+
- test/rails_app/Gemfile.lock
|
188
|
+
- test/rails_app/Rakefile
|
189
|
+
- test/rails_app/app/controllers/application_controller.rb
|
190
|
+
- test/rails_app/app/controllers/posts_controller.rb
|
191
|
+
- test/rails_app/app/helpers/application_helper.rb
|
192
|
+
- test/rails_app/app/helpers/posts_helper.rb
|
193
|
+
- test/rails_app/app/models/post.rb
|
194
|
+
- test/rails_app/app/models/user.rb
|
195
|
+
- test/rails_app/app/views/layouts/application.html.erb
|
196
|
+
- test/rails_app/app/views/posts/index.html.erb
|
197
|
+
- test/rails_app/config.ru
|
198
|
+
- test/rails_app/config/application.rb
|
199
|
+
- test/rails_app/config/boot.rb
|
200
|
+
- test/rails_app/config/cucumber.yml
|
201
|
+
- test/rails_app/config/database.yml
|
202
|
+
- test/rails_app/config/environment.rb
|
203
|
+
- test/rails_app/config/environments/development.rb
|
204
|
+
- test/rails_app/config/environments/production.rb
|
205
|
+
- test/rails_app/config/environments/test.rb
|
206
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
207
|
+
- test/rails_app/config/initializers/devise.rb
|
208
|
+
- test/rails_app/config/initializers/inflections.rb
|
209
|
+
- test/rails_app/config/initializers/mime_types.rb
|
210
|
+
- test/rails_app/config/initializers/secret_token.rb
|
211
|
+
- test/rails_app/config/initializers/session_store.rb
|
212
|
+
- test/rails_app/config/ldap.yml
|
213
|
+
- test/rails_app/config/ldap_with_boolean_ssl.yml
|
214
|
+
- test/rails_app/config/ldap_with_check_membership_off.yml
|
215
|
+
- test/rails_app/config/ldap_with_check_membership_on.yml
|
216
|
+
- test/rails_app/config/ldap_with_erb.yml
|
217
|
+
- test/rails_app/config/ldap_with_uid.yml
|
218
|
+
- test/rails_app/config/locales/devise.en.yml
|
219
|
+
- test/rails_app/config/locales/en.yml
|
220
|
+
- test/rails_app/config/routes.rb
|
221
|
+
- test/rails_app/config/ssl_ldap.yml
|
222
|
+
- test/rails_app/config/ssl_ldap_with_erb.yml
|
223
|
+
- test/rails_app/config/ssl_ldap_with_uid.yml
|
224
|
+
- test/rails_app/db/migrate/20100708120302_create_posts.rb
|
225
|
+
- test/rails_app/db/migrate/20100708120448_devise_create_users.rb
|
226
|
+
- test/rails_app/db/schema.rb
|
227
|
+
- test/rails_app/db/seeds.rb
|
228
|
+
- test/rails_app/features/manage_logins.feature
|
229
|
+
- test/rails_app/features/step_definitions/login_steps.rb
|
230
|
+
- test/rails_app/features/step_definitions/web_steps.rb
|
231
|
+
- test/rails_app/features/support/env.rb
|
232
|
+
- test/rails_app/features/support/paths.rb
|
233
|
+
- test/rails_app/lib/tasks/.gitkeep
|
234
|
+
- test/rails_app/lib/tasks/cucumber.rake
|
235
|
+
- test/rails_app/public/404.html
|
236
|
+
- test/rails_app/public/422.html
|
237
|
+
- test/rails_app/public/500.html
|
238
|
+
- test/rails_app/public/images/rails.png
|
239
|
+
- test/rails_app/public/javascripts/application.js
|
240
|
+
- test/rails_app/public/javascripts/controls.js
|
241
|
+
- test/rails_app/public/javascripts/dragdrop.js
|
242
|
+
- test/rails_app/public/javascripts/effects.js
|
243
|
+
- test/rails_app/public/javascripts/prototype.js
|
244
|
+
- test/rails_app/public/javascripts/rails.js
|
245
|
+
- test/rails_app/public/stylesheets/.gitkeep
|
246
|
+
- test/rails_app/script/cucumber
|
247
|
+
- test/rails_app/script/rails
|
248
|
+
- test/rails_app/test/factories/users.rb
|
249
|
+
- test/rails_app/test/functional/posts_controller_test.rb
|
250
|
+
- test/rails_app/test/performance/browsing_test.rb
|
251
|
+
- test/rails_app/test/test_helper.rb
|
252
|
+
- test/rails_app/test/unit/helpers/posts_helper_test.rb
|
253
|
+
- test/rails_app/test/unit/post_test.rb
|
254
|
+
- test/rails_app/test/unit/user_test.rb
|
255
|
+
- test/test_helper.rb
|