org.objectledge.authentication
Class DummyUserManager

java.lang.Object
  extended by org.objectledge.authentication.UserManager
      extended by org.objectledge.authentication.DummyUserManager

public class DummyUserManager
extends UserManager

The dummy user manager implementation.

Author:
Pawel Potempski

Field Summary
 
Fields inherited from class org.objectledge.authentication.UserManager
loginVerifier, namingPolicy, passwordDigester, passwordGenerator
 
Constructor Summary
DummyUserManager()
          Creates an instance of the user manager.
 
Method Summary
 void changeUserPassword(Principal account, String password)
          Changes user password.
 boolean checkUserPassword(Principal account, String password)
          Checks user supplied password.
 Principal createAccount(String login, String dn, String password)
          Creates a new user account.
 Principal getAnonymousAccount()
          Returns the anonymous account.
 DirContext getPersonalData(Principal account)
          Returns the personal data of the accoun't owner.
 Principal getSuperuserAccount()
          Returns the superuser account.
 Principal getUserByLogin(String login)
          Lookup user by login name.
 Principal getUserByName(String dn)
          Lookup user by distinguised name.
 Principal[] lookupAccounts(String query)
          Looks up user accounts according to personal data attributes.
 Principal[] lookupAccounts(String attribute, String value)
          Looks up user accounts according to personal data attributes.
 void removeAccount(Principal account)
          Removes an user account.
 boolean userExists(String dn)
          Check if user exists.
 
Methods inherited from class org.objectledge.authentication.UserManager
checkLogin, createDN, createRandomPassword, getLogin, getLogin, validateLogin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyUserManager

public DummyUserManager()
Creates an instance of the user manager.

Method Detail

userExists

public boolean userExists(String dn)
Check if user exists.

Specified by:
userExists in class UserManager
Parameters:
dn - the name of the user.
Returns:
true if user exists in system.

createAccount

public Principal createAccount(String login,
                               String dn,
                               String password)
                        throws AuthenticationException
Creates a new user account.

Specified by:
createAccount in class UserManager
Parameters:
login - login name of the user.
dn - distinguished name of the user.
password - initial password of the user.
Returns:
the newly created account.
Throws:
AuthenticationException - if the account could no be created.

removeAccount

public void removeAccount(Principal account)
                   throws AuthenticationException
Removes an user account.

Specified by:
removeAccount in class UserManager
Parameters:
account - the account.
Throws:
AuthenticationException - if the account could no be removed.

getUserByName

public Principal getUserByName(String dn)
                        throws AuthenticationException
Lookup user by distinguised name.

Specified by:
getUserByName in class UserManager
Parameters:
dn - the users's distinguished name.
Returns:
the account's descriptor.
Throws:
AuthenticationException - if there is a problem performing the operation.

getUserByLogin

public Principal getUserByLogin(String login)
                         throws AuthenticationException
Lookup user by login name.

Specified by:
getUserByLogin in class UserManager
Parameters:
login - the name used for authentication.
Returns:
the account's descriptor.
Throws:
AuthenticationException - if there is a problem performing the operation.

getAnonymousAccount

public Principal getAnonymousAccount()
                              throws AuthenticationException
Returns the anonymous account.

Specified by:
getAnonymousAccount in class UserManager
Returns:
the anonyomous user.
Throws:
AuthenticationException - if there is a problem performing the operation.

getSuperuserAccount

public Principal getSuperuserAccount()
                              throws AuthenticationException
Returns the superuser account.

Specified by:
getSuperuserAccount in class UserManager
Returns:
the superuser.
Throws:
AuthenticationException - if there is a problem performing the operation.

changeUserPassword

public void changeUserPassword(Principal account,
                               String password)
                        throws AuthenticationException
Changes user password.

Specified by:
changeUserPassword in class UserManager
Parameters:
account - the account.
password - the new password for the account.
Throws:
AuthenticationException - if the password could not be changed.

checkUserPassword

public boolean checkUserPassword(Principal account,
                                 String password)
                          throws AuthenticationException
Checks user supplied password.

Specified by:
checkUserPassword in class UserManager
Parameters:
account - the account.
password - the password to be checked.
Returns:
true if the supplied password is correct.
Throws:
AuthenticationException - if there is a problem performing the operation.

getPersonalData

public DirContext getPersonalData(Principal account)
                           throws AuthenticationException
Returns the personal data of the accoun't owner.

Specified by:
getPersonalData in class UserManager
Parameters:
account - the account.
Returns:
Parameters view of the account's owner personal data.
Throws:
AuthenticationException - if there is a problem performing the operation.

lookupAccounts

public Principal[] lookupAccounts(String attribute,
                                  String value)
                           throws NamingException
Looks up user accounts according to personal data attributes.

Specified by:
lookupAccounts in class UserManager
Parameters:
attribute - the personal data attribute name.
value - the personal data attribute value.
Returns:
the accounts that fulfill the condition.
Throws:
NamingException - if the opertion could not be performed.

lookupAccounts

public Principal[] lookupAccounts(String query)
                           throws NamingException
Looks up user accounts according to personal data attributes.

Specified by:
lookupAccounts in class UserManager
Parameters:
query - the JNDI query in format supported by the underlying directory.
Returns:
the accounts that fulfill the condition.
Throws:
NamingException - if the opertion could not be performed.


Copyright © 2003-2006 objectledge.org. All Rights Reserved.