public class JNDIConnectionImpl extends java.lang.Object implements LDAPConnection
| Modifier and Type | Field and Description |
|---|---|
protected ConnectionData |
connectionData |
protected JNDIConnectionManager |
connectionManager |
protected static java.lang.String |
LDAP_RETRY_ERROR |
protected javax.naming.ldap.LdapContext |
ldapConnection |
protected int |
maxRetries |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
appendRootDN(java.lang.String base) |
void |
changePassword(javax.naming.directory.DirContext ctx,
java.lang.String argRDN,
java.lang.String oldPassword,
java.lang.String newPassword)
changes the user password
CAUTION: In order to change/modify password attr.
|
boolean |
checkPassword(java.lang.String searchbase,
java.lang.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(java.lang.String pass) |
JNDIConnectionManager |
getConnectionManager() |
javax.naming.ldap.LdapContext |
getCurrentInitialLdapContext()
Returns a handle to the currently active DirContext.
|
static javax.naming.Name |
getNameFromSearchResult(javax.naming.directory.SearchResult iDirectoryEntry,
javax.naming.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 javax.naming.Name |
getNameFromString(java.lang.String iDN)
getNameFromString
Convert DN String into JNDI Name,
|
java.util.Collection<LDAPGenericObject> |
list(java.lang.String searchbase)
returns the next level of a directory tree, returning a Enumeration of the results, *relative* to the SearchBase
(i.e.
|
protected java.util.Collection |
rawSearchBaseEntry(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
This is the core method for all base entry searches.
|
protected java.util.Collection<LDAPGenericObject> |
rawSearchOneLevel(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
Method that calls the actual search on the jndi context.
|
protected java.util.Collection<LDAPGenericObject> |
rawSearchSubTree(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
TODO parameter searchscope && followReferral !!!
|
javax.naming.directory.Attributes |
read(java.lang.String distinguishedName)
Reads all the attribute type and values for the given entry.
|
javax.naming.directory.Attributes |
read(java.lang.String distinguishedName,
java.lang.String[] returnAttributes)
Reads all the attribute type and values for the given entry.
|
protected javax.naming.ldap.LdapContext |
retryConnection(java.lang.Exception reasonForRetry) |
java.util.Collection |
searchBaseEntry(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout)
Performs a base object search (i.e.
|
java.util.Collection |
searchBaseEntry(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
Performs a base object search (i.e.
|
java.util.Collection<LDAPGenericObject> |
searchOneLevel(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout)
Performs a one-level directory search (i.e.
|
java.util.Collection<LDAPGenericObject> |
searchOneLevel(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
Performs a one-level directory search (i.e.
|
java.util.Collection<LDAPGenericObject> |
searchSubTree(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout)
Performs a directory sub tree search (i.e.
|
java.util.Collection<LDAPGenericObject> |
searchSubTree(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
Performs a directory sub tree search (i.e.
|
boolean |
sendingEmptyBaseDNsearchQueries()
see PLA-11864
|
protected void |
wipePassword(char[] password,
java.util.Hashtable env) |
protected int maxRetries
protected javax.naming.ldap.LdapContext ldapConnection
protected final JNDIConnectionManager connectionManager
protected final ConnectionData connectionData
protected static final java.lang.String LDAP_RETRY_ERROR
public boolean checkPassword(java.lang.String searchbase,
java.lang.String login,
char[] plainPassword)
checkPassword in interface LDAPConnectionprotected java.lang.String appendRootDN(java.lang.String base)
protected void wipePassword(char[] password,
java.util.Hashtable env)
public void close()
close in interface LDAPConnectionprotected javax.naming.ldap.LdapContext retryConnection(java.lang.Exception reasonForRetry)
throws LDAPUnavailableException,
javax.naming.NamingException
LDAPUnavailableExceptionjavax.naming.NamingExceptionpublic javax.naming.ldap.LdapContext getCurrentInitialLdapContext()
public java.util.Collection<LDAPGenericObject> searchOneLevel(java.lang.String searchbase, java.lang.String filter, int limit, int timeout) throws LDAPOperationException, LDAPUnavailableException, javax.naming.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 searchLDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic java.util.Collection<LDAPGenericObject> searchOneLevel(java.lang.String searchbase, java.lang.String filter, int limit, int timeout, java.lang.String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, javax.naming.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)LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionprotected java.util.Collection<LDAPGenericObject> rawSearchOneLevel(java.lang.String searchbase, java.lang.String filter, int limit, int timeout, java.lang.String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, javax.naming.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)LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic java.util.Collection<LDAPGenericObject> searchSubTree(java.lang.String searchbase, java.lang.String filter, int limit, int timeout) throws LDAPOperationException, LDAPUnavailableException, javax.naming.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 searchLDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic java.util.Collection<LDAPGenericObject> searchSubTree(java.lang.String searchbase, java.lang.String filter, int limit, int timeout, java.lang.String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, javax.naming.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)LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionprotected java.util.Collection<LDAPGenericObject> rawSearchSubTree(java.lang.String searchbase, java.lang.String filter, int limit, int timeout, java.lang.String[] returnAttributes) throws LDAPOperationException, LDAPUnavailableException, javax.naming.NamingException
searchbase - content of 'searchbase' will be filtered by the configured implementation of LDAPInputFilter (@see
ldap-spring.xml)filter - limit - timeout - returnAttributes - LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic java.util.Collection searchBaseEntry(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout)
throws LDAPOperationException,
LDAPUnavailableException,
javax.naming.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 searchLDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic java.util.Collection searchBaseEntry(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
throws LDAPOperationException,
LDAPUnavailableException,
javax.naming.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)LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionprotected java.util.Collection rawSearchBaseEntry(java.lang.String searchbase,
java.lang.String filter,
int limit,
int timeout,
java.lang.String[] returnAttributes)
throws LDAPOperationException,
LDAPUnavailableException,
javax.naming.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)LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic javax.naming.directory.Attributes read(java.lang.String distinguishedName)
throws LDAPOperationException,
LDAPUnavailableException,
javax.naming.NamingException
read in interface LDAPConnectiondistinguishedName - the ldap string distinguished name of entry to be readLDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic javax.naming.directory.Attributes read(java.lang.String distinguishedName,
java.lang.String[] returnAttributes)
throws LDAPOperationException,
LDAPUnavailableException,
javax.naming.NamingException
distinguishedName - the ldap string distinguished name of entry to be readreturnAttributes - a list of specific attributes to return.LDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic java.util.Collection<LDAPGenericObject> list(java.lang.String searchbase) throws LDAPOperationException, LDAPUnavailableException, javax.naming.NamingException
WARNING - due to jndi wierdness, sometimes the entries are *not* relative, but are full DNs.
searchbase - the node in the tree to expandLDAPOperationExceptionLDAPUnavailableExceptionjavax.naming.NamingExceptionpublic static javax.naming.Name getNameFromString(java.lang.String iDN)
throws javax.naming.NamingException
iDN - DN in String.javax.naming.NamingExceptionpublic static javax.naming.Name getNameFromSearchResult(javax.naming.directory.SearchResult iDirectoryEntry,
javax.naming.Name iBaseDN)
throws javax.naming.InvalidNameException,
javax.naming.NamingException
iDirectoryEntry - JNDI SearchResult object containing a Directory entry.iBaseDN - Name object with the Base DN used for the search (may be empty).javax.naming.InvalidNameExceptionjavax.naming.NamingExceptionpublic void changePassword(javax.naming.directory.DirContext ctx,
java.lang.String argRDN,
java.lang.String oldPassword,
java.lang.String newPassword)
throws javax.naming.NamingException
changePassword in interface LDAPConnectionctx - directory contextargRDN - the name of the object whose attributes will be updatedoldPassword - newPassword - javax.naming.NamingExceptionprotected byte[] encodePassword(java.lang.String pass)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic JNDIConnectionManager getConnectionManager()
public boolean sendingEmptyBaseDNsearchQueries()
Copyright © 2018 SAP SE. All Rights Reserved.