Interface Principal
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
EverybodyPrincipal,SimplePrincipal
public interface Principal extends Serializable
This interface represents the abstract notion of a principal, which can be used to represent a set of permissions on the system.- Author:
- marrink
- See Also:
Principal
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanequals(Object another)Compares this principal to the specified object.StringgetName()Returns the name of this principal.inthashCode()Returns a hashcode for this principal.booleanimplies(Subject subject)Even though a subject does not explicitly hold a principal, it may still be implied by the subject.StringtoString()Returns a string representation of this principal.
-
-
-
Method Detail
-
equals
boolean equals(Object another)
Compares this principal to the specified object. Returns true if the object passed in matches the principal represented by the implementation of this interface.
-
toString
String toString()
Returns a string representation of this principal.
-
hashCode
int hashCode()
Returns a hashcode for this principal.
-
getName
String getName()
Returns the name of this principal.- Returns:
- the name of this principal.
-
implies
boolean implies(Subject subject)
Even though a subject does not explicitly hold a principal, it may still be implied by the subject. For example a 'read' and a 'write' principal, if the subject only holds the 'write' principal it is only logical it also implies the 'read' principal. Note principals don't have actions like permissions, the term 'read' principal is used to describe a principal containing a set of permissions granting a render action, just like the 'write' principal contains the same set of permissions only granting the enable action.- Parameters:
subject- a subject or null if no user has logged in yet- Returns:
- true if the subject in any way implies this principal, false otherwise.
-
-