Class: KU::LDAP::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/ku/ldap/directory.rb

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ Directory

Returns a new instance of Directory.



5
6
7
8
# File 'lib/ku/ldap/directory.rb', line 5

def initialize service
  @service = service
  @service.authenticate *credentials if credentials
end

Instance Method Details

#authenticate(base, filter, password) ⇒ Object



18
19
20
# File 'lib/ku/ldap/directory.rb', line 18

def authenticate base, filter, password
  @service.bind_as(base: base, filter: filter, password: password)
end

#first(base, filter) ⇒ Object



10
11
12
# File 'lib/ku/ldap/directory.rb', line 10

def first base, filter
  search(base, filter).first if @service.bind
end

#search(base, filter) ⇒ Object



14
15
16
# File 'lib/ku/ldap/directory.rb', line 14

def search base, filter
  @service.search(base: base, filter: filter)
end