blueauth 0.0.8 → 0.0.9
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/lib/blueauth.rb +21 -20
- data/lib/blueauth/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549b103ab3916c49f5b02fdeab980a9f5ffe377d
|
4
|
+
data.tar.gz: eb5b16e94d4c2d67fe70bc694645b6b2dd7b083c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc004b49b6b64b798be4739c34a36c585d95730adce06a5ee9e9679b336199fb90626d998cf6f739765cde35de0c431efb03494799b8e9008ebc2589da6e069
|
7
|
+
data.tar.gz: 4825eea113602ae195556f86dedb52e35325f088644a00ce58bba4110c3d757ee36a11d664e260ab0a73f3dadcef1059e245519f70e75ee7fe17469ecd1562a3
|
data/lib/blueauth.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'blueauth/version'
|
2
|
+
require 'blueauth/error'
|
3
3
|
require 'net-ldap'
|
4
4
|
|
5
5
|
module Blueauth
|
6
6
|
|
7
|
-
|
7
|
+
BPHOST = 'bluepages.ibm.com'
|
8
|
+
BGHOST = 'bluegroups.ibm.com'
|
9
|
+
BPBASE = 'ou=bluepages,o=ibm.com'
|
10
|
+
BGBASE = 'ou=memberlist,ou=ibmgroups,o=ibm.com'
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
BGBASE = "ou=memberlist,ou=ibmgroups,o=ibm.com"
|
12
|
+
old_verbose, $VERBOSE = $VERBOSE, nil
|
13
|
+
Net::LDAP::LDAPControls::PAGED_RESULTS = FALSE
|
14
|
+
$VERBOSE = old_verbose
|
13
15
|
|
14
16
|
# using this method a user can be authenticated
|
15
17
|
# Intraned ID, password are mandatory
|
16
|
-
def self.authenticate
|
18
|
+
def self.authenticate(id, password)
|
17
19
|
ldap = Net::LDAP.new host: BPHOST, port: 636, base: BPBASE, :encryption => :simple_tls
|
18
20
|
user = search id.strip
|
19
21
|
unless user.nil?
|
@@ -39,7 +41,7 @@ module Blueauth
|
|
39
41
|
# - Common name (none of the previous two)
|
40
42
|
# return object contains
|
41
43
|
# :name, :country, :intranetid, :dn
|
42
|
-
def self.search
|
44
|
+
def self.search(id)
|
43
45
|
ldap = Net::LDAP.new host: BPHOST, port: 636, base: BPBASE, :encryption => :simple_tls
|
44
46
|
if id.include? '@'
|
45
47
|
searchfield = 'mail'
|
@@ -49,14 +51,15 @@ module Blueauth
|
|
49
51
|
id = ''
|
50
52
|
c = 1
|
51
53
|
email_parts.each do |part|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
id =
|
55
|
+
case c
|
56
|
+
when 1
|
57
|
+
'CN='+part
|
58
|
+
when email_parts.count
|
59
|
+
id + '/O='+part
|
60
|
+
else
|
61
|
+
id + '/OU='+part
|
62
|
+
end
|
60
63
|
c += 1
|
61
64
|
end
|
62
65
|
else
|
@@ -75,11 +78,10 @@ module Blueauth
|
|
75
78
|
user = user_array.first
|
76
79
|
result = {name: user.cn.first, country: user.co.first, intranetid: user.preferredidentity.first, dn: user.dn}
|
77
80
|
end
|
78
|
-
|
79
81
|
return result
|
80
82
|
end
|
81
83
|
|
82
|
-
def self.bluegroups
|
84
|
+
def self.bluegroups(dn)
|
83
85
|
result = []
|
84
86
|
bg = Net::LDAP.new host: BPHOST, port: 636, base: BGBASE, :encryption => :simple_tls
|
85
87
|
bgf = Net::LDAP::Filter.eq('uniquemember', dn)
|
@@ -89,7 +91,6 @@ module Blueauth
|
|
89
91
|
rescue => e
|
90
92
|
raise Blueauth::BlueError, "BlueGroup Search issue -> #{e.message}"
|
91
93
|
end
|
92
|
-
|
93
94
|
return result
|
94
95
|
end
|
95
96
|
|
data/lib/blueauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zoltan-izso
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ldap
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.6.8
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Bluepages Authentication for IBMers within IBM's Intranet
|