ons-ldap 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -3
- data/lib/ons-ldap/ldap_connection.rb +2 -5
- data/lib/ons-ldap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db3e9abf832ade895a814cb4b38c3977a9c7f808
|
4
|
+
data.tar.gz: df4413d0f4f571708bfdc749e8bbe91f27f0f883
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a49f167e74a0a2d7589a638acfad6535ed87aef3d7859da5c3725042bf42a756392b3efc96df658687f593c7e0dff0973f9c0ab5ae3ec13ca39db880ce073a87
|
7
|
+
data.tar.gz: fa5614ea9a2fe476317f9448881c2793f994ccf679f91ddbe92b290a938521ffb958f122dbff33c7e5beb657b59388b46dbb69a6e94bfc61bf92f536c6cbfa9d
|
data/README.md
CHANGED
@@ -26,9 +26,6 @@ user_entry.user_id #=> 'johntopley'
|
|
26
26
|
user_entry.display_name #=> 'John Topley'
|
27
27
|
user_entry.token # 2FA token, stored in LDAP's employeeNumber field for expediency
|
28
28
|
user_entry.groups #=> ['admins', 'users']
|
29
|
-
|
30
|
-
# Pass false as the last initializer argument to use a non-TLS connection:
|
31
|
-
ldap_connection = LDAPConnection.new(host, port, base, groups, logger, false)
|
32
29
|
```
|
33
30
|
|
34
31
|
## Testing
|
@@ -11,16 +11,14 @@ class LDAPConnection
|
|
11
11
|
attr_accessor :base
|
12
12
|
attr_accessor :groups
|
13
13
|
attr_accessor :logger
|
14
|
-
attr_accessor :encrypted
|
15
14
|
end
|
16
15
|
|
17
|
-
def initialize(host, port, base, groups, logger
|
16
|
+
def initialize(host, port, base, groups, logger)
|
18
17
|
self.class.host = host
|
19
18
|
self.class.port = port.to_i
|
20
19
|
self.class.base = base
|
21
20
|
self.class.groups = groups
|
22
21
|
self.class.logger = logger
|
23
|
-
self.class.encrypted = encrypted
|
24
22
|
end
|
25
23
|
|
26
24
|
def authenticate(username, password)
|
@@ -29,8 +27,7 @@ class LDAPConnection
|
|
29
27
|
# Have to use the username DN format below for the bind operation to succeed.
|
30
28
|
auth = { method: :simple, username: "uid=#{username},ou=Users,#{self.class.base}", password: password }
|
31
29
|
|
32
|
-
Net::LDAP.open(host: self.class.host, port: self.class.port, base: self.class.base, auth: auth) do |ldap|
|
33
|
-
ldap.encryption = :simple_tls if self.class.encrypted?
|
30
|
+
Net::LDAP.open(host: self.class.host, port: self.class.port, encryption: :simple_tls, base: self.class.base, auth: auth) do |ldap|
|
34
31
|
unless ldap.bind
|
35
32
|
result = ldap.get_operation_result
|
36
33
|
self.class.logger.error "LDAP authentication failed for '#{username}': #{result.message} (#{result.code})"
|
data/lib/ons-ldap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ons-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Topley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-02-
|
12
|
+
date: 2017-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ldap
|