public class OwLdapConnection extends Object
A LDAP connection contains the directory connection Properties
(see InitialDirContext.InitialDirContext(java.util.Hashtable)
and standard directory operations needed by the Alfresco Workdesk connector and its schema interpreters.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Constructor and Description |
---|
OwLdapConnection(Properties ldapProperties_p,
int recursionLevel_p)
Constructor
|
Modifier and Type | Method and Description |
---|---|
InitialLdapContext |
createInitialDirContext() |
Object |
getAttributeValue(String distinguishedName_p,
String attributeName_p)
Get the attribute value for given attribute name.
|
String |
getAttributeValue(String distinguishedName_p,
String attributeName_p,
boolean trimmCommonName_p) |
Properties |
getProperties() |
String |
getProperty(String propertyName_p,
String defaultValue_p) |
int |
getRecursionLevel() |
Object |
getUserAttributeValue(String attributeName_p) |
String |
getUserAttributeValue(String attributeName_p,
boolean trimmCommonName_p) |
String |
getUserDistinguishedName() |
NamingEnumeration<SearchResult> |
search(String searchBase_p,
String[][] attributeValues_p,
String[] returnIds_p)
Searches the LDAP repository for records matching the given pattern.
|
Collection<String> |
searchAttributeValues(String searchBase_p,
String[][] matchAttrs_p,
String attribute_p) |
OwObjectCollection |
searchValuesByFilter(String searchBase,
String filter,
String returningAttibute,
String sortKey)
Search for objects with attributes matching a given pattern.
|
public OwLdapConnection(Properties ldapProperties_p, int recursionLevel_p)
ldapProperties_p
- this connection propertiesrecursionLevel_p
- the configured recursion levelpublic InitialLdapContext createInitialDirContext() throws OwConfigurationException
InitialDirContext
based on this connection propertiesOwConfigurationException
- if the context creation failspublic String getProperty(String propertyName_p, String defaultValue_p)
propertyName_p
- defaultValue_p
- public int getRecursionLevel()
This configuration parameter has nothing to do with LDAP nested records.
public Properties getProperties()
public String getUserDistinguishedName() throws OwAuthenticationException
OwAuthenticationException
- if no user was authenticated (the OwLdapConnector.USER_DN_PROPERTY
is not defined in the properties of this connection)public String getUserAttributeValue(String attributeName_p, boolean trimmCommonName_p) throws OwAuthenticationException, OwConfigurationException, OwInvalidOperationException
attributeName_p
- trimmCommonName_p
- if true
common name prefixed values will be
stripped of their common name prefixes (egg. "cn: alice" will be returned as "alice")OwAuthenticationException
OwConfigurationException
OwInvalidOperationException
public Object getUserAttributeValue(String attributeName_p) throws OwAuthenticationException, OwConfigurationException, OwInvalidOperationException
attributeName_p
- OwAuthenticationException
OwConfigurationException
OwInvalidOperationException
public String getAttributeValue(String distinguishedName_p, String attributeName_p, boolean trimmCommonName_p) throws OwAuthenticationException, OwConfigurationException, OwInvalidOperationException
distinguishedName_p
- attributeName_p
- trimmCommonName_p
- if true
common name prefixed values will be
stripped of their common name prefixes (egg. "cn: alice" will be returned as "alice")OwAuthenticationException
OwConfigurationException
OwInvalidOperationException
public Object getAttributeValue(String distinguishedName_p, String attributeName_p) throws OwAuthenticationException, OwConfigurationException, OwInvalidOperationException
distinguishedName_p
- - the attribute nameString
object containing the value for the given attribute, or a null
value,
in case the requested attribute is not found in LDAPOwAuthenticationException
- thrown when the user is not authenticated.OwInvalidOperationException
- thrown when the given attribute cannot be resolved.OwConfigurationException
public Collection<String> searchAttributeValues(String searchBase_p, String[][] matchAttrs_p, String attribute_p) throws OwAuthenticationException, OwConfigurationException, OwInvalidOperationException
searchBase_p
- matchAttrs_p
- array of String pairs of attribute name value that will be used in matching the targeted entries
example : new String[]{{"objectClass","groupOfNames"},{"cn","administrators"}}attribute_p
- name of the attribute whose values will be returnedOwAuthenticationException
OwConfigurationException
OwInvalidOperationException
public NamingEnumeration<SearchResult> search(String searchBase_p, String[][] attributeValues_p, String[] returnIds_p) throws OwConfigurationException, OwInvalidOperationException
searchBase_p
- attributeValues_p
- returnIds_p
- OwConfigurationException
OwInvalidOperationException
public OwObjectCollection searchValuesByFilter(String searchBase, String filter, String returningAttibute, String sortKey) throws OwException
searchBase
- filter
- returningAttibute
- sortKey
- if null no sorting will be performedOwException
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.