wobauth 5.0.2 → 5.1.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/app/services/wobauth/search_ad_user_service.rb +27 -9
- data/config/ldap.yml.example +32 -0
- data/lib/wobauth.rb +9 -4
- data/lib/wobauth/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1889123fe1e0d6d4e986cb42d678b6aa474300876f66d3beeb4f060e159eff8d
|
4
|
+
data.tar.gz: 17554b7eb67349b71e25e377d944d3006e875e03b77981a893db5c6795edfc4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9164b9aac82455c42149d900a207e16516e3a0a706898710a1d53288932b080322d6e7e6782db9929ccd287eec83f65ca3609b1d53c99719a8cfe16078a64589
|
7
|
+
data.tar.gz: 694b09bae0b9e5da4ba428dcab073763fb489347f8ab785e82af244304517aa3ab9f859efa75a120627fba1d6b20822791c7d1b43db1bf9d13260ad308e63cf6
|
@@ -17,17 +17,27 @@ module Wobauth
|
|
17
17
|
return Result.new(success: false, error_messages: ["no query given"], ad_users: [])
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
errors = []
|
21
|
+
ad_users = []
|
22
|
+
ldap_options.each do |ldapopts|
|
23
|
+
ldap = Wobaduser::LDAP.new(ldap_options: ldapopts)
|
24
|
+
if ldap.errors.any?
|
25
|
+
errors += ldap.errors
|
26
|
+
next
|
27
|
+
end
|
28
|
+
search = Wobaduser::User.search(ldap: ldap, filter: user_filter(query))
|
29
|
+
if search.success?
|
30
|
+
ad_users += search.entries
|
31
|
+
else
|
32
|
+
errors += search.errors
|
33
|
+
end
|
23
34
|
end
|
24
35
|
|
25
|
-
|
26
|
-
|
27
|
-
result = Result.new(success: true, error_messages: [], ad_users: search.entries)
|
36
|
+
if errors.any?
|
37
|
+
return Result.new(success: false, error_messages: errors, ad_users: ad_users)
|
28
38
|
else
|
29
|
-
|
30
|
-
|
39
|
+
result = Result.new(success: true, error_messages: errors, ad_users: ad_users)
|
40
|
+
end
|
31
41
|
end
|
32
42
|
|
33
43
|
private
|
@@ -50,5 +60,13 @@ module Wobauth
|
|
50
60
|
filter += ")"
|
51
61
|
filter = Net::LDAP::Filter.construct(filter)
|
52
62
|
end
|
63
|
+
|
64
|
+
def ldap_options
|
65
|
+
if @ldap_options.kind_of? Hash
|
66
|
+
[@ldap_options]
|
67
|
+
else
|
68
|
+
@ldap_options
|
69
|
+
end
|
70
|
+
end
|
53
71
|
end
|
54
|
-
end
|
72
|
+
end
|
data/config/ldap.yml.example
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# simple
|
1
2
|
ldap_options:
|
2
3
|
host: 1.2.3.4
|
3
4
|
port: 3268
|
@@ -7,3 +8,34 @@ ldap_options:
|
|
7
8
|
username: myusername
|
8
9
|
password: mysecretpassword
|
9
10
|
|
11
|
+
# redundant: 1 directory with 2 redundant servers
|
12
|
+
ldap_options:
|
13
|
+
hosts:
|
14
|
+
- [1.2.3.4, 3269]
|
15
|
+
- [5.6.7.8, 3269]
|
16
|
+
encryption: :simple_tls
|
17
|
+
base: dc=example,dc=com
|
18
|
+
auth:
|
19
|
+
method: :simple
|
20
|
+
username: myusername
|
21
|
+
password: mysecretpassword
|
22
|
+
|
23
|
+
# multiple directories
|
24
|
+
ldap_options:
|
25
|
+
- host: 1.2.3.4
|
26
|
+
port: 3268
|
27
|
+
base: dc=example,dc=com
|
28
|
+
auth:
|
29
|
+
method: :simple
|
30
|
+
username: myusername
|
31
|
+
password: mysecretpassword
|
32
|
+
- host: 5.6.7.8
|
33
|
+
port: 3269
|
34
|
+
base: dc=example,dc=com
|
35
|
+
encryption: :simple_tls
|
36
|
+
auth:
|
37
|
+
method: :simple
|
38
|
+
username: myusername
|
39
|
+
password: mysecretpassword
|
40
|
+
|
41
|
+
|
data/lib/wobauth.rb
CHANGED
@@ -45,13 +45,18 @@ module Wobauth
|
|
45
45
|
config ||= Hash.new
|
46
46
|
|
47
47
|
if config['ldap_options'].present?
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
ldapopts = config['ldap_options']
|
49
|
+
if ldapopts.kind_of? Hash
|
50
|
+
ldapopts = [ldapopts]
|
51
|
+
end
|
52
|
+
ldapopts.each do |opts|
|
53
|
+
opts.symbolize_keys!
|
54
|
+
opts.each do |k,v|
|
55
|
+
opts[k] = opts[k].symbolize_keys if opts[k].kind_of? Hash
|
56
|
+
end
|
51
57
|
end
|
52
58
|
else
|
53
59
|
nil
|
54
60
|
end
|
55
61
|
end
|
56
|
-
|
57
62
|
end
|
data/lib/wobauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wobauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wolfgang Barth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|