Package org.apache.wiki.auth.authorize
Class Role
java.lang.Object
org.apache.wiki.auth.authorize.Role
- All Implemented Interfaces:
Serializable
,Principal
A lightweight, immutable Principal that represents a built-in wiki role such
as Anonymous, Asserted and Authenticated. It can also represent dynamic roles
used by an external
Authorizer
, such as a web
container.- Since:
- 2.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Role
All users, regardless of authentication statusstatic final Role
If the user hasn't supplied a namestatic final Role
If the user has supplied a cookie with a usernamestatic final Role
If the user has authenticated with the Container or UserDatabase -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two Role objects are considered equal if their names are identical.getName()
Returns the name of the Principal.int
hashCode()
Returns a unique hashcode for the Role.static boolean
isBuiltInRole
(Role role) static boolean
isReservedName
(String name) Returnstrue
if the supplied name is identical to the name of a built-in Role; that is, the value returned bygetName()
for built-in RolesALL
,ANONYMOUS
,ASSERTED
, orAUTHENTICATED
.toString()
Returns a String representation of the role
-
Field Details
-
ALL
All users, regardless of authentication status -
ANONYMOUS
If the user hasn't supplied a name -
ASSERTED
If the user has supplied a cookie with a username -
AUTHENTICATED
If the user has authenticated with the Container or UserDatabase
-
-
Constructor Details
-
Role
Constructs a new Role with a given name.- Parameters:
name
- the name of the Role
-
-
Method Details
-
isBuiltInRole
- Parameters:
role
- the role to check- Returns:
- the result of the check
-
isReservedName
Returnstrue
if the supplied name is identical to the name of a built-in Role; that is, the value returned bygetName()
for built-in RolesALL
,ANONYMOUS
,ASSERTED
, orAUTHENTICATED
.- Parameters:
name
- the name to be tested- Returns:
true
if the name is reserved;false
if not
-
hashCode
Returns a unique hashcode for the Role. -
equals
Two Role objects are considered equal if their names are identical. -
getName
Returns the name of the Principal. -
toString
Returns a String representation of the role
-