org.wamblee.security.authentication
Class User

java.lang.Object
  extended by org.wamblee.security.authentication.User
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

@Entity
public class User
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

Represents a user. The methods for managing the groups of the user have package scope. Managing the groups of the user should be done through the UserAdministration interface.

See Also:
Serialized Form

Field Summary
static java.lang.String NAME_PARAM
           
static java.lang.String QUERY_ALL_USERS
           
static java.lang.String QUERY_COUNT_USERS
           
static java.lang.String QUERY_FIND_BY_GROUP_NAME
           
static java.lang.String QUERY_FIND_BY_NAME
           
 
Constructor Summary
User(User aUser)
          Creates a new User object.
 
Method Summary
 boolean changePassword(java.lang.String aOldPassword, java.lang.String aNewPassword)
          Changes the password.
 boolean checkPassword(java.lang.String aPassword)
          Checks the password.
 int compareTo(java.lang.Object aUser)
           
 boolean equals(java.lang.Object aUser)
           
 java.util.Set<Group> getGroups()
          Gets the groups the user belongs to.
 java.lang.String getName()
           
protected  java.lang.String getPasswordString()
          For OR mapping.
 java.lang.Long getPrimaryKey()
           
 int hashCode()
           
 boolean isInGroup(Group aGroup)
          Checks whether the user belongs to the given group.
 boolean isInGroup(java.lang.String aGroup)
          Checks whether the user belongs to the given group.
 void setPassword(java.lang.String aPassword)
           
 void setPasswordEncoder(MessageDigester aPasswordEncoder)
          Sets the password encoder.
protected  void setPasswordString(java.lang.String aPassword)
          For OR mapping.
 void setPasswordValidator(NameValidator aPasswordValidator)
          Sets the password validator.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_FIND_BY_NAME

public static final java.lang.String QUERY_FIND_BY_NAME
See Also:
Constant Field Values

QUERY_FIND_BY_GROUP_NAME

public static final java.lang.String QUERY_FIND_BY_GROUP_NAME
See Also:
Constant Field Values

QUERY_COUNT_USERS

public static final java.lang.String QUERY_COUNT_USERS
See Also:
Constant Field Values

QUERY_ALL_USERS

public static final java.lang.String QUERY_ALL_USERS
See Also:
Constant Field Values

NAME_PARAM

public static final java.lang.String NAME_PARAM
See Also:
Constant Field Values
Constructor Detail

User

public User(User aUser)
Creates a new User object.

Method Detail

setPasswordValidator

public void setPasswordValidator(NameValidator aPasswordValidator)
Sets the password validator.

Parameters:
aPasswordValidator - Validator.

setPasswordEncoder

public void setPasswordEncoder(MessageDigester aPasswordEncoder)
Sets the password encoder.

Parameters:
aPasswordEncoder - Encoder.

checkPassword

public boolean checkPassword(java.lang.String aPassword)
Checks the password.

Parameters:
aPassword - Password to check.
Returns:
True iff the password is correct.

changePassword

public boolean changePassword(java.lang.String aOldPassword,
                              java.lang.String aNewPassword)
Changes the password.

Parameters:
aOldPassword - Old password.
aNewPassword - New password.
Returns:
True iff the password was changed successfully.

setPassword

public void setPassword(java.lang.String aPassword)
Parameters:
aPassword - The password to set.

getPasswordString

protected java.lang.String getPasswordString()
For OR mapping.

Returns:
Password.

setPasswordString

protected void setPasswordString(java.lang.String aPassword)
For OR mapping.

Parameters:
aPassword - Password.

getName

public java.lang.String getName()
Returns:
Returns the _user.

getGroups

public java.util.Set<Group> getGroups()
Gets the groups the user belongs to.

Returns:
Groups.

isInGroup

public boolean isInGroup(Group aGroup)
Checks whether the user belongs to the given group.

Parameters:
aGroup - Group.
Returns:
True if the user belongs to the group.

isInGroup

public boolean isInGroup(java.lang.String aGroup)
Checks whether the user belongs to the given group.

Parameters:
aGroup - Group.
Returns:
True if the user belongs to the group.

equals

public boolean equals(java.lang.Object aUser)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object aUser)
Specified by:
compareTo in interface java.lang.Comparable

getPrimaryKey

public java.lang.Long getPrimaryKey()


Copyright © 2022. All Rights Reserved.