public class LDAPMapper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected LDAPConfiguration |
conf |
static java.lang.String |
END_OF_RANGE
The character indicating that the end of the range has been reached.
|
protected boolean |
isConnected |
protected com.unboundid.ldap.sdk.LDAPException |
lastException |
protected com.unboundid.ldap.sdk.LDAPConnection |
ldc |
static java.lang.String |
RANGE_FORMAT
The format used to calculate attribute IDs for subsequent searches.
|
static java.util.regex.Pattern |
RANGE_PATTERN
The pattern matching the range attribute ID.
|
static java.lang.String |
RANGE_PATTERN_STRING
The expression matching the range attribute ID "
|
static java.lang.String |
REVISION |
protected com.unboundid.ldap.sdk.RootDSE |
rootDSE |
Constructor and Description |
---|
LDAPMapper(LDAPConfiguration conf)
Creates a new mapper and establish the connection using given
LDAPConfiguration . |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(java.lang.String dn,
java.lang.String password)
Try to establish a new connection and to authenticate to the ldap server
specified in the
LDAPConfiguration of this mapper, using the
given dn connect and password. |
void |
disconnect()
Disconnect the underlying LDAPConnection of this mapper.
|
com.unboundid.ldap.sdk.SearchResultEntry |
getGroupLDAPEntryFromDN(java.lang.String fullDN,
java.lang.String[] attrs)
Retrieve a Group entry from its exact DN.
|
com.unboundid.ldap.sdk.SearchResultEntry |
getGroupLDAPEntryFromGUID(java.lang.String guidStr,
java.lang.String[] attrs)
Retrieve a Group entry from its GUID.
|
java.util.ArrayList<com.unboundid.ldap.sdk.SearchResultEntry> |
getGroupsLDAPEntries(java.lang.String dn,
java.lang.String[] attrs)
Return the groups LDAP Entry for the given dn (dn of a user or a sub-group).
|
com.unboundid.ldap.sdk.LDAPException |
getLastException() |
LDAPConfiguration |
getLDAPConfiguration()
Retrieve the LDAPConfiguration object associated to this Mapper.
|
com.unboundid.ldap.sdk.LDAPConnection |
getLDAPConnection()
Returns the
LDAPConnection instance initialized during the construction
of this LDAPMapper . |
java.util.ArrayList<com.unboundid.ldap.sdk.SearchResultEntry> |
getMatchingLDAPEntries(java.lang.String baseDN,
java.lang.String searchFilter,
java.lang.String[] attrs)
Return the matching LDAP Entries.
|
java.util.ArrayList<com.unboundid.ldap.sdk.SearchResultEntry> |
getMatchingLDAPEntries(java.lang.String baseDN,
java.lang.String searchFilter,
java.lang.String[] attrs,
java.lang.String[] sortKeys)
Return the matching LDAP Entries.
|
java.util.List<java.lang.String> |
getRangedAttributeStringValues(com.unboundid.ldap.sdk.SearchResultEntry entry,
java.lang.String attributeName)
Retrieve all values of the specified attribute, even if attribute is a ranged attribute of ActiveDirectory.
|
com.unboundid.ldap.sdk.RootDSE |
getRootDSE()
Retrieves the directory server root DSE, which provides information about the
directory server, including the capabilities that it provides and the type of
data that it is configured to handle.
|
com.unboundid.ldap.sdk.SearchResultEntry |
getUserLDAPEntry(java.lang.String login,
java.lang.String[] attrs)
Return the first matching LDAP Entry for the given login.
|
com.unboundid.ldap.sdk.SearchResultEntry |
getUserLDAPEntryFromDN(java.lang.String fullDN,
java.lang.String[] attrs)
Retrieve a User entry from its exact DN.
|
java.util.List<com.unboundid.ldap.sdk.SearchResultEntry> |
getUsersLDAPEntries(java.lang.String[] sortKeys,
java.lang.String[] attrs)
Retrieve all user SearchResultEntry matching current configuration.
|
boolean |
isConnected() |
public static final java.lang.String REVISION
protected final LDAPConfiguration conf
protected final com.unboundid.ldap.sdk.LDAPConnection ldc
protected boolean isConnected
protected com.unboundid.ldap.sdk.RootDSE rootDSE
protected com.unboundid.ldap.sdk.LDAPException lastException
public static final java.lang.String END_OF_RANGE
public static final java.lang.String RANGE_FORMAT
public static final java.lang.String RANGE_PATTERN_STRING
public static final java.util.regex.Pattern RANGE_PATTERN
public LDAPMapper(LDAPConfiguration conf)
LDAPConfiguration
. disconnect()
when finished with this mapper. getLastException()
conf
- the LDAPConfiguration to use for this mapperpublic com.unboundid.ldap.sdk.SearchResultEntry getUserLDAPEntry(java.lang.String login, java.lang.String[] attrs)
LDAPConfiguration.getSuffix()
(search baseDN)
- LDAPConfiguration.getUserFilter()
(search filter)login
- the login of the member of which to retrieve SearchResultEntry.attrs
- attributes you want returned in the result.getLastException()
.
A warning message is logged if more than one entries have been found (in
which case you should refine your user search filter).public com.unboundid.ldap.sdk.SearchResultEntry getUserLDAPEntryFromDN(java.lang.String fullDN, java.lang.String[] attrs)
This method differs from the LDAPConnection.getEntry(String, String[])
because it
will apply the user filter configured in JCMS (LDAPConfiguration.getUserFilter()
fullDN
- the DN of the User entry to retrieveattrs
- attributes you want returned in the result entry.public java.util.List<com.unboundid.ldap.sdk.SearchResultEntry> getUsersLDAPEntries(java.lang.String[] sortKeys, java.lang.String[] attrs)
This implementation does not scale to thousands users/groups and may consume lot of memory as all LDAP user entry are retrieved at once from the LDAP.
sortKeys
- the LDAP attribute names to use for sorting of LDAP entry, eg "cn"
attrs
- attributes you want returned in the result entry.public java.util.ArrayList<com.unboundid.ldap.sdk.SearchResultEntry> getGroupsLDAPEntries(java.lang.String dn, java.lang.String[] attrs)
LDAPConfiguration.getGroupSuffix()
(search baseDN)
- LDAPConfiguration.getGroupFilter()
(search filter)dn
- the dn of the user of which to retrieve groups' SearchResultEntry.attrs
- attributes you want returned in the result.getLastException()
.public com.unboundid.ldap.sdk.SearchResultEntry getGroupLDAPEntryFromDN(java.lang.String fullDN, java.lang.String[] attrs)
This method differs from the LDAPConnection.getEntry(String, String[])
because it
will apply the group filter configured in JCMS (LDAPConfiguration.getGroupFilter()
fullDN
- the DN of the Group entry to retrieveattrs
- attributes you want returned in the result entry.public com.unboundid.ldap.sdk.SearchResultEntry getGroupLDAPEntryFromGUID(java.lang.String guidStr, java.lang.String[] attrs)
This method applie the group filter configured in JCMS (LDAPConfiguration.getGroupFilter()
guidStr
- the 16-byte string representation of a the group GUID
.attrs
- attributes you want returned in the result entry.public java.util.ArrayList<com.unboundid.ldap.sdk.SearchResultEntry> getMatchingLDAPEntries(java.lang.String baseDN, java.lang.String searchFilter, java.lang.String[] attrs)
baseDN
- the base distinguished name from which to searchsearchFilter
- the searchFilter to use for with method LDAPConnection.search(String, SearchScope, String, String...)
attrs
- attributes you want returned in the result.LDAPException
is available using getLastException()
if error occured during search.public java.util.ArrayList<com.unboundid.ldap.sdk.SearchResultEntry> getMatchingLDAPEntries(java.lang.String baseDN, java.lang.String searchFilter, java.lang.String[] attrs, java.lang.String[] sortKeys)
baseDN
- the base distinguished name from which to searchsearchFilter
- the searchFilter to use for with method LDAPConnection.search(String, SearchScope, String, String...)
attrs
- attributes you want returned in the result.sortKeys
- the LDAP attribute names to use for sorting of LDAP entry, eg "cn"
LDAPException
is available using getLastException()
if error occured during search.public java.util.List<java.lang.String> getRangedAttributeStringValues(com.unboundid.ldap.sdk.SearchResultEntry entry, java.lang.String attributeName)
If the specified attribute is a ranged attribute of ActiveDirectory, perform the appropriate computation and new LDAP queries to ensure all attribute's values are retrieved.
entry
- the entry in which LDAPAttribute was retrieved (must not be null)attributeName
- the name of the attribute to retrieve (must not be null, may be ranged or not)public boolean authenticate(java.lang.String dn, java.lang.String password)
LDAPConfiguration
of this mapper, using the
given dn connect and password.
Disconnect immediately.dn
- the dn to use to try aupassword
- the password to use for authentication.getLastException()
public LDAPConfiguration getLDAPConfiguration()
public com.unboundid.ldap.sdk.LDAPException getLastException()
public com.unboundid.ldap.sdk.LDAPConnection getLDAPConnection()
LDAPConnection
instance initialized during the construction
of this LDAPMapper
. isConnected()
. LDAPConnection.close()
method
of the returned LDAPConnection object, instead, call the disconnect()
method of this LDAPMapper
.public boolean isConnected()
public com.unboundid.ldap.sdk.RootDSE getRootDSE()
Retrieved once and cached for the duration of the connexion, not available until connexion is successful.
public void disconnect()
Copyright © 2001-2017 Jalios SA. All Rights Reserved.