|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.bridge.ldap.LdapHelper
Helper class for accessing LDAP data. This class is responsible for making calls to an LDAP directory server for user/group information, authentication, and profile data. It is used by the LDAPEntityPropertyManager, LDAPConfiguration, and RealmConfiguration beans.
Field Summary | |
protected static java.lang.String |
CONTEXT_FACTORY
|
protected static int |
GROUP
|
protected static int |
USER
|
Fields inherited from interface com.beasys.commerce.bridge.ldap.LDAPBridgeConstants |
LDAP_CONFIG,
LDAP_ENABLED_ATTRIBUTE,
LDAP_GROUP_ATTRIBUTE,
LDAP_USER_ATTRIBUTE |
Constructor Summary | |
LdapHelper()
|
Method Summary | |
boolean |
authenticate(java.lang.String username,
java.lang.String password)
Authenticates a username and password against an LDAP directory. |
protected void |
configureForSSL(java.util.Map env)
Sets up the JNDI environment variables necessary for SSL communication to an LDAP server. |
java.util.Iterator |
findUsernamesThatStartWith(java.lang.String start)
Returns an iterator containing the names of all the users that start with a certain set of characters. |
java.lang.String |
formatDN(java.lang.String dnInfo)
Given whatever is in the WebLogic LDAP Realm's properties file, formats a value correctly for use as a DN by reversing the order. |
java.util.Iterator |
getAllGroupNames()
Returns all of the groups that this configuration is set up to use. |
java.util.ArrayList |
getAllGroupNamesAsArrayList()
Returns all of the groups that this configuration is set up to use. |
protected LDAPConfiguration |
getConfiguration()
Convenience method for retrieving the LDAPConfiguration. |
protected javax.naming.directory.DirContext |
getDirContext()
Uses environment values from LDAPConfiguration to create a JNDI directory context that points to an LDAP server. |
java.lang.String |
getGroupDN(java.lang.String groupName)
Given a unique group name returns the group's DN (distinguished name). |
java.util.Iterator |
getGroupNamesForUser(java.lang.String username)
Returns the names of the groups of which a user is a member. |
java.util.Map |
getGroupProperties(java.lang.String groupName)
Returns properties for a group from LDAP. |
protected java.lang.String |
getObjectDN(java.lang.String name,
int type)
Forms a DN for a user or a group. |
protected java.util.Map |
getObjectProperties(java.lang.String name,
int type)
Returns the properties for either a user or a group. |
java.lang.Object |
getService(java.lang.String aLookupName)
|
java.lang.String |
getUserDN(java.lang.String username)
Given a unique username returns the user's DN (distinguished name). |
java.util.Iterator |
getUsernames(java.lang.String searchExpression,
int limit)
Returns the usernames in LDAP that match the search expression. |
java.util.Iterator |
getUsernamesForGroup(java.lang.String groupName)
Returns the usernames for the users in a group. |
java.util.Iterator |
getUsernamesForGroup(java.lang.String groupName,
java.lang.String searchExpression,
int limit)
Returns a group's list of members in the form of users' names |
java.util.Map |
getUserProperties(java.lang.String username)
Returns properties for a user from LDAP. |
boolean |
groupExists(java.lang.String groupName)
Returns true if a group by this name exists. |
protected boolean |
isSSL()
Checks the LDAP realm configuration to see if we should be communicating over SSL to the LDAP server. |
java.util.Iterator |
realGetUsernamesForGroup(java.lang.String groupName,
java.lang.String searchExpression,
int limit)
|
boolean |
userExists(java.lang.String username)
Determines if a user exists in an LDAP directory. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static final int GROUP
protected static final int USER
protected static final java.lang.String CONTEXT_FACTORY
Constructor Detail |
public LdapHelper()
Method Detail |
public boolean userExists(java.lang.String username) throws java.lang.Exception
username
- the unique username of a person in the directorypublic boolean authenticate(java.lang.String username, java.lang.String password) throws java.lang.Exception
username
- the username of the userpassword
- the user's passwordpublic java.util.Map getUserProperties(java.lang.String username) throws java.lang.Exception
username
- the user's usernamepublic java.util.Map getGroupProperties(java.lang.String groupName) throws java.lang.Exception
groupName
- the group's unique display nameprotected java.util.Map getObjectProperties(java.lang.String name, int type) throws java.lang.Exception
name
- the unique name of the object (user or group)type
- the type of object (user or group)protected javax.naming.directory.DirContext getDirContext() throws java.lang.Exception
public java.util.Iterator getAllGroupNames() throws java.lang.Exception
public java.util.ArrayList getAllGroupNamesAsArrayList() throws java.lang.Exception
public boolean groupExists(java.lang.String groupName) throws java.lang.Exception
groupName
- the name of the grouppublic java.lang.String getUserDN(java.lang.String username) throws java.lang.Exception
username
- the user's unique usernamepublic java.lang.String getGroupDN(java.lang.String groupName) throws java.lang.Exception
groupName
- the group's unique group nameprotected java.lang.String getObjectDN(java.lang.String name, int type) throws java.lang.Exception
name
- the name of the user or grouptype
- the type of the object - user or grouppublic java.util.Iterator getUsernamesForGroup(java.lang.String groupName) throws java.lang.Exception
groupName
- the name of the grouppublic java.util.Iterator getUsernames(java.lang.String searchExpression, int limit) throws java.lang.Exception
searchExpression
- a search expression such as "J* Smith" where
wildcards ("*") are the only supported special
characterlimit
- a limit of results to return (0 returns the
maximum)public java.util.Iterator getUsernamesForGroup(java.lang.String groupName, java.lang.String searchExpression, int limit) throws java.lang.Exception
groupName
- the name of the groupsearchExpression
- a search expression such as "J* Smith" where
wildcards ("*") are the only supported special
characterlimit
- a limit of results to return (0 returns the
maximum)public java.util.Iterator realGetUsernamesForGroup(java.lang.String groupName, java.lang.String searchExpression, int limit) throws java.lang.Exception
public java.util.Iterator getGroupNamesForUser(java.lang.String username) throws java.lang.Exception
username
- the name of the userpublic java.util.Iterator findUsernamesThatStartWith(java.lang.String start) throws java.lang.Exception
protected LDAPConfiguration getConfiguration() throws java.lang.Exception
protected void configureForSSL(java.util.Map env) throws java.lang.Exception
env
- the map of environment variables needed for creating a
JNDI context.protected boolean isSSL() throws java.lang.Exception
public java.lang.String formatDN(java.lang.String dnInfo) throws java.lang.Exception
o=Acme,ou=North America,ou=People
Then this method would format the DN to be
ou=People,ou=North America,o=Acme
This formatted DN is in the order in which LDAP servers want to see it. Note: you do not need to format a DN that is already in the correct order, if you do it's order will be reversed and it will no longer work.
dnInfo
- an LDAP DN in reverse order (as it would be in
ldaprealm.properties)public java.lang.Object getService(java.lang.String aLookupName)
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |