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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c01bbebd11eecd763d3f342295ab3acf83c22f81
4
- data.tar.gz: dc8d3aa3004de6e0b53d42b66797acd5caf60171
3
+ metadata.gz: 549b103ab3916c49f5b02fdeab980a9f5ffe377d
4
+ data.tar.gz: eb5b16e94d4c2d67fe70bc694645b6b2dd7b083c
5
5
  SHA512:
6
- metadata.gz: f3f23282aab6d3e5e104153104034082084dd52ba6447f31f07b6578408eca2597f0015c75451ee9c6697730959bc31ec9894891290439d8810038767572ffba
7
- data.tar.gz: 576cb4eef2e719583be6ad1591cde2f9684d51f3abbe431c90a5db6dfd5db78e6dd42658f2834274a837028bcbddc4cda3feb323a368d884becd3875d7f0613f
6
+ metadata.gz: bdc004b49b6b64b798be4739c34a36c585d95730adce06a5ee9e9679b336199fb90626d998cf6f739765cde35de0c431efb03494799b8e9008ebc2589da6e069
7
+ data.tar.gz: 4825eea113602ae195556f86dedb52e35325f088644a00ce58bba4110c3d757ee36a11d664e260ab0a73f3dadcef1059e245519f70e75ee7fe17469ecd1562a3
@@ -1,19 +1,21 @@
1
- require "blueauth/version"
2
- require "blueauth/error"
1
+ require 'blueauth/version'
2
+ require 'blueauth/error'
3
3
  require 'net-ldap'
4
4
 
5
5
  module Blueauth
6
6
 
7
- Net::LDAP::LDAPControls::PAGED_RESULTS = FALSE
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
- BPHOST = "bluepages.ibm.com"
10
- BGHOST = "bluegroups.ibm.com"
11
- BPBASE = "ou=bluepages,o=ibm.com"
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 id, password
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 id
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
- case c
53
- when 1
54
- id = 'CN='+part
55
- when email_parts.count
56
- id = id + '/O='+part
57
- else
58
- id = id + '/OU='+part
59
- end
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 dn
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
 
@@ -1,3 +1,3 @@
1
1
  module Blueauth
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
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: 2016-05-24 00:00:00.000000000 Z
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.4.5.1
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