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
Principal implementation backed by a live
UserDatabase. Roles are fetched from the database
on each call rather than cached at construction time.- Since:
- 4.1
- See Also:
-
Field Summary
Fields inherited from class GenericPrincipal
attributes, gssCredential, loginContext, name, roles, userPrincipal -
Constructor Summary
ConstructorsConstructorDescriptionUserDatabasePrincipal(User user, UserDatabase database) Constructs a new UserDatabasePrincipal. -
Method Summary
Methods inherited from class GenericPrincipal
equals, getAttribute, getAttributeNames, getGssCredential, getName, getUserPrincipal, hashCode, logout, setGssCredential, toString
-
Constructor Details
-
UserDatabasePrincipal
Constructs a new UserDatabasePrincipal.- Parameters:
user- The userdatabase- The user database
-
-
Method Details
-
getRoles
Description copied from class:GenericPrincipalReturns the set of roles associated with this user.- Overrides:
getRolesin classGenericPrincipal- Returns:
- A cloned array of role names
-
hasRole
Description copied from class:GenericPrincipalDoes the user represented by this Principal possess the specified role?- Overrides:
hasRolein classGenericPrincipal- Parameters:
role- Role to be tested- Returns:
trueif this Principal has been assigned the given role, otherwisefalse
-