Class: Ddr::Auth::LdapGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/ddr/auth/ldap_gateway.rb

Defined Under Namespace

Classes: Result

Constant Summary collapse

SCOPE =
Net::LDAP::SearchScope_SingleLevel

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLdapGateway

Returns a new instance of LdapGateway.



17
18
19
# File 'lib/ddr/auth/ldap_gateway.rb', line 17

def initialize
  @ldap = Net::LDAP.new(config)
end

Instance Attribute Details

#ldapObject (readonly)

Returns the value of attribute ldap.



11
12
13
# File 'lib/ddr/auth/ldap_gateway.rb', line 11

def ldap
  @ldap
end

Class Method Details

.find(user_key) ⇒ Object



13
14
15
# File 'lib/ddr/auth/ldap_gateway.rb', line 13

def self.find(user_key)
  new.find(user_key)
end

Instance Method Details

#find(user_key) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/ddr/auth/ldap_gateway.rb', line 21

def find(user_key)
  result_set = ldap.search find_params(user_key)
  if result_set
    Result.new result_set.first
  else
    raise ldap.get_operation_result.message
  end
end