public class JNDIConnectionImpl extends Object implements LDAPConnection
| Modifier and Type | Field and Description |
|---|---|
protected ConnectionData |
connectionData |
protected JNDIConnectionManager |
connectionManager |
protected static String |
LDAP_RETRY_ERROR |
protected LdapContext |
ldapConnection |
protected int |
maxRetries |
| Modifier and Type | Method and Description |
|---|---|
protected String |
appendRootDN(String base) |
void |
changePassword(DirContext ctx,
String argRDN,
String oldPassword,
String newPassword)
changes the user password
CAUTION: In order to change/modify password attr.
|
boolean |
checkPassword(String searchbase,
String login,
char[] plainPassword)
content of 'searchbase' will be filtered by the configured implementation of LDAPInputFilter (@see
ldap-spring.xml)
|
void |
close()
Close the LDAPConnection once the operation is performed.
|
protected byte[] |
encodePassword(String pass) |
JNDIConnectionManager |
getConnectionManager() |
LdapContext |
getCurrentInitialLdapContext()
Returns a handle to the currently active DirContext.
|
static Name |
getNameFromSearchResult(SearchResult iDirectoryEntry,
Name iBaseDN)
getNameFromSearchResult
Given a SearchResult object and Base DN, work out the complete DN of the entry, parse it into a Name object and
return it.
|
static Name |
getNameFromString(String iDN)
getNameFromString
Convert DN String into JNDI Name,
|
Collection<LDAPGenericObject> |
list(String searchbase)
returns the next level of a directory tree, returning a Enumeration of the results, *relative* to the SearchBase
(i.e.
|
protected Collection |
rawSearchBaseEntry(String searchbase,
String filter,
int limit,
int timeout,
String[] returnAttributes)
This is the core method for all base entry searches.
|
protected Collection<LDAPGenericObject> |
rawSearchOneLevel(String searchbase,
String filter,
int limit,
int timeout,
String[] returnAttributes)
Method that calls the actual search on the jndi context.
|
protected Collection<LDAPGenericObject> |
rawSearchSubTree(String searchbase,
String filter,
int limit,
int timeout,
String[] returnAttributes)
TODO parameter searchscope && followReferral !!!
|
Attributes |
read(String distinguishedName)
Reads all the attribute type and values for the given entry.
|
Attributes |
read(String distinguishedName,
String[] returnAttributes)
Reads all the attribute type and values for the given entry.
|
protected LdapContext |
retryConnection(Exception reasonForRetry) |
Collection |
searchBaseEntry(String searchbase,
String filter,
int limit,
int timeout)
Performs a base object search (i.e.
|
Collection |
searchBaseEntry(String searchbase,
String filter,
int limit,
int timeout,
String[] returnAttributes)
Performs a base object search (i.e.
|
Collection<LDAPGenericObject> |
searchOneLevel(String searchbase,
String filter,
int limit,
int timeout)
Performs a one-level directory search (i.e.
|
Collection<LDAPGenericObject> |
searchOneLevel(String searchbase,
String filter,
int limit,
int timeout,
String[] returnAttributes)
Performs a one-level directory search (i.e.
|
Collection<LDAPGenericObject> |
searchSubTree(String searchbase,
String filter,
int limit,
int timeout)
Performs a directory sub tree search (i.e.
|
Collection<LDAPGenericObject> |
searchSubTree(String searchbase,
String filter,
int limit,
int timeout,
String[] returnAttributes)
Performs a directory sub tree search (i.e.
|
boolean |
sendingEmptyBaseDNsearchQueries()
see PLA-11864
|
protected void |
wipePassword(char[] password,
Hashtable env) |
protected int maxRetries
protected LdapContext ldapConnection
protected final JNDIConnectionManager connectionManager
protected final ConnectionData connectionData
protected static final String LDAP_RETRY_ERROR
public boolean checkPassword(String searchbase, String login, char[] plainPassword)
checkPassword in interface LDAPConnectionprotected void wipePassword(char[] password,
Hashtable env)
public void close()
close in interface LDAPConnectionprotected LdapContext retryConnection(Exception reasonForRetry) throws LDAPUnavailableException, NamingException
public LdapContext getCurrentInitialLdapContext()
public Collection<LDAPGenericObject> searchOneLevel(String searchbase, String filter, int limit, int timeout) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchbase - the domain name (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchLDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Collection<LDAPGenericObject> searchOneLevel(String searchbase, String filter, int limit, int timeout, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchbase - the domain name (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchreturnAttributes - an array of strings containing the names of attributes to search. (null = all, empty array = none)LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionprotected Collection<LDAPGenericObject> rawSearchOneLevel(String searchbase, String filter, int limit, int timeout, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchbase - the domain name (relative to initial context in ldap) to seach from. content of 'searchbase' will be
filtered by the configured implementation of LDAPInputFilter (@see ldap-spring.xml)filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchreturnAttributes - an array of strings containing the names of attributes to search. (null = all, empty array = none)LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Collection<LDAPGenericObject> searchSubTree(String searchbase, String filter, int limit, int timeout) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchSubTree in interface LDAPConnectionsearchbase - the domain name (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchLDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Collection<LDAPGenericObject> searchSubTree(String searchbase, String filter, int limit, int timeout, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchSubTree in interface LDAPConnectionsearchbase - the domain name (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchreturnAttributes - an array of strings containing the names of attributes to search. (null = all, empty array = none)LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionprotected Collection<LDAPGenericObject> rawSearchSubTree(String searchbase, String filter, int limit, int timeout, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchbase - content of 'searchbase' will be filtered by the configured implementation of LDAPInputFilter (@see
ldap-spring.xml)filter - limit - timeout - returnAttributes - LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Collection searchBaseEntry(String searchbase, String filter, int limit, int timeout) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchBaseEntry in interface LDAPConnectionsearchbase - the domain name (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchLDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Collection searchBaseEntry(String searchbase, String filter, int limit, int timeout, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchBaseEntry in interface LDAPConnectionsearchbase - the domain name (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchreturnAttributes - an array of strings containing the names of attributes to search. (null = all, empty array = none)LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionprotected Collection rawSearchBaseEntry(String searchbase, String filter, int limit, int timeout, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
searchbase - the domain name (relative to initial context in ldap) to search from. content of 'searchbase' will be
filtered by the configured implementation of LDAPInputFilter (@see ldap-spring.xml)filter - the non-null filter to use for the searchlimit - the maximum number of results to returntimeout - the maximum time to wait before abandoning the searchreturnAttributes - an array of strings containing the names of attributes to search. (null = all, empty array = none)LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Attributes read(String distinguishedName) throws LDAPOperationException, LDAPUnavailableException, NamingException
read in interface LDAPConnectiondistinguishedName - the ldap string distinguished name of entry to be readLDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Attributes read(String distinguishedName, String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, NamingException
distinguishedName - the ldap string distinguished name of entry to be readreturnAttributes - a list of specific attributes to return.LDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic Collection<LDAPGenericObject> list(String searchbase) throws LDAPOperationException, LDAPUnavailableException, NamingException
WARNING - due to jndi wierdness, sometimes the entries are *not* relative, but are full DNs.
searchbase - the node in the tree to expandLDAPOperationExceptionLDAPUnavailableExceptionNamingExceptionpublic static Name getNameFromString(String iDN) throws NamingException
iDN - DN in String.NamingExceptionpublic static Name getNameFromSearchResult(SearchResult iDirectoryEntry, Name iBaseDN) throws InvalidNameException, NamingException
iDirectoryEntry - JNDI SearchResult object containing a Directory entry.iBaseDN - Name object with the Base DN used for the search (may be empty).InvalidNameExceptionNamingExceptionpublic void changePassword(DirContext ctx, String argRDN, String oldPassword, String newPassword) throws NamingException
changePassword in interface LDAPConnectionctx - directory contextargRDN - the name of the object whose attributes will be updatedoldPassword - newPassword - NamingExceptionprotected byte[] encodePassword(String pass) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic JNDIConnectionManager getConnectionManager()
public boolean sendingEmptyBaseDNsearchQueries()
Copyright © 2017 SAP SE. All Rights Reserved.