org.apache.james.impl.user
Class DefaultUser

java.lang.Object
  extended by org.apache.james.impl.user.DefaultUser
All Implemented Interfaces:
java.io.Serializable, User
Direct Known Subclasses:
DefaultJamesUser

public class DefaultUser
extends java.lang.Object
implements User, java.io.Serializable

Implementation of User Interface. Instances of this class do not allow the the user name to be reset.

Version:
CVS $Revision: 521427 $
See Also:
Serialized Form

Constructor Summary
DefaultUser(java.lang.String name, java.lang.String hashAlg)
          Standard constructor.
DefaultUser(java.lang.String name, java.lang.String passwordHash, java.lang.String hashAlg)
          Constructor for repositories that are construcing user objects from separate fields, e.g.
 
Method Summary
 java.lang.String getHashAlgorithm()
          Method to access the hashing algorithm of the password.
 java.lang.String getHashedPassword()
          Method to access hash of password
 java.lang.String getUserName()
          Return the user name of this user
 boolean setPassword(java.lang.String newPass)
          Sets new password from String.
 boolean verifyPassword(java.lang.String pass)
          Return true if pass matches password of this user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUser

public DefaultUser(java.lang.String name,
                   java.lang.String hashAlg)
Standard constructor.

Parameters:
name - the String name of this user
hashAlg - the algorithm used to generate the hash of the password

DefaultUser

public DefaultUser(java.lang.String name,
                   java.lang.String passwordHash,
                   java.lang.String hashAlg)
Constructor for repositories that are construcing user objects from separate fields, e.g. databases.

Parameters:
name - the String name of this user
passwordHash - the String hash of this users current password
hashAlg - the String algorithm used to generate the hash of the password
Method Detail

getUserName

public java.lang.String getUserName()
Description copied from interface: User
Return the user name of this user

Specified by:
getUserName in interface User
Returns:
the user name for this user
See Also:
User.getUserName()

verifyPassword

public boolean verifyPassword(java.lang.String pass)
Description copied from interface: User
Return true if pass matches password of this user.

Specified by:
verifyPassword in interface User
Parameters:
pass - the password to test
Returns:
whether the password being tested is valid
See Also:
User.verifyPassword(java.lang.String)

setPassword

public boolean setPassword(java.lang.String newPass)
Description copied from interface: User
Sets new password from String. No checks made on guessability of password.

Specified by:
setPassword in interface User
Parameters:
newPass - the String that is the new password.
Returns:
true if newPass successfully added
See Also:
User.setPassword(java.lang.String)

getHashedPassword

public java.lang.String getHashedPassword()
Method to access hash of password

Returns:
the String of the hashed Password

getHashAlgorithm

public java.lang.String getHashAlgorithm()
Method to access the hashing algorithm of the password.

Returns:
the name of the hashing algorithm used for this user's password


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.