Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.turbine.services.security.ldap
Class LDAPUserManager

    java.lang.Object
      org.apache.turbine.services.security.ldap.LDAPUserManager

All Implemented Interfaces:
  UserManager

    public class LDAPUserManager

extends Object
implements UserManager

A UserManager performs `User` object related tasks on behalf of the `SecurityService`. This implementation uses ldap for retrieving user data. It expects that the User interface implementation will be castable to `org.apache.turbine.om.BaseObject`.

Version:
  $Id: LDAPUserManager.java 1096130 2011-04-23 10:37:19Z ludwig $
Author:
  Jon S. Stevens, John D. McNally, Frank Y. Kim, Craig D. Berry, Rafal Krzewski, Tracy M. Adewunmi, Leonard J. Flournoy, Jason van Zyl, Daniel Rall, Humberto Hernandez

Constructor Summary
`LDAPUserManager()`

Method Summary
`boolean` | `accountExists(String username)` Check wether a specified user's account exists.
`boolean` | `accountExists(User user)` Check wether a specified user's account exists.
`void` | `authenticate(User user, String password)` Authenticate a User with the specified password.
`static DirContext` | `bind(String username, String password)` Creates an initial context.
`static DirContext` | `bindAsAdmin()` Bind as the admin user.
`void` | `changePassword(User user, String oldPass, String newPass)` This method is not yet implemented Change the password for an User.
`void` | `createAccount(User user, String initialPassword)` Creates new user account with specified attributes.
`void` | `forcePassword(User user, String password)` This method is not yet implemented Forcibly sets new password for an User.
`void` | `init(org.apache.commons.configuration.Configuration conf)` Initializes the UserManager
`void` | `removeAccount(User user)` Removes an user account from the system.
`User[]` | `retrieve(Object criteria)` Deprecated. Use retrieveList instead.
`User` | `retrieve(String username)` Retrieve a user from persistent storage using username as the key.
`User` | `retrieve(String username, String password)` Retrieve a user from persistent storage using username as the key, and authenticate the user.
`List` | `retrieveList(Object criteria)` Retrieve a list of users that meet the specified criteria.
`void` | `saveOnSessionUnbind(User user)` This method is not yet implemented.
`void` | `store(User user)` Save a User object to persistent storage.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LDAPUserManager

    public LDAPUserManager()

Method Detail

### init

    public void init(org.apache.commons.configuration.Configuration conf)

  Initializes the UserManager

  Specified by:
    `init` in interface `UserManager`
  Parameters:
    `conf` - A Configuration object to init this Manager

### accountExists

    public boolean accountExists(User user)
                          throws DataBackendException

  Check wether a specified user's account exists. The login name is used for looking up the account.

  Specified by:
    `accountExists` in interface `UserManager`
  Parameters:
    `user` - The user to be checked.
  Returns:
    true if the specified account exists
  Throws:
    `DataBackendException` - Error accessing the data backend.

### accountExists

    public boolean accountExists(String username)
                          throws DataBackendException

  Check wether a specified user's account exists. The login name is used for looking up the account.

  Specified by:
    `accountExists` in interface `UserManager`
  Parameters:
    `username` - The name of the user to be checked.
  Returns:
    true if the specified account exists
  Throws:
    `DataBackendException` - Error accessing the data backend.

### retrieve

    public User retrieve(String username)
                  throws UnknownEntityException,
                         DataBackendException

  Retrieve a user from persistent storage using username as the key.

  Specified by:
    `retrieve` in interface `UserManager`
  Parameters:
    `username` - the name of the user.
  Returns:
    an User object.
  Throws:
    `UnknownEntityException` - if the user's account does not exist in the database.
    `DataBackendException` - Error accessing the data backend.

### retrieve

    public User[] retrieve(Object criteria)
                    throws DataBackendException

  Deprecated. Use retrieveList instead.

  This is currently not implemented to behave as expected. It ignores the Criteria argument and returns all the users. Retrieve a set of users that meet the specified criteria. As the keys for the criteria, you should use the constants that are defined in `User` interface, plus the the names of the custom attributes you added to your user representation in the data storage. Use verbatim names of the attributes - without table name prefix in case of DB implementation.

  Specified by:
    `retrieve` in interface `UserManager`
  Parameters:
    `criteria` - The criteria of selection.
  Returns:
    a List of users meeting the criteria.
  Throws:
    `DataBackendException` - Error accessing the data backend.

### retrieveList

    public List retrieveList(Object criteria)
                      throws DataBackendException

  Retrieve a list of users that meet the specified criteria. As the keys for the criteria, you should use the constants that are defined in `User` interface, plus the names of the custom attributes you added to your user representation in the data storage. Use verbatim names of the attributes - without table name prefix in case of Torque implementation.

  Specified by:
    `retrieveList` in interface `UserManager`
  Parameters:
    `criteria` - The criteria of selection.
  Returns:
    a List of users meeting the criteria.
  Throws:
    `DataBackendException` - if there is a problem accessing the storage.

