|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wewebu.ow.server.util.ldap.OwLdapConnector
public class OwLdapConnector
Utility class for connecting to an LDAP Server.
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
Field Summary | |
---|---|
static String |
ELEMENT_SCHEMA_INTERPRETER
name of the configuration element changing the LDAP attribute storing the schema interpreter class name. |
static String |
USER_DN_PROPERTY
Distinguished name property name |
static String |
USERS_DIRECTORY_PROPERTY
|
Constructor Summary | |
---|---|
OwLdapConnector(Node configNode_p)
Construct LDAP connector from the XML config node of bootstrap.xml |
|
OwLdapConnector(Properties props_p,
int recursionLevel_p)
Construct the LDAP Connector with given properties |
Method Summary | |
---|---|
void |
authenticate(String userName_p,
String password_p)
Authenticates a user using LDAP. The user name and password are stored for further operations. |
OwLdapConnection |
createConnection(boolean adminConnection_p)
Create a Connection with properties depending on the given parameter. |
String |
findDistinguishedNameAnonymously(String user_p)
Returns the full distinguished name for the login user to use for authentication later. |
OwObjectCollection |
findGroupsMatching(String namePattern)
Find groups that match a given pattern. |
OwUserInfo |
findUserByDNAnonymously(String strID_p)
Finds a user by its Distinguished Name. |
OwUserInfo |
findUserByIdAnonymously(String strID_p)
Finds a user by its id. |
OwUserInfo |
findUserByLoginAnonymously(String strID_p)
|
OwObjectCollection |
findUserDNsMatching(String pattern)
|
Collection |
getAllShortGroupNames()
Reads all groups from the LDAP (e.g. |
Collection |
getAllShortGroupNames(boolean useAdminAccount_p)
Reads all groups from the LDAP (e.g. |
Properties |
getProperties()
Returns the properties used to build up the LDAP context of the logged in user |
protected Properties |
getProperties(boolean admin_p)
Get specific properties configuration of user or admin. |
String |
getRecordId(String dname)
Retrieves the value of the attribute that should be used as OWD ID. |
int |
getRecursionLevel()
Get the defined level of recursion. |
Collection |
getShortGroupNames()
Returns the group names of the user. |
Collection |
getShortGroupNames(boolean useAdminAccount_p)
Returns the group names of the user. |
String |
getUserDisplayName()
Get the user display name, or a null value. |
String |
getUserDisplayName(String dname)
Get the display name for the user with the given DN. |
String |
getUserId()
Returns a unique ID of the user |
String |
getUserLongName()
Gets the user's long name |
String |
getUserShortName()
Get the user short name, or a null value. |
protected void |
prepareForAuthentication(String userName_p,
String password_p)
Called before authentication method to prepare configuration for |
String |
toString()
toString method: creates a String representation of the object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String USERS_DIRECTORY_PROPERTY
public static final String ELEMENT_SCHEMA_INTERPRETER
public static final String USER_DN_PROPERTY
Constructor Detail |
---|
public OwLdapConnector(Properties props_p, int recursionLevel_p)
props_p
- properties used to build up the LDAP contextrecursionLevel_p
- Recursion level for getting the groups of a given userpublic OwLdapConnector(Node configNode_p)
configNode_p
- XML node of bootstrap.xmlMethod Detail |
---|
public OwLdapConnection createConnection(boolean adminConnection_p)
adminConnection_p
- boolean flag to initialize with specific properties
OwLdapConnection
based on the administrator properties if adminConnection_p is true or the
users properties if adminConnection_p is falsepublic Properties getProperties()
Properties
protected Properties getProperties(boolean admin_p)
admin_p
- boolean
public void authenticate(String userName_p, String password_p) throws OwAuthenticationException, OwConfigurationException
userName_p
- (the samAccount)password_p
-
OwAuthenticationException
- LDAP authorization Exception
OwConfigurationException
- possible cause: the LDAP connector is not set up correctly in the bootstrap.xml (Authentication node)protected void prepareForAuthentication(String userName_p, String password_p) throws OwAuthenticationException, OwConfigurationException
userName_p
- password_p
-
OwAuthenticationException
OwConfigurationException
public Collection getShortGroupNames() throws OwAuthenticationException, OwInvalidOperationException
OwAuthenticationException
- LDAP authorization Exception
OwInvalidOperationException
- invalid LDAP operationpublic Collection getShortGroupNames(boolean useAdminAccount_p) throws OwAuthenticationException, OwInvalidOperationException
useAdminAccount_p
- if true the LDAP Connector uses the administrator account set
in the bootstrap.xml to retrieve the user group names of the logged in user, if false use the
user logged in user account to retrieve this informations.
OwAuthenticationException
- LDAP authorization Exception
OwInvalidOperationException
- invalid LDAP operationpublic Collection getAllShortGroupNames() throws OwAuthenticationException, OwInvalidOperationException
OwAuthenticationException
- LDAP authorization Exception
OwInvalidOperationException
- invalid LDAP operationpublic Collection getAllShortGroupNames(boolean useAdminAccount_p) throws OwAuthenticationException, OwInvalidOperationException
useAdminAccount_p
- if true the LDAP Connector uses the administrator account set
in the bootstrap.xml to retrieve the user group names of the logged in user, if false use the
user logged in user account to retrieve this informations.
OwAuthenticationException
- LDAP authorization Exception
OwInvalidOperationException
- invalid LDAP operationpublic String getUserLongName() throws OwAuthenticationException, OwInvalidOperationException
String
OwAuthenticationException
- LDAP authorization Exception
OwInvalidOperationException
- invalid LDAP operationpublic String getUserId() throws OwAuthenticationException, OwInvalidOperationException
String
OwAuthenticationException
- LDAP authorization Exception
OwInvalidOperationException
- invalid LDAP operationpublic String findDistinguishedNameAnonymously(String user_p) throws OwAuthenticationException, OwConfigurationException
user_p
- representing the login name for the user being searched
OwAuthenticationException
- the user that wants to login is not available in the LDAP
OwConfigurationException
- possible cause: the LDAP connector is not set up correctly in the bootstrap.xml (Authentication node)public OwObjectCollection findUserDNsMatching(String pattern) throws OwException
OwException
public String getUserShortName() throws OwAuthenticationException, OwInvalidOperationException
null
value.
null
value.
OwAuthenticationException
- thrown when the user is not authenticated.
OwInvalidOperationException
- thrown when the "name" attribute cannot be resolved.public String getUserDisplayName() throws OwAuthenticationException, OwInvalidOperationException
null
value.
null
value.
OwAuthenticationException
- thrown when the user is not authenticated.
OwInvalidOperationException
- thrown when the "displayName" attribute cannot be resolved.public String toString()
toString
in class Object
String
- the String representationpublic OwUserInfo findUserByDNAnonymously(String strID_p) throws OwException
strID_p
-
OwException
- Throws OwObjectNotFoundException if no user was found.public OwUserInfo findUserByIdAnonymously(String strID_p) throws OwException
strID_p
-
OwException
- Throws OwObjectNotFoundException if no user was found.public String getUserDisplayName(String dname) throws OwException
dname
- The DN of the user.
OwException
public String getRecordId(String dname) throws OwException
dname
- The LDAP DN of the record (group, user)
OwException
public int getRecursionLevel()
public OwUserInfo findUserByLoginAnonymously(String strID_p) throws OwException
strID_p
-
OwException
public OwObjectCollection findGroupsMatching(String namePattern) throws OwException
namePattern
- pattern for the group name to search by.
OwUserInfo
representing groups that match the pattern.
OwException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |