public class LDAPDirectory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT |
static java.lang.String |
ENTRY_UUID |
static java.lang.String |
LDAP_MAX_RESULT_KEY |
static java.lang.String |
LDAPCONTROL_CLASS |
static int |
SCOPE_BASE |
static int |
SCOPE_ONE |
static int |
SCOPE_SUB |
Constructor and Description |
---|
LDAPDirectory()
Deprecated.
use getDefaultInstance() API
|
LDAPDirectory(LDAPConnection connection)
Create an LDAP proxy that can use the connection object.
|
LDAPDirectory(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password)
Create an LDAP proxy to the specified host, on the specified port, and authenticate to
it using the username and password
|
LDAPDirectory(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
Cache cache)
Deprecated.
use LDAPDirectory(String host, int port, String user, String password).
|
Modifier and Type | Method and Description |
---|---|
void |
add(LDAPEntry entry)
Deprecated.
this method does not allow passing a active user identity. Use LDAPManipulator instead.
|
void |
clearCache() |
void |
delete(java.lang.String dn)
Deprecated.
this method does not allow passing a active user identity. Use LDAPManipulator instead.
|
protected void |
finalize() |
java.lang.String |
findSOAPNode(java.lang.String namespace,
java.lang.String method)
Searches for a SOAP node within the default organizational context that
can execute the method of the namespace.
|
java.lang.String |
findSOAPNode(java.lang.String organizationalContext,
java.lang.String namespace,
java.lang.String method)
Searches for a SOAP node within the specified organizational context that
can execute the method of the namespace.
|
java.util.Map<java.lang.String,java.lang.String> |
getAllRolesOfUser(java.lang.String organizationalUserDN) |
java.util.Map<java.lang.String,java.lang.String> |
getAssignedRolesOfUser(java.lang.String organizationalUserDN)
Get AssignedRoles (including inherited) of a user.
|
LDAPEntry |
getAuthenticationUser()
Returns the aunthenticated user entry from the LDAP of the currently logged in user
|
LDAPEntry |
getAuthenticationUser(java.lang.String osId) |
Cache |
getCache()
Returns the internal Cache object used by this directory.
|
java.lang.String |
getCacheStatistics() |
LDAPConnection |
getConnection()
Returns the actual connection to ldap.
|
static LDAPDirectory |
getDefaultInstance()
Returns the default LDAP proxy to the host that is specified in the
environment settings.
|
static int |
getDefaultMaximumSearchResults()
Get the default maximum search results from LDAP.
|
java.lang.String |
getDirectorySearchRoot()
Returns the default search root.
|
LDAPEntry |
getEntry(java.lang.String name)
If
name is a Distinguished Name, a LDAPConnection.read() on this name is done. |
java.lang.String |
getOrganization()
Returns the current organizational context.
|
java.lang.String |
getOrganizationalUser()
Returns the organizational user entry for the currently logged on user
|
java.lang.String |
getOrganizationalUser(java.lang.String osId) |
java.util.Map<java.lang.String,java.lang.String> |
getRolesOfUser(java.lang.String organizationalUserDN)
Deprecated.
|
java.lang.String[] |
getURIs(java.lang.String name)
Retrieves all URIs on which the SOAP Node that is registered for this name may be listening
|
java.lang.String |
getUUID(LDAPEntry entry)
Get the UUID of this LDAPEntry.
|
static void |
initializeBootstrapFileTrigger() |
boolean |
isSOAPConnection()
Check if the directory is connected directly to the LDAP server or uses the LDAP SOAP Processor
|
void |
modify(LDAPEntry newEntry)
Deprecated.
this method does not allow passing a active user identity. Use LDAPManipulator instead.
|
LDAPEntry |
read(java.lang.String dn)
Method internally calls the LDAPConnection.read, but uses an internal cache
|
LDAPEntry |
readWithUUID(java.lang.String searchRoot,
java.lang.String uuid)
Search LDAP for an entry with this uuid.
|
void |
report()
Deprecated.
this method doesn't do anything anymore.
|
void |
returnCookieConnection(java.lang.String cookie)
Release LDAP Connection with cookie argument in LDAP Connection pool
|
LDAPEntry[] |
search(java.lang.String dn,
int scope,
java.lang.String filter,
java.lang.String[] attributes,
boolean returnValues)
It sends request to LDAP SOAP processor or LDAP Server based on LDAPDirectory instance to get the results.
|
LDAPEntry[] |
search(java.lang.String dn,
int scope,
java.lang.String filter,
java.lang.String[] attributes,
boolean returnValues,
LDAPSearchConstraints cons)
It sends request to LDAP SOAP processor or LDAP Server based on LDAPDirectory instance to get the results.
|
java.lang.String |
search(java.lang.String dn,
int scope,
java.lang.String filter,
java.lang.String[] attributes,
boolean returnValues,
java.lang.String cookie,
java.util.ArrayList<LDAPEntry> list)
Serach LDAP Entries with the help of Cursor
|
DirectorySearchResults |
searchResults(java.lang.String dn,
int scope,
java.lang.String filter,
java.lang.String[] attributes,
boolean returnValues)
It sends request to LDAP SOAP processor or LDAP Server based on LDAPDirectory instance to get the results.
|
void |
setDirectorySearchRoot(java.lang.String root)
Set the default search root to search objects in.
|
void |
setOrganization(java.lang.String organization)
Set the current organizational context.
|
void |
switchToDirectConnection(LDAPConnection connection) |
void |
switchToSOAP() |
boolean |
userHasProperty(java.lang.String organizationalUser,
java.lang.String propertyName,
java.lang.String value)
Check whether the organizational user assigned roles contains property name value pair
|
boolean |
userHasRole(java.lang.String organizationalUser,
java.lang.String role)
Deprecated.
|
public static final java.lang.String LDAPCONTROL_CLASS
public static final int SCOPE_BASE
public static final int SCOPE_ONE
public static final int SCOPE_SUB
public static final int DEFAULT_PORT
public static final java.lang.String ENTRY_UUID
public static final java.lang.String LDAP_MAX_RESULT_KEY
@Deprecated public LDAPDirectory() throws DirectoryException
LDAPException
- if the connection could not be established.DirectoryException
public LDAPDirectory(LDAPConnection connection)
connection
- The connection that can be used by this LDAP proxy.public LDAPDirectory(java.lang.String host, int port, java.lang.String user, java.lang.String password) throws DirectoryException
host
- The host to connect to (may contain an optional port)port
- The port to connect to on the hostuser
- The username to bind forpassword
- The password for the userLDAPException
- if the connection could not be established.DirectoryException
@Deprecated public LDAPDirectory(java.lang.String host, int port, java.lang.String user, java.lang.String password, Cache cache) throws DirectoryException
DirectoryException
public static int getDefaultMaximumSearchResults()
public static LDAPDirectory getDefaultInstance() throws DirectoryException
DirectoryException
public static void initializeBootstrapFileTrigger()
public void switchToDirectConnection(LDAPConnection connection)
public void switchToSOAP() throws java.net.SocketTimeoutException, java.net.UnknownHostException, java.io.IOException
java.net.SocketTimeoutException
java.net.UnknownHostException
java.io.IOException
public boolean isSOAPConnection()
public void setOrganization(java.lang.String organization)
organization
- DN of the organizationpublic java.lang.String getOrganization()
public LDAPConnection getConnection()
public void setDirectorySearchRoot(java.lang.String root)
root
- search root for the LDAPpublic java.lang.String getDirectorySearchRoot()
public void clearCache()
public java.lang.String getCacheStatistics()
@Deprecated public void report()
public LDAPEntry getAuthenticationUser() throws DirectoryException
DirectoryException
public LDAPEntry getAuthenticationUser(java.lang.String osId) throws DirectoryException
DirectoryException
public java.lang.String getOrganizationalUser()
public java.lang.String getOrganizationalUser(java.lang.String osId)
public java.lang.String findSOAPNode(java.lang.String namespace, java.lang.String method) throws DirectoryException
String soapNodeDN = directory.findSOAPNode("<i>namespace of method set</i>",
"<i>name of the method</i>");
namespace
- The namespace of the methodmethod
- The method to be executed by the SOAP node to be foundDirectoryException
- if no soap node could be found, or an exception while
performing the look-up.public java.lang.String findSOAPNode(java.lang.String organizationalContext, java.lang.String namespace, java.lang.String method) throws DirectoryException
String soapNodeDN = directory.findSOAPNode("<i>dn of organization</i>", "<i>namespace of method set</i>",
"<i>name of the method</i>");
organizationalContext
- The search context for the ldap query, this is expected to be
an organization or organizational unit.namespace
- The namespace of the methodmethod
- The method to be executed by the SOAP node to be foundDirectoryException
- if no soap node could be found, or an exception while
performing the look-up.public LDAPEntry getEntry(java.lang.String name) throws DirectoryException
name
is a Distinguished Name, a LDAPConnection.read()
on this name is done. Else a search on
entries that have the value name
for the cn
attribute is done, and the first entry of this search
is returned.name
- A description (either name or subname) of the entry to findLDAPException
- if the name is a dn the exception of the LDAPConnection.read()
is thrown, else if the search
resulted in an exception this is thrown. If there where no matching results for the search, also an LDAPException is thrown.DirectoryException
public java.lang.String[] getURIs(java.lang.String name) throws DirectoryException
LDAPException
- if a failure in the ldap connection happened or if the name is not an object
in the directoryDirectoryException
public LDAPEntry[] search(java.lang.String dn, int scope, java.lang.String filter, java.lang.String[] attributes, boolean returnValues) throws DirectoryException
dn
- DN of the LDAP to search inscope
- Depth of the search. specify 0 for searching only that entry, 1 for searching one level under, 2 for
searching all under that entryfilter
- filter of the search for example "(objectclass=busmethod)"attributes
- attributes to be searched forreturnvalues
- this attribute is not usedthrows
- LDAPException if search failsDirectoryException
public LDAPEntry[] search(java.lang.String dn, int scope, java.lang.String filter, java.lang.String[] attributes, boolean returnValues, LDAPSearchConstraints cons) throws DirectoryException
dn
- DN of the LDAP to search inscope
- Depth of the search. specify 0 for searching only that entry, 1 for searching one level under, 2 for
searching all under that entryfilter
- filter of the search for example "(objectclass=busmethod)"attributes
- attributes to be searched forreturnvalues
- this attribute is not usedcons
- - The constraints specific to the search.throws
- LDAPException if search failsDirectoryException
public java.lang.String search(java.lang.String dn, int scope, java.lang.String filter, java.lang.String[] attributes, boolean returnValues, java.lang.String cookie, java.util.ArrayList<LDAPEntry> list) throws DirectoryException
dn
- scope
- filter
- attributes
- returnValues
- This attribute is not usedcookie
- list
- DirectoryException
public void returnCookieConnection(java.lang.String cookie)
cookie
- public DirectorySearchResults searchResults(java.lang.String dn, int scope, java.lang.String filter, java.lang.String[] attributes, boolean returnValues) throws DirectoryException
dn
- DN of the LDAP to search inscope
- Depth of the search. specify 0 for searching only that entry, 1 for searching one level under, 2 for
searching all under that entryfilter
- filter of the search for example "(objectclass=busmethod)"attributes
- attributes to be searched forreturnvalues
- This attribute is not usedthrows
- LDAPException if search failsDirectoryException
@Deprecated public void add(LDAPEntry entry) throws DirectoryException
DirectoryException
@Deprecated public void delete(java.lang.String dn) throws DirectoryException
DirectoryException
@Deprecated public void modify(LDAPEntry newEntry) throws DirectoryException
DirectoryException
public LDAPEntry read(java.lang.String dn) throws DirectoryException
DirectoryException
public LDAPEntry readWithUUID(java.lang.String searchRoot, java.lang.String uuid) throws DirectoryException
searchRoot
- The base DN to search from. Required.uuid
- DirectoryException
public java.lang.String getUUID(LDAPEntry entry)
entry
- LDAP entry@Deprecated public boolean userHasRole(java.lang.String organizationalUser, java.lang.String role) throws DirectoryException
organizationalUser
- (should never be null)role
- DirectoryException
public boolean userHasProperty(java.lang.String organizationalUser, java.lang.String propertyName, java.lang.String value) throws DirectoryException
organizationalUser
- propertyName
- value
- DirectoryException
@Deprecated public java.util.Map<java.lang.String,java.lang.String> getRolesOfUser(java.lang.String organizationalUserDN) throws DirectoryException
organizationalUser
- (should never be null)DirectoryException
- Use com.cordys.esbclient.util.LDAPUtil.getAllRoles(String organizationalUser) instead of this methodpublic java.util.Map<java.lang.String,java.lang.String> getAssignedRolesOfUser(java.lang.String organizationalUserDN) throws DirectoryException
organizationalUserDN
- DirectoryException
public java.util.Map<java.lang.String,java.lang.String> getAllRolesOfUser(java.lang.String organizationalUserDN) throws DirectoryException
organizationalUserDN
- the DN of the organizational user.DirectoryException
public Cache getCache()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable