class

LDAP::Client

Inherits Reference / Object

Constructors

new(socket, tls_context : OpenSSL::SSL::Context::Client | Nil = nil, max_message_size : Int32 = (16 * 1024) * 1024, timeout : Time::Span | Nil = nil)

max_message_size caps how many bytes the BER decoder will allocate or read for a single received message and its nested values, guarding against a hostile server forcing a huge allocation. Defaults to 16 MiB; 0 or a negative value disables the bound.

timeout bounds how long each operation waits for its response before raising TimeoutError. nil (the default) waits indefinitely. A timed-out operation drops its pending state and leaves the connection usable: any late data the server still streams for it is ignored. (The connection is not abandoned server-side — LDAP Abandon is a separate, future operation.)

Source

Instance methods

add(dn : String, attributes : Hash(String, Array(String))) : self

https://tools.ietf.org/html/rfc4511#section-4.7

Source
authenticate(username : String = "", password : String = "")
Source
close
Source
closed?
Source
compare(dn : String, attribute : String, value : String) : Bool

https://tools.ietf.org/html/rfc4511#section-4.10 Returns whether the entry's attribute holds the asserted value.

Source
delete(dn : String) : self

https://tools.ietf.org/html/rfc4511#section-4.8

Source
modify(dn : String, changes : Enumerable(Modification)) : self

https://tools.ietf.org/html/rfc4511#section-4.6

Source
modify_dn(dn : String, new_rdn : String, delete_old_rdn : Bool = true, new_superior : String | Nil = nil) : self

https://tools.ietf.org/html/rfc4511#section-4.9

Source
search(base : String, filter : Request::Filter | String = Request::Filter.equal("objectClass", "*"), scope : SearchScope = SearchScope::WholeSubtree, attributes : Enumerable(String) | Enumerable(Symbol) = [] of String, attributes_only : Bool = false, dereference : DereferenceAliases = DereferenceAliases::Always, size : Int = 0, time : Int = 0, sort : String | Request::SortControl | BER | Nil = nil) : Array(Entry)

Runs a search and returns the matching entries. Raises ReferralError (with any entries found + the referral URLs) when the result set is incomplete because it lives elsewhere; SearchLimitError (with the partial entries) on a server-side size/time/admin limit; OperationError on any other failure code.

Source
search(base : String, filter : Request::Filter | String = Request::Filter.equal("objectClass", "*"), scope : SearchScope = SearchScope::WholeSubtree, attributes : Enumerable(String) | Enumerable(Symbol) = [] of String, attributes_only : Bool = false, dereference : DereferenceAliases = DereferenceAliases::Always, size : Int = 0, time : Int = 0, sort : String | Request::SortControl | BER | Nil = nil, page_size : Int = 1000, & : Entry -> _) : Nil

Streaming, auto-paginated search (RFC 2696). Issues successive pages of at most page_size entries, yielding each Entry as it arrives; memory is bounded to one page. Raises ReferralError (with the referral URLs) when a page is a referral; SearchLimitError (with empty entries — matched entries were already yielded) on a server-side size/time/admin limit; OperationError on any other failure. Because entries stream as they arrive, a page's entries are yielded before its result code is inspected — so an OperationError on a later page may follow entries the caller has already received. Composes with sort.

Source
unbind

https://tools.ietf.org/html/rfc4511#section-4.3 Sends an UnbindRequest (which has no response) and closes the connection.

Source

Nested types