Top Description Fields Constructors Methods
org.apache.catalina.users

public Class GenericUser<UD extends UserDatabase>

extends AbstractUser
Class Inheritance
Known Direct Subclasses
org.apache.catalina.users.MemoryUser
Type Parameters
<UD>
The specific type of UserDase with which this role is associated
Imports
java.util.Iterator, .List, java.util.concurrent.CopyOnWriteArrayList, org.apache.catalina.Group, .Role, .UserDatabase

Concrete implementation of org.apache.catalina.User for a UserDatabase.

Author
Craig R. McClanahan

Field Summary

Modifier and TypeField and Description
protected final UD
database

The UserDatabase that owns this user.

protected final CopyOnWriteArrayList<Group>
groups

The set of Groups that this user is a member of.

protected final CopyOnWriteArrayList<Role>
roles

The set of Roles associated with this user.

Inherited from org.apache.catalina.users.AbstractUser:
fullNamepasswordusername

Constructor Summary

AccessConstructor and Description
pack-priv
GenericUser(UD
The UserDatabase that owns this user
database
,
String
Logon username of the new user
username
,
String
Logon password of the new user
password
,
String
Full name of the new user
fullName
,
List<Group>
The groups of this user
groups
,
List<Role>
The roles of this user
roles
)

Package-private constructor used by the factory method in UserDatabase.

Method Summary

Modifier and TypeMethod and Description
public void
addGroup(Group
The new group
group
)

Implements abstract org.apache.catalina.users.AbstractUser.addGroup.

Implements org.apache.catalina.User.addGroup.

Add a new Group to those this user belongs to.

public void
addRole(Role
The new role
role
)

Implements abstract org.apache.catalina.users.AbstractUser.addRole.

Implements org.apache.catalina.User.addRole.

Add a new Role to those assigned specifically to this user.

public boolean
equals(Object
Principal to compare with.
obj
)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Compares this Principal to the specified object.

public Iterator<Group>
getGroups()

Implements abstract org.apache.catalina.users.AbstractUser.getGroups.

Implements org.apache.catalina.User.getGroups.

Return the set of Groups to which this user belongs.

public Iterator<Role>
getRoles()

Implements abstract org.apache.catalina.users.AbstractUser.getRoles.

Implements org.apache.catalina.User.getRoles.

Return the set of Roles assigned specifically to this user.

public UserDatabase
getUserDatabase()

Implements org.apache.catalina.User.getUserDatabase.

Return the UserDatabase within which this User is defined.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Returns a hashcode for this Principal.

public boolean
isInGroup(Group
The group to check
group
)

Implements abstract org.apache.catalina.users.AbstractUser.isInGroup.

Implements org.apache.catalina.User.isInGroup.

Is this user in the specified group?

public boolean
isInRole(Role
The role to check
role
)

Implements abstract org.apache.catalina.users.AbstractUser.isInRole.

Implements org.apache.catalina.User.isInRole.

Is this user specifically assigned the specified Role?

public void
removeGroup(Group
The old group
group
)

Implements abstract org.apache.catalina.users.AbstractUser.removeGroup.

Implements org.apache.catalina.User.removeGroup.

Remove a Group from those this user belongs to.

public void
removeGroups()

Implements abstract org.apache.catalina.users.AbstractUser.removeGroups.

Implements org.apache.catalina.User.removeGroups.

Remove all Groups from those this user belongs to.

public void
removeRole(Role
The old role
role
)

Implements abstract org.apache.catalina.users.AbstractUser.removeRole.

Implements org.apache.catalina.User.removeRole.

Remove a Role from those assigned to this user.

public void
removeRoles()

Implements abstract org.apache.catalina.users.AbstractUser.removeRoles.

Implements org.apache.catalina.User.removeRoles.

Remove all Roles from those assigned to this user.

public void
setFullName(String
The new full name
fullName
)

Overrides org.apache.catalina.users.AbstractUser.setFullName.

Implements org.apache.catalina.User.setFullName.

Set the full name of this user.

public void
setPassword(String
The new logon password
password
)

Overrides org.apache.catalina.users.AbstractUser.setPassword.

Implements org.apache.catalina.User.setPassword.

Set the logon password of this user, optionally prefixed with the identifier of an encoding scheme surrounded by curly braces, such as {md5}xxxxx.

public void
setUsername(String
The new logon username
username
)

Overrides org.apache.catalina.users.AbstractUser.setUsername.

Implements org.apache.catalina.User.setUsername.

Set the logon username of this user, which must be unique within the scope of a org.apache.catalina.UserDatabase.

Inherited from org.apache.catalina.users.AbstractUser:
getFullNamegetNamegetPasswordgetUsername

Field Detail

databaseback to summary
protected final UD database

The UserDatabase that owns this user.

groupsback to summary
protected final CopyOnWriteArrayList<Group> groups

The set of Groups that this user is a member of.

rolesback to summary
protected final CopyOnWriteArrayList<Role> roles

The set of Roles associated with this user.

Constructor Detail

GenericUserback to summary
pack-priv GenericUser(UD database, String username, String password, String fullName, List<Group> groups, List<Role> roles)

Package-private constructor used by the factory method in UserDatabase.

Parameters
database:UD

The UserDatabase that owns this user

username:String

Logon username of the new user

password:String

Logon password of the new user

fullName:String

Full name of the new user

groups:List<Group>

The groups of this user

roles:List<Role>

The roles of this user

Method Detail

addGroupback to summary
public void addGroup(Group group)

Implements abstract org.apache.catalina.users.AbstractUser.addGroup.

Implements org.apache.catalina.User.addGroup.

Add a new Group to those this user belongs to.

Parameters
group:Group

The new group

Annotations
@Override
addRoleback to summary
public void addRole(Role role)

Implements abstract org.apache.catalina.users.AbstractUser.addRole.

Implements org.apache.catalina.User.addRole.

Add a new Role to those assigned specifically to this user.

Parameters
role:Role

The new role

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Doc from java.security.Principal.equals.

Compares this Principal to the specified object. Returns true if the object passed in matches the Principal represented by the implementation of this interface.

Parameters
obj:Object

Principal to compare with.

Returns:boolean

true if the Principal passed in is the same as that encapsulated by this Principal, and false otherwise.

Annotations
@Override
getGroupsback to summary
public Iterator<Group> getGroups()

Implements abstract org.apache.catalina.users.AbstractUser.getGroups.

Implements org.apache.catalina.User.getGroups.

Return the set of Groups to which this user belongs.

Returns:Iterator<Group>

Doc from org.apache.catalina.User.getGroups.

the set of Groups to which this user belongs.

Annotations
@Override
getRolesback to summary
public Iterator<Role> getRoles()

Implements abstract org.apache.catalina.users.AbstractUser.getRoles.

Implements org.apache.catalina.User.getRoles.

Return the set of Roles assigned specifically to this user.

Returns:Iterator<Role>

Doc from org.apache.catalina.User.getRoles.

the set of Roles assigned specifically to this user.

Annotations
@Override
getUserDatabaseback to summary
public UserDatabase getUserDatabase()

Implements org.apache.catalina.User.getUserDatabase.

Return the UserDatabase within which this User is defined.

Returns:UserDatabase

Doc from org.apache.catalina.User.getUserDatabase.

the UserDatabase within which this User is defined.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Doc from java.security.Principal.hashCode.

Returns a hashcode for this Principal.

Returns:int

a hashcode for this Principal

Annotations
@Override
isInGroupback to summary
public boolean isInGroup(Group group)

Implements abstract org.apache.catalina.users.AbstractUser.isInGroup.

Implements org.apache.catalina.User.isInGroup.

Is this user in the specified group?

Parameters
group:Group

The group to check

Returns:boolean

Doc from org.apache.catalina.User.isInGroup.

true if the user is in the specified group

Annotations
@Override
isInRoleback to summary
public boolean isInRole(Role role)

Implements abstract org.apache.catalina.users.AbstractUser.isInRole.

Implements org.apache.catalina.User.isInRole.

Is this user specifically assigned the specified Role? This method does NOT check for roles inherited based on Group membership.

Parameters
role:Role

The role to check

Returns:boolean

Doc from org.apache.catalina.User.isInRole.

true if the user has the specified role

Annotations
@Override
removeGroupback to summary
public void removeGroup(Group group)

Implements abstract org.apache.catalina.users.AbstractUser.removeGroup.

Implements org.apache.catalina.User.removeGroup.

Remove a Group from those this user belongs to.

Parameters
group:Group

The old group

Annotations
@Override
removeGroupsback to summary
public void removeGroups()

Implements abstract org.apache.catalina.users.AbstractUser.removeGroups.

Implements org.apache.catalina.User.removeGroups.

Remove all Groups from those this user belongs to.

Annotations
@Override
removeRoleback to summary
public void removeRole(Role role)

Implements abstract org.apache.catalina.users.AbstractUser.removeRole.

Implements org.apache.catalina.User.removeRole.

Remove a Role from those assigned to this user.

Parameters
role:Role

The old role

Annotations
@Override
removeRolesback to summary
public void removeRoles()

Implements abstract org.apache.catalina.users.AbstractUser.removeRoles.

Implements org.apache.catalina.User.removeRoles.

Remove all Roles from those assigned to this user.

Annotations
@Override
setFullNameback to summary
public void setFullName(String fullName)

Overrides org.apache.catalina.users.AbstractUser.setFullName.

Implements org.apache.catalina.User.setFullName.

Doc from org.apache.catalina.users.AbstractUser.setFullName.

Set the full name of this user.

Parameters
fullName:String

The new full name

Annotations
@Override
setPasswordback to summary
public void setPassword(String password)

Overrides org.apache.catalina.users.AbstractUser.setPassword.

Implements org.apache.catalina.User.setPassword.

Doc from org.apache.catalina.users.AbstractUser.setPassword.

Set the logon password of this user, optionally prefixed with the identifier of an encoding scheme surrounded by curly braces, such as {md5}xxxxx.

Parameters
password:String

The new logon password

Annotations
@Override
setUsernameback to summary
public void setUsername(String username)

Overrides org.apache.catalina.users.AbstractUser.setUsername.

Implements org.apache.catalina.User.setUsername.

Doc from org.apache.catalina.users.AbstractUser.setUsername.

Set the logon username of this user, which must be unique within the scope of a org.apache.catalina.UserDatabase.

Parameters
username:String

The new logon username

Annotations
@Override