org.jboss.portal.identity.ldap
Class LDAPUserModuleImpl

java.lang.Object
  extended by org.jboss.portal.identity.service.IdentityModuleService
      extended by org.jboss.portal.identity.service.UserModuleService
          extended by org.jboss.portal.identity.ldap.LDAPUserModule
              extended by org.jboss.portal.identity.ldap.LDAPUserModuleImpl
All Implemented Interfaces:
UserModule
Direct Known Subclasses:
LDAPExtUserModuleImpl

public class LDAPUserModuleImpl
extends LDAPUserModule

Simple implementation of UserModule for LDAP support. Search of users is limited to one place * containerField - DN of entry containing users (like ou=People,dc=example,dc=com). It's where users will be added using createUser() method. Under this DN users will be searched using ONELEVEL_SCOPE * uidAttributeID - attribute that stores user id. Default value is "uid"

Version:
$Revision: 1.1 $
Author:
Boleslaw Dawidowicz

Nested Class Summary
protected  class LDAPUserModuleImpl.UserEntryComparator
          Comparator for users entries
 
Field Summary
 
Fields inherited from class org.jboss.portal.identity.service.IdentityModuleService
moduleType
 
Constructor Summary
LDAPUserModuleImpl()
           
 
Method Summary
 User createUser(java.lang.String userName, java.lang.String password)
          Creates a new user with the specified name.
 User findUserById(java.lang.Object id)
          Retrieve a user by its id.
 User findUserById(java.lang.String id)
          Retrieve a user by its id.
 User findUserByUserName(java.lang.String userName)
          Retrieve a user by its name.
 java.util.Set findUsers(int offset, int limit)
          Get a range of users.
 java.util.Set findUsersFilteredByUserName(java.lang.String filter, int offset, int limit)
          Get a range of users.
 int getUserCount()
          Returns the number of users.
protected  java.util.Set processUsers(java.util.Collection users)
           
 void removeUser(java.lang.Object id)
          Remove a user.
 java.util.List searchUsers(java.lang.String filter, java.lang.Object[] filterArgs)
          This method should be used by over modules to perform searches.
 
Methods inherited from class org.jboss.portal.identity.ldap.LDAPUserModule
createUserInstance, findUserByDN, getAttributesToAdd, getConnectionContext, getContainerDN, getPasswordAttributeId, getPrincipalPreffix, getPrincipalSuffix, getSearchScope, getSearchTimeLimit, getUidAttributeID, getUserProfileModule, getUserSearchCtxDN, getUserSearchFilter, isAllowEmptyPasswords, isUserNameToLowerCase, setConnectionContext, start, updatePassword, validatePassword
 
Methods inherited from class org.jboss.portal.identity.service.UserModuleService
fireUserCreatedEvent, fireUserDestroyedEvent
 
Methods inherited from class org.jboss.portal.identity.service.IdentityModuleService
getConnectionJNDIName, getIdentityConfiguration, getIdentityContext, getIdentityEventBroadcaster, getInitOptions, getJndiBinder, getJNDIName, getModuleType, setConnectionJNDIName, setIdentityContext, setInitOptions, setJndiBinder, setJNDIName, setModuleType, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPUserModuleImpl

public LDAPUserModuleImpl()
Method Detail

findUserByUserName

public User findUserByUserName(java.lang.String userName)
                        throws IdentityException,
                               java.lang.IllegalArgumentException,
                               NoSuchUserException
Description copied from interface: UserModule
Retrieve a user by its name.

Parameters:
userName - the user name
Returns:
the user
Throws:
IdentityException
java.lang.IllegalArgumentException
NoSuchUserException

findUserById

public User findUserById(java.lang.Object id)
                  throws IdentityException,
                         java.lang.IllegalArgumentException,
                         NoSuchUserException
Description copied from interface: UserModule
Retrieve a user by its id.

Parameters:
id - the user id
Returns:
the user
Throws:
java.lang.IllegalArgumentException - if the id is null
IdentityException
NoSuchUserException

findUserById

public User findUserById(java.lang.String id)
                  throws IdentityException,
                         java.lang.IllegalArgumentException,
                         NoSuchUserException
Description copied from interface: UserModule
Retrieve a user by its id.

Parameters:
id - the user id
Returns:
the user
Throws:
java.lang.IllegalArgumentException - if the id is null or not in the good format
IdentityException
NoSuchUserException

createUser

public User createUser(java.lang.String userName,
                       java.lang.String password)
                throws IdentityException,
                       java.lang.IllegalArgumentException
Description copied from interface: UserModule
Creates a new user with the specified name.

Returns:
the user
Throws:
IdentityException
java.lang.IllegalArgumentException

removeUser

public void removeUser(java.lang.Object id)
                throws IdentityException,
                       java.lang.IllegalArgumentException
Description copied from interface: UserModule
Remove a user.

Parameters:
id - the user id
Throws:
IdentityException
java.lang.IllegalArgumentException

findUsers

public java.util.Set findUsers(int offset,
                               int limit)
                        throws IdentityException,
                               java.lang.IllegalArgumentException
Description copied from interface: UserModule
Get a range of users.

Parameters:
offset - the offset of the first result to retrieve
limit - the maximum number of users to retrieve
Returns:
the user set
Throws:
IdentityException
java.lang.IllegalArgumentException

findUsersFilteredByUserName

public java.util.Set findUsersFilteredByUserName(java.lang.String filter,
                                                 int offset,
                                                 int limit)
                                          throws IdentityException,
                                                 java.lang.IllegalArgumentException
Description copied from interface: UserModule
Get a range of users.

Parameters:
filter - a string filter applied to the user name.
offset - the offset of the frist result to retrieve
limit - the maximum number of users to retrieve
Returns:
the user set
Throws:
IdentityException
java.lang.IllegalArgumentException

getUserCount

public int getUserCount()
                 throws IdentityException,
                        java.lang.IllegalArgumentException
Description copied from interface: UserModule
Returns the number of users.

Returns:
the number of users
Throws:
IdentityException
java.lang.IllegalArgumentException

searchUsers

public java.util.List searchUsers(java.lang.String filter,
                                  java.lang.Object[] filterArgs)
                           throws javax.naming.NamingException,
                                  IdentityException
This method should be used by over modules to perform searches. It will allow user module implementation to apply proper filter and search scope from the configuration

Specified by:
searchUsers in class LDAPUserModule
Parameters:
filter - that will be concatenated with proper user search filter from the module
Returns:
Throws:
javax.naming.NamingException
IdentityException

processUsers

protected java.util.Set processUsers(java.util.Collection users)
                              throws java.lang.Exception
Throws:
java.lang.Exception