org.apache.catalina.realm

## Class UserDatabaseRealm.UserDatabasePrincipal

- java.lang.Object
- - org.apache.catalina.realm.GenericPrincipal
  - - org.apache.catalina.realm.UserDatabaseRealm.UserDatabasePrincipal

- All Implemented Interfaces:
    Serializable, Principal, TomcatPrincipal
  Enclosing class:
    UserDatabaseRealm

      public static final class UserDatabaseRealm.UserDatabasePrincipal
      extends GenericPrincipal

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.catalina.realm.GenericPrincipal

      `gssCredential, loginContext, name, password, roles, userPrincipal`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserDatabaseRealm.UserDatabasePrincipal(User user, UserDatabase database)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getRoles()`
    `boolean` | `hasRole(String role)` Does the user represented by this Principal possess the specified role?

    - ### Methods inherited from class org.apache.catalina.realm.GenericPrincipal

      `getGssCredential, getName, getPassword, getUserPrincipal, logout, setGssCredential, toString`

    - ### 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`

- - ### Constructor Detail

    - #### UserDatabaseRealm.UserDatabasePrincipal

          public UserDatabaseRealm.UserDatabasePrincipal(User user,
                                                 UserDatabase database)

  - ### Method Detail

    - #### getRoles

          public String[] getRoles()

      Overrides:
        `getRoles` in class `GenericPrincipal`

    - #### hasRole

          public boolean hasRole(String role)

      Description copied from class: `GenericPrincipal`
      Does the user represented by this Principal possess the specified role?
      Overrides:
        `hasRole` in class `GenericPrincipal`
      Parameters:
        `role` - Role to be tested
      Returns:
        `true` if this Principal has been assigned the given role, otherwise `false`

Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.