Exldap v0.1.0 Exldap

Summary

Functions

Shutdown a connection to the LDAP server

Connects to a LDAP server using the settings defined in config.exs

Connects to a LDAP server using the arguments passed into the function

Open a connection to the LDAP server using the settings defined in config.exs

Open a connection to the LDAP server

Searches a LDAP entry and extracts an attribute based on the specified key, if the attribute does not exist returns nil

Searches for a LDAP entry, the base dn is obtained from the config.exs

Searches for a LDAP entry using the arguments passed into the function

Verify the credentials against a LDAP connection

Functions

close(connection)

Shutdown a connection to the LDAP server

Example

iex> Exldap.close(connection)
connect()

Connects to a LDAP server using the settings defined in config.exs

Example

iex> Exldap.connect
{:ok, connection}
Or
{:error, error_description}
connect(server, port, ssl, user_dn, password)

Connects to a LDAP server using the arguments passed into the function

Example

iex> Exldap.connect("SERVERADDRESS", 636, true, "CN=test123,OU=Accounts,DC=example,DC=com", "PASSWORD")
{:ok, connection}
Or
{:error, error_description}
open()

Open a connection to the LDAP server using the settings defined in config.exs

Example

iex> Exldap.open
{:ok, connection}
Or
{:error, error_description}
open(server, port, ssl)

Open a connection to the LDAP server

Example

iex> Exldap.open("SERVERADDRESS", 636, true)
{:ok, connection}
Or
{:error, error_description}
search_attributes(entry, key)

Searches a LDAP entry and extracts an attribute based on the specified key, if the attribute does not exist returns nil

Example

iex> Exldap.search_attributes(first_result, "displayName")
"Test User"
search_field(connection, field, name)

Searches for a LDAP entry, the base dn is obtained from the config.exs

Example

iex> Exldap.search_field(connection, "cn", "useraccount")
{:ok, search_results}
search_field(connection, base, field, name)

Searches for a LDAP entry using the arguments passed into the function

Example

iex> Exldap.search_field(connection, "OU=Accounts,DC=example,DC=com", "cn", "useraccount")
{:ok, search_results}
verify_credentials(connection, user_dn, password)

Verify the credentials against a LDAP connection

Example

iex> Exldap.verify_credentials(connection, "CN=test123,OU=Accounts,DC=example,DC=com", "PASSWORD")
:ok --> Successfully connected
Or
{:error, :invalidCredentials} --> Failed to connect