GenericUser (Apache Tomcat 11.0.21 API Documentation)
Description: declaration: package: org.apache.catalina.users, class: GenericUser

# 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

All Implemented Interfaces:
  `Principal, User`

public class GenericUser<UD extends UserDatabase> extends AbstractUser

Concrete implementation of `User` for a `UserDatabase`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final UD`
  `database`
  The `UserDatabase` that owns this user.
  `protected final CopyOnWriteArrayList<Group>`
  `groups`
  The set of `Group`s that this user is a member of.
  `protected final CopyOnWriteArrayList<Role>`
  `roles`
  The set of `Role`s associated with this user.

  ### Fields inherited from class AbstractUser

  `fullName, password, username`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addGroup(Group group)`
  Add a new `Group` to those this user belongs to.
  `void`
  `addRole(Role role)`
  Add a `Role` to those assigned specifically to this user.
  `boolean`
  `equals(Object obj)`
  `Iterator<Group>`
  `getGroups()`
  `Iterator<Role>`
  `getRoles()`
  `UserDatabase`
  `getUserDatabase()`
  `int`
  `hashCode()`
  `boolean`
  `isInGroup(Group group)`
  Is this user in the specified `Group`?
  `boolean`
  `isInRole(Role role)`
  Is this user specifically assigned the specified `Role`?
  `void`
  `removeGroup(Group group)`
  Remove a `Group` from those this user belongs to.
  `void`
  `removeGroups()`
  Remove all `Group`s from those this user belongs to.
  `void`
  `removeRole(Role role)`
  Remove a `Role` from those assigned to this user.
  `void`
  `removeRoles()`
  Remove all `Role`s from those assigned to this user.
  `void`
  `setFullName(String fullName)`
  Set the full name of this user.
  `void`
  `setPassword(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`.
  `void`
  `setUsername(String username)`
  Set the logon username of this user, which must be unique within the scope of a `UserDatabase`.

  ### Methods inherited from class AbstractUser

  `getFullName, getName, getPassword, getUsername`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface Principal

  `implies, toString`

- ## Field Details

  - ### database

    protected final UD extends UserDatabase database
    The `UserDatabase` that owns this user.

  - ### groups

    protected final CopyOnWriteArrayList<Group> groups
    The set of `Group`s that this user is a member of.

  - ### roles

    protected final CopyOnWriteArrayList<Role> roles
    The set of `Role`s associated with this user.

- ## Method Details

  - ### getGroups

    public Iterator<Group> getGroups()
    Returns:
      the set of `Group`s to which this user belongs.

  - ### getRoles

    public Iterator<Role> getRoles()
    Returns:
      the set of `Role`s assigned specifically to this user.

  - ### getUserDatabase

    public UserDatabase getUserDatabase()
    Returns:
      the `UserDatabase` within which this User is defined.

  - ### addGroup

    public void addGroup(Group group)
    Description copied from interface: `User`
    Add a new `Group` to those this user belongs to.
    Parameters:
      `group` - The new group

  - ### addRole

    public void addRole(Role role)
    Description copied from interface: `User`
    Add a `Role` to those assigned specifically to this user.
    Parameters:
      `role` - The new role

  - ### isInGroup

    public boolean isInGroup(Group group)
    Description copied from interface: `User`
    Is this user in the specified `Group`?
    Parameters:
      `group` - The group to check
    Returns:
      `true` if the user is in the specified group

  - ### isInRole

    public boolean isInRole(Role role)
    Description copied from interface: `User`
    Is this user specifically assigned the specified `Role`? This method does NOT check for roles inherited based on `Group` membership.
    Parameters:
      `role` - The role to check
    Returns:
      `true` if the user has the specified role

  - ### removeGroup

    public void removeGroup(Group group)
    Description copied from interface: `User`
    Remove a `Group` from those this user belongs to.
    Parameters:
      `group` - The old group

  - ### removeGroups

    public void removeGroups()
    Description copied from interface: `User`
    Remove all `Group`s from those this user belongs to.

  - ### removeRole

    public void removeRole(Role role)
    Description copied from interface: `User`
    Remove a `Role` from those assigned to this user.
    Parameters:
      `role` - The old role

  - ### removeRoles

    public void removeRoles()
    Description copied from interface: `User`
    Remove all `Role`s from those assigned to this user.

  - ### setFullName

    public void setFullName(String fullName)
    Description copied from interface: `User`
    Set the full name of this user.
    Specified by:
      `setFullName` in interface `User`
    Overrides:
      `setFullName` in class `AbstractUser`
    Parameters:
      `fullName` - The new full name

  - ### setPassword

    public void setPassword(String password)
    Description copied from interface: `User`
    Set 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:
      `setPassword` in interface `User`
    Overrides:
      `setPassword` in class `AbstractUser`
    Parameters:
      `password` - The new logon password

  - ### setUsername

    public void setUsername(String username)
    Description copied from interface: `User`
    Set the logon username of this user, which must be unique within the scope of a `UserDatabase`.
    Specified by:
      `setUsername` in interface `User`
    Overrides:
      `setUsername` in class `AbstractUser`
    Parameters:
      `username` - The new logon username

  - ### equals

    public boolean equals(Object obj)
    Specified by:
      `equals` in interface `Principal`
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in interface `Principal`
    Overrides:
      `hashCode` in class `Object`