devise_ldap_authenticatable 0.8.0.pre → 0.8.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/Gemfile +2 -2
- data/README.md +9 -0
- data/devise_ldap_authenticatable.gemspec +3 -2
- data/lib/devise_ldap_authenticatable.rb +3 -4
- data/lib/devise_ldap_authenticatable/ldap/adapter.rb +87 -0
- data/lib/devise_ldap_authenticatable/{ldap_adapter.rb → ldap/connection.rb} +11 -95
- data/lib/devise_ldap_authenticatable/model.rb +12 -9
- data/lib/devise_ldap_authenticatable/strategy.rb +3 -10
- data/lib/devise_ldap_authenticatable/version.rb +1 -1
- data/spec/rails_app/db/schema.rb +11 -10
- data/spec/unit/user_spec.rb +3 -3
- metadata +20 -14
- data/lib/devise_ldap_authenticatable/routes.rb +0 -8
- data/lib/devise_ldap_authenticatable/schema.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eedf5d7bc24d165792c969025ab40f505186c860
|
4
|
+
data.tar.gz: f64f68c2cdd55964cd11eb716ab0aa792d2609dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f84af5cc16c2339e14ac95c232e98c0e3579a59114c105ee52960403b8d688c9af536f3b1cbe2b7651c0bcdb1b84b742846b1f2d04980a522d1b6b83be7f49
|
7
|
+
data.tar.gz: 1bbc5971f9d6c7e864f5841036da504844c54176772a51e84766429cf148547e87623bc7545483c11b4a9bd1a3d4f63eeed4546c41e5e6c009175c982a0d40de
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
Devise LDAP Authenticatable
|
2
2
|
===========================
|
3
|
+
[](http://badge.fury.io/rb/devise_ldap_authenticatable)
|
4
|
+
[](https://codeclimate.com/github/cschiewek/devise_ldap_authenticatable)
|
5
|
+
[](https://gemnasium.com/cschiewek/devise_ldap_authenticatable)
|
6
|
+
|
3
7
|
Devise LDAP Authenticatable is a LDAP based authentication strategy for the [Devise](http://github.com/plataformatec/devise) authentication framework.
|
4
8
|
|
5
9
|
If you are building applications for use within your organization which require authentication and you want to use LDAP, this plugin is for you.
|
@@ -100,6 +104,11 @@ Troubleshooting
|
|
100
104
|
|
101
105
|
**SSL certificate invalid:** If you're using a test LDAP server running a self-signed SSL certificate, make sure the appropriate root certificate is installed on your system. Alternately, you may temporarily disable certificate checking for SSL by modifying your system LDAP configuration (e.g., `/etc/openldap/ldap.conf` or `/etc/ldap/ldap.conf`) to read `TLS_REQCERT never`.
|
102
106
|
|
107
|
+
Discussion Group
|
108
|
+
------------
|
109
|
+
|
110
|
+
For additional support, questions or discussions, please see the discussion forum on [Google Groups](https://groups.google.com/forum/#!forum/devise_ldap_authenticatable)
|
111
|
+
|
103
112
|
Development guide
|
104
113
|
------------
|
105
114
|
To contribute to `devise_ldap_authentication`, you should be able to run a test OpenLDAP server. Specifically, you need the `slapd`, `ldapadd`, and `ldapmodify` binaries.
|
@@ -11,14 +11,15 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = 'https://github.com/cschiewek/devise_ldap_authenticatable'
|
12
12
|
s.description = s.summary
|
13
13
|
s.authors = ['Curtis Schiewek', 'Daniel McNevin', 'Steven Xu']
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.files = `git ls-files`.split("\n")
|
16
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
19
|
s.require_paths = ["lib"]
|
19
20
|
|
20
|
-
s.add_dependency('devise', '3.0
|
21
|
-
s.add_dependency('net-ldap', '
|
21
|
+
s.add_dependency('devise', '>= 3.0')
|
22
|
+
s.add_dependency('net-ldap', '>= 0.3.1', '< 0.5.0')
|
22
23
|
|
23
24
|
s.add_development_dependency('rake', '>= 0.9')
|
24
25
|
s.add_development_dependency('rdoc', '>= 3')
|
@@ -3,9 +3,8 @@ require 'devise'
|
|
3
3
|
|
4
4
|
require 'devise_ldap_authenticatable/exception'
|
5
5
|
require 'devise_ldap_authenticatable/logger'
|
6
|
-
require 'devise_ldap_authenticatable/
|
7
|
-
require 'devise_ldap_authenticatable/
|
8
|
-
require 'devise_ldap_authenticatable/routes'
|
6
|
+
require 'devise_ldap_authenticatable/ldap/adapter'
|
7
|
+
require 'devise_ldap_authenticatable/ldap/connection'
|
9
8
|
|
10
9
|
# Get ldap information from config/ldap.yml now
|
11
10
|
module Devise
|
@@ -45,4 +44,4 @@ Devise.add_module(:ldap_authenticatable,
|
|
45
44
|
:route => :session, ## This will add the routes, rather than in the routes.rb
|
46
45
|
:strategy => true,
|
47
46
|
:controller => :sessions,
|
48
|
-
:model => 'devise_ldap_authenticatable/model')
|
47
|
+
:model => 'devise_ldap_authenticatable/model')
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require "net/ldap"
|
2
|
+
|
3
|
+
module Devise
|
4
|
+
module LDAP
|
5
|
+
DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY = 'uniqueMember'
|
6
|
+
|
7
|
+
module Adapter
|
8
|
+
def self.valid_credentials?(login, password_plaintext)
|
9
|
+
options = {:login => login,
|
10
|
+
:password => password_plaintext,
|
11
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
12
|
+
:admin => ::Devise.ldap_use_admin_to_bind}
|
13
|
+
|
14
|
+
resource = Devise::LDAP::Connection.new(options)
|
15
|
+
resource.authorized?
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.update_password(login, new_password)
|
19
|
+
options = {:login => login,
|
20
|
+
:new_password => new_password,
|
21
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
22
|
+
:admin => ::Devise.ldap_use_admin_to_bind}
|
23
|
+
|
24
|
+
resource = Devise::LDAP::Connection.new(options)
|
25
|
+
resource.change_password! if new_password.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.update_own_password(login, new_password, current_password)
|
29
|
+
set_ldap_param(login, :userpassword, Net::LDAP::Password.generate(:sha, new_password), current_password)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.ldap_connect(login)
|
33
|
+
options = {:login => login,
|
34
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
35
|
+
:admin => ::Devise.ldap_use_admin_to_bind}
|
36
|
+
|
37
|
+
resource = Devise::LDAP::Connection.new(options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.valid_login?(login)
|
41
|
+
self.ldap_connect(login).valid_login?
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.get_groups(login)
|
45
|
+
self.ldap_connect(login).user_groups
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.in_ldap_group?(login, group_name, group_attribute = nil)
|
49
|
+
self.ldap_connect(login).in_group?(group_name, group_attribute)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.get_dn(login)
|
53
|
+
self.ldap_connect(login).dn
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.set_ldap_param(login, param, new_value, password = nil)
|
57
|
+
options = { :login => login,
|
58
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
59
|
+
:password => password }
|
60
|
+
|
61
|
+
resource = Devise::LDAP::Connection.new(options)
|
62
|
+
resource.set_param(param, new_value)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.delete_ldap_param(login, param, password = nil)
|
66
|
+
options = { :login => login,
|
67
|
+
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
68
|
+
:password => password }
|
69
|
+
|
70
|
+
resource = Devise::LDAP::Connection.new(options)
|
71
|
+
resource.delete_param(param)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get_ldap_param(login,param)
|
75
|
+
resource = self.ldap_connect(login)
|
76
|
+
resource.ldap_param_value(param)
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.get_ldap_entry(login)
|
80
|
+
self.ldap_connect(login).search_for_login
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
@@ -1,86 +1,6 @@
|
|
1
|
-
require "net/ldap"
|
2
|
-
|
3
1
|
module Devise
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
def self.valid_credentials?(login, password_plaintext)
|
8
|
-
options = {:login => login,
|
9
|
-
:password => password_plaintext,
|
10
|
-
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
11
|
-
:admin => ::Devise.ldap_use_admin_to_bind}
|
12
|
-
|
13
|
-
resource = LdapConnect.new(options)
|
14
|
-
resource.authorized?
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.update_password(login, new_password)
|
18
|
-
options = {:login => login,
|
19
|
-
:new_password => new_password,
|
20
|
-
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
21
|
-
:admin => ::Devise.ldap_use_admin_to_bind}
|
22
|
-
|
23
|
-
resource = LdapConnect.new(options)
|
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, Net::LDAP::Password.generate(:sha, new_password), current_password)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.ldap_connect(login)
|
32
|
-
options = {:login => login,
|
33
|
-
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
34
|
-
:admin => ::Devise.ldap_use_admin_to_bind}
|
35
|
-
|
36
|
-
resource = LdapConnect.new(options)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.valid_login?(login)
|
40
|
-
self.ldap_connect(login).valid_login?
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.get_groups(login)
|
44
|
-
self.ldap_connect(login).user_groups
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.in_ldap_group?(login, group_name, group_attribute = nil)
|
48
|
-
self.ldap_connect(login).in_group?(group_name, group_attribute)
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.get_dn(login)
|
52
|
-
self.ldap_connect(login).dn
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.set_ldap_param(login, param, new_value, password = nil)
|
56
|
-
options = { :login => login,
|
57
|
-
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
58
|
-
:password => password }
|
59
|
-
|
60
|
-
resource = LdapConnect.new(options)
|
61
|
-
resource.set_param(param, new_value)
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.delete_ldap_param(login, param, password = nil)
|
65
|
-
options = { :login => login,
|
66
|
-
:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
|
67
|
-
:password => password }
|
68
|
-
|
69
|
-
resource = LdapConnect.new(options)
|
70
|
-
resource.delete_param(param)
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.get_ldap_param(login,param)
|
74
|
-
resource = self.ldap_connect(login)
|
75
|
-
resource.ldap_param_value(param)
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.get_ldap_entry(login)
|
79
|
-
self.ldap_connect(login).search_for_login
|
80
|
-
end
|
81
|
-
|
82
|
-
class LdapConnect
|
83
|
-
|
2
|
+
module LDAP
|
3
|
+
class Connection
|
84
4
|
attr_reader :ldap, :login
|
85
5
|
|
86
6
|
def initialize(params = {})
|
@@ -132,10 +52,9 @@ module Devise
|
|
132
52
|
@ldap.search(:filter => filter) {|entry| ldap_entry = entry}
|
133
53
|
|
134
54
|
if ldap_entry
|
135
|
-
|
136
|
-
DeviseLdapAuthenticatable::Logger.send("Requested param #{param} has value #{ldap_entry.send(param)}")
|
55
|
+
unless ldap_entry[param].empty?
|
137
56
|
value = ldap_entry.send(param)
|
138
|
-
|
57
|
+
DeviseLdapAuthenticatable::Logger.send("Requested param #{param} has value #{value}")
|
139
58
|
value
|
140
59
|
else
|
141
60
|
DeviseLdapAuthenticatable::Logger.send("Requested param #{param} does not exist")
|
@@ -192,10 +111,10 @@ module Devise
|
|
192
111
|
return true
|
193
112
|
end
|
194
113
|
|
195
|
-
def in_group?(group_name, group_attribute = DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY)
|
114
|
+
def in_group?(group_name, group_attribute = LDAP::DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY)
|
196
115
|
in_group = false
|
197
116
|
|
198
|
-
admin_ldap =
|
117
|
+
admin_ldap = Connection.admin
|
199
118
|
|
200
119
|
unless ::Devise.ldap_ad_group_check
|
201
120
|
admin_ldap.search(:base => group_name, :scope => Net::LDAP::SearchScope_BaseObject) do |entry|
|
@@ -225,7 +144,7 @@ module Devise
|
|
225
144
|
def has_required_attribute?
|
226
145
|
return true unless ::Devise.ldap_check_attributes
|
227
146
|
|
228
|
-
admin_ldap =
|
147
|
+
admin_ldap = Connection.admin
|
229
148
|
|
230
149
|
user = find_ldap_user(admin_ldap)
|
231
150
|
|
@@ -240,7 +159,7 @@ module Devise
|
|
240
159
|
end
|
241
160
|
|
242
161
|
def user_groups
|
243
|
-
admin_ldap =
|
162
|
+
admin_ldap = Connection.admin
|
244
163
|
|
245
164
|
DeviseLdapAuthenticatable::Logger.send("Getting groups for #{dn}")
|
246
165
|
filter = Net::LDAP::Filter.eq("uniqueMember", dn)
|
@@ -267,7 +186,7 @@ module Devise
|
|
267
186
|
private
|
268
187
|
|
269
188
|
def self.admin
|
270
|
-
ldap =
|
189
|
+
ldap = Connection.new(:admin => true).ldap
|
271
190
|
|
272
191
|
unless ldap.bind
|
273
192
|
DeviseLdapAuthenticatable::Logger.send("Cannot bind to admin LDAP user")
|
@@ -293,7 +212,7 @@ module Devise
|
|
293
212
|
end
|
294
213
|
|
295
214
|
if ::Devise.ldap_use_admin_to_bind
|
296
|
-
privileged_ldap =
|
215
|
+
privileged_ldap = Connection.admin
|
297
216
|
else
|
298
217
|
authenticate!
|
299
218
|
privileged_ldap = self.ldap
|
@@ -302,9 +221,6 @@ module Devise
|
|
302
221
|
DeviseLdapAuthenticatable::Logger.send("Modifying user #{dn}")
|
303
222
|
privileged_ldap.modify(:dn => dn, :operations => operations)
|
304
223
|
end
|
305
|
-
|
306
224
|
end
|
307
|
-
|
308
225
|
end
|
309
|
-
|
310
|
-
end
|
226
|
+
end
|
@@ -25,12 +25,12 @@ module Devise
|
|
25
25
|
def change_password!(current_password)
|
26
26
|
raise "Need to set new password first" if @password.blank?
|
27
27
|
|
28
|
-
Devise::
|
28
|
+
Devise::LDAP::Adapter.update_own_password(login_with, @password, current_password)
|
29
29
|
end
|
30
30
|
|
31
31
|
def reset_password!(new_password, new_password_confirmation)
|
32
32
|
if new_password == new_password_confirmation && ::Devise.ldap_update_password
|
33
|
-
Devise::
|
33
|
+
Devise::LDAP::Adapter.update_password(login_with, new_password)
|
34
34
|
end
|
35
35
|
clear_reset_password_token if valid?
|
36
36
|
save
|
@@ -38,11 +38,14 @@ module Devise
|
|
38
38
|
|
39
39
|
def password=(new_password)
|
40
40
|
@password = new_password
|
41
|
+
if defined?(password_digest) && @password.present? && respond_to?(:encrypted_password=)
|
42
|
+
self.encrypted_password = password_digest(@password)
|
43
|
+
end
|
41
44
|
end
|
42
45
|
|
43
46
|
# Checks if a resource is valid upon authentication.
|
44
47
|
def valid_ldap_authentication?(password)
|
45
|
-
if Devise::
|
48
|
+
if Devise::LDAP::Adapter.valid_credentials?(login_with, password)
|
46
49
|
return true
|
47
50
|
else
|
48
51
|
return false
|
@@ -50,19 +53,19 @@ module Devise
|
|
50
53
|
end
|
51
54
|
|
52
55
|
def ldap_groups
|
53
|
-
Devise::
|
56
|
+
Devise::LDAP::Adapter.get_groups(login_with)
|
54
57
|
end
|
55
58
|
|
56
|
-
def in_ldap_group?(group_name, group_attribute =
|
57
|
-
Devise::
|
59
|
+
def in_ldap_group?(group_name, group_attribute = LDAP::DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY)
|
60
|
+
Devise::LDAP::Adapter.in_ldap_group?(login_with, group_name, group_attribute)
|
58
61
|
end
|
59
62
|
|
60
63
|
def ldap_dn
|
61
|
-
Devise::
|
64
|
+
Devise::LDAP::Adapter.get_dn(login_with)
|
62
65
|
end
|
63
66
|
|
64
67
|
def ldap_get_param(login_with, param)
|
65
|
-
Devise::
|
68
|
+
Devise::LDAP::Adapter.get_ldap_param(login_with,param)
|
66
69
|
end
|
67
70
|
|
68
71
|
#
|
@@ -95,7 +98,7 @@ module Devise
|
|
95
98
|
if resource.try(:valid_ldap_authentication?, attributes[:password])
|
96
99
|
if resource.new_record?
|
97
100
|
resource.ldap_before_save if resource.respond_to?(:ldap_before_save)
|
98
|
-
resource.save
|
101
|
+
resource.save!
|
99
102
|
end
|
100
103
|
return resource
|
101
104
|
else
|
@@ -2,24 +2,17 @@ require 'devise/strategies/authenticatable'
|
|
2
2
|
|
3
3
|
module Devise
|
4
4
|
module Strategies
|
5
|
-
# Strategy for signing in a user based on his login and password using LDAP.
|
6
|
-
# Redirects to sign_in page if it's not authenticated
|
7
5
|
class LdapAuthenticatable < Authenticatable
|
8
|
-
# Authenticate a user based on login and password params, returning to warden
|
9
|
-
# success and the authenticated user if everything is okay. Otherwise redirect
|
10
|
-
# to sign in page.
|
11
6
|
def authenticate!
|
12
|
-
resource = valid_password? && mapping.to.authenticate_with_ldap(
|
13
|
-
return fail(:invalid)
|
7
|
+
resource = valid_password? && mapping.to.authenticate_with_ldap(authentication_hash.merge(password: password))
|
8
|
+
return fail(:invalid) unless resource
|
14
9
|
|
15
10
|
if validate(resource)
|
16
11
|
success!(resource)
|
17
|
-
else
|
18
|
-
fail(:invalid)
|
19
12
|
end
|
20
13
|
end
|
21
14
|
end
|
22
15
|
end
|
23
16
|
end
|
24
17
|
|
25
|
-
Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable)
|
18
|
+
Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable)
|
data/spec/rails_app/db/schema.rb
CHANGED
@@ -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.
|
@@ -8,27 +9,27 @@
|
|
8
9
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
10
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
11
|
#
|
11
|
-
# It's strongly recommended
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
13
|
|
13
|
-
ActiveRecord::Schema.define(:
|
14
|
+
ActiveRecord::Schema.define(version: 20100708120448) do
|
14
15
|
|
15
|
-
create_table "users", :
|
16
|
-
t.string "email", :
|
17
|
-
t.string "encrypted_password", :
|
16
|
+
create_table "users", force: true do |t|
|
17
|
+
t.string "email", default: "", null: false
|
18
|
+
t.string "encrypted_password", default: "", null: false
|
18
19
|
t.string "reset_password_token"
|
19
20
|
t.datetime "reset_password_sent_at"
|
20
21
|
t.datetime "remember_created_at"
|
21
|
-
t.integer "sign_in_count", :
|
22
|
+
t.integer "sign_in_count", default: 0
|
22
23
|
t.datetime "current_sign_in_at"
|
23
24
|
t.datetime "last_sign_in_at"
|
24
25
|
t.string "current_sign_in_ip"
|
25
26
|
t.string "last_sign_in_ip"
|
26
27
|
t.string "uid"
|
27
|
-
t.datetime "created_at"
|
28
|
-
t.datetime "updated_at"
|
28
|
+
t.datetime "created_at"
|
29
|
+
t.datetime "updated_at"
|
29
30
|
end
|
30
31
|
|
31
|
-
add_index "users", ["email"], :
|
32
|
-
add_index "users", ["reset_password_token"], :
|
32
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
33
|
+
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
33
34
|
|
34
35
|
end
|
data/spec/unit/user_spec.rb
CHANGED
@@ -18,11 +18,11 @@ describe 'Users' do
|
|
18
18
|
|
19
19
|
describe "look up and ldap user" do
|
20
20
|
it "should return true for a user that does exist in LDAP" do
|
21
|
-
assert_equal true, ::Devise::
|
21
|
+
assert_equal true, ::Devise::LDAP::Adapter.valid_login?('example.user@test.com')
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should return false for a user that doesn't exist in LDAP" do
|
25
|
-
assert_equal false, ::Devise::
|
25
|
+
assert_equal false, ::Devise::LDAP::Adapter.valid_login?('barneystinson')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -280,7 +280,7 @@ describe 'Users' do
|
|
280
280
|
|
281
281
|
it "should not fail if config file has ssl: true" do
|
282
282
|
assert_nothing_raised do
|
283
|
-
Devise::
|
283
|
+
Devise::LDAP::Connection.new
|
284
284
|
end
|
285
285
|
end
|
286
286
|
end
|
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.8.0
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis Schiewek
|
@@ -10,36 +10,42 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-07-
|
13
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: devise
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - '
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0
|
21
|
+
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - '
|
26
|
+
- - '>='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 3.0
|
28
|
+
version: '3.0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: net-ldap
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - '>='
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 0.3.1
|
36
|
+
- - <
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.5.0
|
36
39
|
type: :runtime
|
37
40
|
prerelease: false
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
39
42
|
requirements:
|
40
|
-
- -
|
43
|
+
- - '>='
|
41
44
|
- !ruby/object:Gem::Version
|
42
45
|
version: 0.3.1
|
46
|
+
- - <
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.5.0
|
43
49
|
- !ruby/object:Gem::Dependency
|
44
50
|
name: rake
|
45
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -195,11 +201,10 @@ files:
|
|
195
201
|
- devise_ldap_authenticatable.gemspec
|
196
202
|
- lib/devise_ldap_authenticatable.rb
|
197
203
|
- lib/devise_ldap_authenticatable/exception.rb
|
198
|
-
- lib/devise_ldap_authenticatable/
|
204
|
+
- lib/devise_ldap_authenticatable/ldap/adapter.rb
|
205
|
+
- lib/devise_ldap_authenticatable/ldap/connection.rb
|
199
206
|
- lib/devise_ldap_authenticatable/logger.rb
|
200
207
|
- lib/devise_ldap_authenticatable/model.rb
|
201
|
-
- lib/devise_ldap_authenticatable/routes.rb
|
202
|
-
- lib/devise_ldap_authenticatable/schema.rb
|
203
208
|
- lib/devise_ldap_authenticatable/strategy.rb
|
204
209
|
- lib/devise_ldap_authenticatable/version.rb
|
205
210
|
- lib/generators/devise_ldap_authenticatable/install_generator.rb
|
@@ -274,7 +279,8 @@ files:
|
|
274
279
|
- spec/support/factories.rb
|
275
280
|
- spec/unit/user_spec.rb
|
276
281
|
homepage: https://github.com/cschiewek/devise_ldap_authenticatable
|
277
|
-
licenses:
|
282
|
+
licenses:
|
283
|
+
- MIT
|
278
284
|
metadata: {}
|
279
285
|
post_install_message:
|
280
286
|
rdoc_options: []
|
@@ -287,9 +293,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
293
|
version: '0'
|
288
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
295
|
requirements:
|
290
|
-
- - '
|
296
|
+
- - '>='
|
291
297
|
- !ruby/object:Gem::Version
|
292
|
-
version:
|
298
|
+
version: '0'
|
293
299
|
requirements: []
|
294
300
|
rubyforge_project:
|
295
301
|
rubygems_version: 2.0.3
|
@@ -1,8 +0,0 @@
|
|
1
|
-
## No routes needed anymore since Devise.add_module with the :route parameter will take care of it.
|
2
|
-
|
3
|
-
# ActionController::Routing::RouteSet::Mapper.class_eval do
|
4
|
-
#
|
5
|
-
# protected
|
6
|
-
# # reuse the session routes and controller
|
7
|
-
# alias :ldap_authenticatable :database_authenticatable
|
8
|
-
# end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
## Using email now instead of login. Will add an option later on.
|
2
|
-
|
3
|
-
# Devise::Schema.class_eval do
|
4
|
-
# # Creates login
|
5
|
-
# #
|
6
|
-
# # == Options
|
7
|
-
# # * :null - When true, allow columns to be null.
|
8
|
-
# def ldap_authenticatable(options={})
|
9
|
-
# null = options[:null] || false
|
10
|
-
#
|
11
|
-
# apply_schema :login, String, :null => null
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# end
|