Class: KU::LDAP::Directory
- Inherits:
-
Object
- Object
- KU::LDAP::Directory
- Defined in:
- lib/ku/ldap/directory.rb
Instance Method Summary collapse
- #authenticate(base, filter, password) ⇒ Object
- #first(base, filter) ⇒ Object
-
#initialize(service) ⇒ Directory
constructor
A new instance of Directory.
- #search(base, filter) ⇒ Object
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 |