public final class LdapClient extends Object
Modifier and Type | Field and Description |
---|---|
static Option<TransactionId> |
TRANSACTIONID_OPTION
The option to pass the TransactionId to LdapConnection.
|
Modifier and Type | Method and Description |
---|---|
LdapConnection |
connect(String host,
int port)
Returns an LDAP connection for the specified LDAP server.
|
LdapConnection |
connect(String host,
int port,
Options options)
Returns an LDAP connection for the specified LDAP server using the
provided LDAP options.
|
static Options |
defaultOptions(Context context)
Setup the default options to create a LdapClient and adds the transactionId if any in the context's chain.
|
String |
dn(String template,
Object... attributeValues)
Formats an LDAP distinguished name using the provided template and
attribute values.
|
String |
filter(String template,
Object... assertionValues)
Formats an LDAP filter using the provided template and assertion values.
|
protected void |
finalize() |
static LdapClient |
getInstance()
Returns the unique instance of an
LdapClient . |
Map<String,SearchScope> |
getScope()
Returns the
SearchScope available. |
public static final Option<TransactionId> TRANSACTIONID_OPTION
public static LdapClient getInstance()
LdapClient
.LdapClient
.public static Options defaultOptions(Context context)
context
- the context's chainpublic Map<String,SearchScope> getScope()
SearchScope
available.SearchScope
available.public LdapConnection connect(String host, int port) throws LdapException
host
- The LDAP server host name.port
- The LDAP server port.LdapException
- If an error occurred while connecting to the LDAP server.public LdapConnection connect(String host, int port, Options options) throws LdapException
NOTE: if a connection has already been obtained to the specified LDAP server then a cached connection will be returned and the LDAP options will be ignored.
host
- The LDAP server host name.port
- The LDAP server port.options
- The LDAP options.LdapException
- If an error occurred while connecting to the LDAP server.public String dn(String template, Object... attributeValues)
template
- The DN template.attributeValues
- The attribute values to be substituted into the template.DN
.org.forgerock.i18n.LocalizedIllegalArgumentException
- If the formatted template is not a valid LDAP string
representation of a DN.Dn.format(String, Object...)
public String filter(String template, Object... assertionValues)
template
- The filter template.assertionValues
- The assertion values to be substituted into the template.Filter
.org.forgerock.i18n.LocalizedIllegalArgumentException
- If the formatted template is not a valid LDAP string
representation of a filter.Filter.format(String, Object...)
Copyright 2011-2017 ForgeRock AS.