public final class Role
extends java.lang.Object
implements java.security.Principal, java.io.Serializable
Authorizer
, such as a web
container.Modifier and Type | Field and Description |
---|---|
static Role |
ADMIN |
static Role |
ALL
All users, regardless of authentication status
|
static Role |
ANONYMOUS
If the user hasn't supplied a name
|
static Role |
ASSERTED
If the user has supplied a cookie with a username
|
static Role |
AUTHENTICATED
If the user has authenticated with the Container or UserDatabase
|
Modifier | Constructor and Description |
---|---|
protected |
Role()
Create an empty Role.
|
|
Role(java.lang.String name)
Constructs a new Role with a given name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Two Role objects are considered equal if their names are identical.
|
java.lang.String |
getName()
Returns the name of the Principal.
|
int |
hashCode()
Returns a unique hashcode for the Role.
|
static boolean |
isBuiltInRole(Role role)
|
static boolean |
isReservedName(java.lang.String name)
Returns
true if the supplied name is identical to the name
of a built-in Role; that is, the value returned by getName()
for built-in Roles ALL , ANONYMOUS ,
ASSERTED , or AUTHENTICATED . |
java.lang.String |
toString()
Returns a String representation of the role
|
public static final Role ALL
public static final Role ANONYMOUS
public static final Role ASSERTED
public static final Role AUTHENTICATED
public static final Role ADMIN
protected Role()
public Role(java.lang.String name)
name
- the name of the Rolepublic static boolean isBuiltInRole(Role role)
role
- the role to checkpublic static boolean isReservedName(java.lang.String name)
true
if the supplied name is identical to the name
of a built-in Role; that is, the value returned by getName()
for built-in Roles ALL
, ANONYMOUS
,
ASSERTED
, or AUTHENTICATED
.name
- the name to be testedtrue
if the name is reserved; false
if not@CheckReturnValue public int hashCode()
hashCode
in interface java.security.Principal
hashCode
in class java.lang.Object
@CheckReturnValue public boolean equals(java.lang.Object obj)
equals
in interface java.security.Principal
equals
in class java.lang.Object
obj
- the object to testtrue
if both objects are of type Role and have identical namesObject.equals(java.lang.Object)
public java.lang.String getName()
getName
in interface java.security.Principal
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in interface java.security.Principal
toString
in class java.lang.Object
Object.toString()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.