MemoryUser (Apache Tomcat 8.5.87 API Documentation)

Package org.apache.catalina.users

## Class MemoryUser

- java.lang.Object
- - org.apache.catalina.users.AbstractUser
  - - org.apache.catalina.users.MemoryUser

- All Implemented Interfaces:
    `java.security.Principal`, `User`

      @Deprecated
      public class MemoryUser
      extends AbstractUser

  Deprecated.
  Use `AbstractUser` instead.

  Concrete implementation of `User` for the `MemoryUserDatabase` implementation of `UserDatabase`.

  Since:
    4.1
  Author:
    Craig R. McClanahan

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected MemoryUserDatabase` | `database` | Deprecated. The `MemoryUserDatabase` that owns this user.
    `protected java.util.concurrent.CopyOnWriteArrayList<Group>` | `groups` | Deprecated. The set of `Group`s that this user is a member of.
    `protected java.util.concurrent.CopyOnWriteArrayList<Role>` | `roles` | Deprecated. The set of `Role`s associated with this user.

    - ### Fields inherited from class org.apache.catalina.users.AbstractUser

      `fullName, password, username`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addGroup​(Group group)` | Deprecated. Add a new `Group` to those this user belongs to.
    `void` | `addRole​(Role role)` | Deprecated. Add a new `Role` to those assigned specifically to this user.
    `java.util.Iterator<Group>` | `getGroups()` | Deprecated. Return the set of `Group`s to which this user belongs.
    `java.util.Iterator<Role>` | `getRoles()` | Deprecated. Return the set of `Role`s assigned specifically to this user.
    `UserDatabase` | `getUserDatabase()` | Deprecated. Return the `UserDatabase` within which this User is defined.
    `boolean` | `isInGroup​(Group group)` | Deprecated. Is this user in the specified group?
    `boolean` | `isInRole​(Role role)` | Deprecated. Is this user specifically assigned the specified `Role`?
    `void` | `removeGroup​(Group group)` | Deprecated. Remove a `Group` from those this user belongs to.
    `void` | `removeGroups()` | Deprecated. Remove all `Group`s from those this user belongs to.
    `void` | `removeRole​(Role role)` | Deprecated. Remove a `Role` from those assigned to this user.
    `void` | `removeRoles()` | Deprecated. Remove all `Role`s from those assigned to this user.
    `java.lang.String` | `toString()` | Deprecated. Return a String representation of this user.
    `java.lang.String` | `toXml()` | Deprecated. Return a String representation of this user in XML format.

    - ### Methods inherited from class org.apache.catalina.users.AbstractUser

      `getFullName, getName, getPassword, getUsername, setFullName, setPassword, setUsername`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.security.Principal

      `equals, hashCode, implies`

- - ### Field Detail

    - #### database

          protected final MemoryUserDatabase database

      Deprecated.
      The `MemoryUserDatabase` that owns this user.

    - #### groups

          protected final java.util.concurrent.CopyOnWriteArrayList<Group> groups

      Deprecated.
      The set of `Group`s that this user is a member of.

    - #### roles

          protected final java.util.concurrent.CopyOnWriteArrayList<Role> roles

      Deprecated.
      The set of `Role`s associated with this user.

  - ### Method Detail

    - #### getGroups

          public java.util.Iterator<Group> getGroups()

      Deprecated.
      Return the set of `Group`s to which this user belongs.
      Specified by:
        `getGroups` in interface `User`
      Specified by:
        `getGroups` in class `AbstractUser`
      Returns:
        the set of `Group`s to which this user belongs.

    - #### getRoles

          public java.util.Iterator<Role> getRoles()

      Deprecated.
      Return the set of `Role`s assigned specifically to this user.
      Specified by:
        `getRoles` in interface `User`
      Specified by:
        `getRoles` in class `AbstractUser`
      Returns:
        the set of `Role`s assigned specifically to this user.

    - #### getUserDatabase

          public UserDatabase getUserDatabase()

      Deprecated.
      Return the `UserDatabase` within which this User is defined.
      Returns:
        the `UserDatabase` within which this User is defined.

    - #### addGroup

          public void addGroup​(Group group)

      Deprecated.
      Add a new `Group` to those this user belongs to.
      Specified by:
        `addGroup` in interface `User`
      Specified by:
        `addGroup` in class `AbstractUser`
      Parameters:
        `group` - The new group

    - #### addRole

          public void addRole​(Role role)

      Deprecated.
      Add a new `Role` to those assigned specifically to this user.
      Specified by:
        `addRole` in interface `User`
      Specified by:
        `addRole` in class `AbstractUser`
      Parameters:
        `role` - The new role

    - #### isInGroup

          public boolean isInGroup​(Group group)

      Deprecated.
      Is this user in the specified group?
      Specified by:
        `isInGroup` in interface `User`
      Specified by:
        `isInGroup` in class `AbstractUser`
      Parameters:
        `group` - The group to check
      Returns:
        `true` if the user is in the specified group

    - #### isInRole

          public boolean isInRole​(Role role)

      Deprecated.
      Is this user specifically assigned the specified `Role`? This method does NOT check for roles inherited based on `Group` membership.
      Specified by:
        `isInRole` in interface `User`
      Specified by:
        `isInRole` in class `AbstractUser`
      Parameters:
        `role` - The role to check
      Returns:
        `true` if the user has the specified role

    - #### removeGroup

          public void removeGroup​(Group group)

      Deprecated.
      Remove a `Group` from those this user belongs to.
      Specified by:
        `removeGroup` in interface `User`
      Specified by:
        `removeGroup` in class `AbstractUser`
      Parameters:
        `group` - The old group

    - #### removeGroups

          public void removeGroups()

      Deprecated.
      Remove all `Group`s from those this user belongs to.
      Specified by:
        `removeGroups` in interface `User`
      Specified by:
        `removeGroups` in class `AbstractUser`

    - #### removeRole

          public void removeRole​(Role role)

      Deprecated.
      Remove a `Role` from those assigned to this user.
      Specified by:
        `removeRole` in interface `User`
      Specified by:
        `removeRole` in class `AbstractUser`
      Parameters:
        `role` - The old role

    - #### removeRoles

          public void removeRoles()

      Deprecated.
      Remove all `Role`s from those assigned to this user.
      Specified by:
        `removeRoles` in interface `User`
      Specified by:
        `removeRoles` in class `AbstractUser`

    - #### toXml

          public java.lang.String toXml()

      Deprecated.

      Return a String representation of this user in XML format.

      IMPLEMENTATION NOTE - For backwards compatibility, the reader that processes this entry will accept either `username` or `name` for the username property.

      Returns:
        the XML representation

    - #### toString

          public java.lang.String toString()

      Deprecated.

      Return a String representation of this user.

      Specified by:
        `toString` in interface `java.security.Principal`
      Overrides:
        `toString` in class `java.lang.Object`