Myna.Ldap

Represents a connection to an LDAP server

Summary
Myna.LdapRepresents a connection to an LDAP server
Functions
LdapContructs a new Ldap connection
searchSearches an LDAP repository
lookupSearches an LDAP repository for a specific entry

Functions

Ldap

Myna.Ldap = function(server,
username,
password,
acceptSelfSignedCerts)

Contructs a new Ldap connection

Parameters

serverREQUIRED Server and initial subtree to connect to.
ldap://server.yourdomain.com:389/o=top,ou=people
ldaps://server.yourdomain.com:636/o=top,ou=people
usernameOptional default null* Fully qualified username to log in as
cn=name,ou=department,o=ldap_root
mporter@health
passwordOptional default null password for user
acceptSelfSignedCertsOptional default true By default secure ldap connections will accept self-signed certs.  Set this to false to throw an exception.

Notes

If an AD style username is used (username@domain) then Active Directory paging mode is enabled.  This means that searches will be performed continuously over all pages until all results are gathered

search

Myna.Ldap.prototype.search=function(searchString,
attributes,
maxRows)

Searches an LDAP repository

Parameters

searchStringREQUIRED search to perform
(cn=mporter)
(&(orgcode=01018346)(positioncode=80569))
attributesOptional default null a comma separated list of attributes to retrieve from the ldap server.  If not specified, all attributes are returned Returns: An array of ldap results that looks like this
result = (Array)
|
+--[0] = (Object)
|
+-- name = (String) fully qualified name of result node
|
+-- attributes = (Object)
|
+--<attribute name> = (Array)
|
+--[0] = (String)

lookup

Myna.Ldap.prototype.lookup=function(dn)

Searches an LDAP repository for a specific entry

Parameters

dnREQUIRED full DN of target node, relative to initial context
cn=mporter,ou=users
attributesOptional default null a comma separated list of attributes to retrieve from the ldap server.  If not specified, all attributes are returned Returns: if not found, throws javax.naming.NameNotFoundException

If found, returns a single ldap result that looks like this

result = (Object)
|
+-- name = (String) fully qualified name of result node
|
+-- attributes = (Object)
|
+--<attribute name> = (Array)
|
+--[0] = (String)
Myna.Ldap = function(server,
username,
password,
acceptSelfSignedCerts)
Contructs a new Ldap connection
Myna.Ldap.prototype.search=function(searchString,
attributes,
maxRows)
Searches an LDAP repository
Myna.Ldap.prototype.lookup=function(dn)
Searches an LDAP repository for a specific entry