Package org.apache.catalina.users
Class GenericUser<UD extends UserDatabase>
- java.lang.Object
-
- org.apache.catalina.users.AbstractUser
-
- org.apache.catalina.users.GenericUser<UD>
-
- Type Parameters:
UD- The specific type of UserDase with which this role is associated
- Direct Known Subclasses:
MemoryUser
public class GenericUser<UD extends UserDatabase> extends AbstractUser
Concrete implementation of
Userfor aUserDatabase.- Author:
- Craig R. McClanahan
-
-
Field Summary
Fields Modifier and Type Field Description protected UDdatabaseTheUserDatabasethat owns this user.protected CopyOnWriteArrayList<Group>groupsThe set ofGroups that this user is a member of.protected CopyOnWriteArrayList<Role>rolesThe set ofRoles associated with this user.-
Fields inherited from class org.apache.catalina.users.AbstractUser
fullName, password, username
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGroup(Group group)Add a newGroupto those this user belongs to.voidaddRole(Role role)Add a newRoleto those assigned specifically to this user.booleanequals(Object obj)Iterator<Group>getGroups()Return the set ofGroups to which this user belongs.Iterator<Role>getRoles()Return the set ofRoles assigned specifically to this user.UserDatabasegetUserDatabase()Return theUserDatabasewithin which this User is defined.inthashCode()booleanisInGroup(Group group)Is this user in the specified group?booleanisInRole(Role role)Is this user specifically assigned the specifiedRole?voidremoveGroup(Group group)Remove aGroupfrom those this user belongs to.voidremoveGroups()Remove allGroups from those this user belongs to.voidremoveRole(Role role)Remove aRolefrom those assigned to this user.voidremoveRoles()Remove allRoles from those assigned to this user.voidsetFullName(String fullName)Set the full name of this user.voidsetPassword(String password)Set the logon password of this user, optionally prefixed with the identifier of an encoding scheme surrounded by curly braces, such as{md5}xxxxx.voidsetUsername(String username)Set the logon username of this user, which must be unique within the scope of aUserDatabase.-
Methods inherited from class org.apache.catalina.users.AbstractUser
getFullName, getName, getPassword, getUsername
-
-
-
-
Field Detail
-
database
protected final UD extends UserDatabase database
TheUserDatabasethat owns this user.
-
groups
protected final CopyOnWriteArrayList<Group> groups
The set ofGroups that this user is a member of.
-
roles
protected final CopyOnWriteArrayList<Role> roles
The set ofRoles associated with this user.
-
-
Method Detail
-
getGroups
public Iterator<Group> getGroups()
Return the set ofGroups to which this user belongs.- Specified by:
getGroupsin interfaceUser- Specified by:
getGroupsin classAbstractUser- Returns:
- the set of
Groups to which this user belongs.
-
getRoles
public Iterator<Role> getRoles()
Return the set ofRoles assigned specifically to this user.- Specified by:
getRolesin interfaceUser- Specified by:
getRolesin classAbstractUser- Returns:
- the set of
Roles assigned specifically to this user.
-
getUserDatabase
public UserDatabase getUserDatabase()
Return theUserDatabasewithin which this User is defined.- Returns:
- the
UserDatabasewithin which this User is defined.
-
addGroup
public void addGroup(Group group)
Add a newGroupto those this user belongs to.- Specified by:
addGroupin interfaceUser- Specified by:
addGroupin classAbstractUser- Parameters:
group- The new group
-
addRole
public void addRole(Role role)
Add a newRoleto those assigned specifically to this user.- Specified by:
addRolein interfaceUser- Specified by:
addRolein classAbstractUser- Parameters:
role- The new role
-
isInGroup
public boolean isInGroup(Group group)
Is this user in the specified group?- Specified by:
isInGroupin interfaceUser- Specified by:
isInGroupin classAbstractUser- Parameters:
group- The group to check- Returns:
trueif the user is in the specified group
-
isInRole
public boolean isInRole(Role role)
Is this user specifically assigned the specifiedRole? This method does NOT check for roles inherited based onGroupmembership.- Specified by:
isInRolein interfaceUser- Specified by:
isInRolein classAbstractUser- Parameters:
role- The role to check- Returns:
trueif the user has the specified role
-
removeGroup
public void removeGroup(Group group)
Remove aGroupfrom those this user belongs to.- Specified by:
removeGroupin interfaceUser- Specified by:
removeGroupin classAbstractUser- Parameters:
group- The old group
-
removeGroups
public void removeGroups()
Remove allGroups from those this user belongs to.- Specified by:
removeGroupsin interfaceUser- Specified by:
removeGroupsin classAbstractUser
-
removeRole
public void removeRole(Role role)
Remove aRolefrom those assigned to this user.- Specified by:
removeRolein interfaceUser- Specified by:
removeRolein classAbstractUser- Parameters:
role- The old role
-
removeRoles
public void removeRoles()
Remove allRoles from those assigned to this user.- Specified by:
removeRolesin interfaceUser- Specified by:
removeRolesin classAbstractUser
-
setFullName
public void setFullName(String fullName)
Description copied from class:AbstractUserSet the full name of this user.- Specified by:
setFullNamein interfaceUser- Overrides:
setFullNamein classAbstractUser- Parameters:
fullName- The new full name
-
setPassword
public void setPassword(String password)
Description copied from class:AbstractUserSet the logon password of this user, optionally prefixed with the identifier of an encoding scheme surrounded by curly braces, such as{md5}xxxxx.- Specified by:
setPasswordin interfaceUser- Overrides:
setPasswordin classAbstractUser- Parameters:
password- The new logon password
-
setUsername
public void setUsername(String username)
Description copied from class:AbstractUserSet the logon username of this user, which must be unique within the scope of aUserDatabase.- Specified by:
setUsernamein interfaceUser- Overrides:
setUsernamein classAbstractUser- Parameters:
username- The new logon username
-
equals
public boolean equals(Object obj)
-
-