### retrieve

    public User retrieve(String username,
                         String password)
                  throws PasswordMismatchException,
                         UnknownEntityException,
                         DataBackendException

  Retrieve a user from persistent storage using username as the key, and authenticate the user. The implementation may chose to authenticate to the server as the user whose data is being retrieved.

  Specified by:
    `retrieve` in interface `UserManager`
  Parameters:
    `username` - the name of the user.
    `password` - the user supplied password.
  Returns:
    an User object.
  Throws:
    `PasswordMismatchException` - if the supplied password was incorrect.
    `UnknownEntityException` - if the user's account does not exist in the database.
    `DataBackendException` - Error accessing the data backend.

### store

    public void store(User user)
               throws UnknownEntityException,
                      DataBackendException

  Save a User object to persistent storage. User's account is required to exist in the storage.

  Specified by:
    `store` in interface `UserManager`
  Parameters:
    `user` - an User object to store.
  Throws:
    `UnknownEntityException` - if the user's account does not exist in the database.
    `DataBackendException` - if there is an LDAP error

### saveOnSessionUnbind

    public void saveOnSessionUnbind(User user)
                             throws UnknownEntityException,
                                    DataBackendException

  This method is not yet implemented. Saves User data when the session is unbound. The user account is required to exist in the storage. LastLogin, AccessCounter, persistent pull tools, and any data stored in the permData hashtable that is not mapped to a column will be saved.

  Specified by:
    `saveOnSessionUnbind` in interface `UserManager`
  Throws:
    `UnknownEntityException` - if the user's account does not exist in the database.
    `DataBackendException` - if there is a problem accessing the storage.

### authenticate

    public void authenticate(User user,
                             String password)
                      throws PasswordMismatchException,
                             UnknownEntityException,
                             DataBackendException

  Authenticate a User with the specified password. If authentication is successful the method returns nothing. If there are any problems, exception was thrown.

  Specified by:
    `authenticate` in interface `UserManager`
  Parameters:
    `user` - a User object to authenticate.
    `password` - the user supplied password.
  Throws:
    `PasswordMismatchException` - if the supplied password was incorrect.
    `UnknownEntityException` - if the user's account does not exist in the database.
    `DataBackendException` - Error accessing the data backend.

### changePassword

    public void changePassword(User user,
                               String oldPass,
                               String newPass)
                        throws PasswordMismatchException,
                               UnknownEntityException,
                               DataBackendException

  This method is not yet implemented Change the password for an User.

  Specified by:
    `changePassword` in interface `UserManager`
  Parameters:
    `user` - an User to change password for.
    `newPass` - the new password.
    `oldPass` - the old password.
  Throws:
    `PasswordMismatchException` - if the supplied password was incorrect.
    `UnknownEntityException` - if the user's account does not exist in the database.
    `DataBackendException` - Error accessing the data backend.

### forcePassword

    public void forcePassword(User user,
                              String password)
                       throws UnknownEntityException,
                              DataBackendException

  This method is not yet implemented Forcibly sets new password for an User. This is supposed to be used by the administrator to change the forgotten or compromised passwords. Certain implementatations of this feature would require adminstrative level access to the authenticating server / program.

  Specified by:
    `forcePassword` in interface `UserManager`
  Parameters:
    `user` - an User to change password for.
    `password` - the new password.
  Throws:
    `UnknownEntityException` - if the user's record does not exist in the database.
    `DataBackendException` - Error accessing the data backend.

### createAccount

    public void createAccount(User user,
                              String initialPassword)
                       throws EntityExistsException,
                              DataBackendException

  Creates new user account with specified attributes.

  Specified by:
    `createAccount` in interface `UserManager`
  Parameters:
    `user` - the object describing account to be created.
    `initialPassword` - Not used yet.
  Throws:
    `DataBackendException` - Error accessing the data backend.
    `EntityExistsException` - if the user account already exists.

### removeAccount

    public void removeAccount(User user)
                       throws UnknownEntityException,
                              DataBackendException

  Removes an user account from the system.

  Specified by:
    `removeAccount` in interface `UserManager`
  Parameters:
    `user` - the object describing the account to be removed.
  Throws:
    `DataBackendException` - Error accessing the data backend.
    `UnknownEntityException` - if the user account is not present.

### bindAsAdmin

    public static DirContext bindAsAdmin()
                                  throws NamingException

  Bind as the admin user.

  Returns:
    a new DirContext.
  Throws:
    `NamingException` - when an error occurs with the named server.

### bind

    public static DirContext bind(String username,
                                  String password)
                           throws NamingException

  Creates an initial context.

  Parameters:
    `username` - admin username supplied in TRP.
    `password` - admin password supplied in TRP
  Returns:
    a new DirContext.
  Throws:
    `NamingException` - when an error occurs with the named server.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.