|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.boylesoftware.cb2.util.PrincipalWithRoles
Simple implementation of Java's Principal interface,
which adds a list of security roles attached to the principal.
| Constructor Summary | |
PrincipalWithRoles(java.lang.String name,
java.util.Set roles)
Constructs a principal. |
|
| Method Summary | |
boolean |
equals(java.lang.Object obj)
Checks if this principal is the same as another. |
java.lang.String |
getName()
Gets the principal's unique name. |
int |
hashCode()
Returns the object's hash code. |
boolean |
isInRole(java.lang.String role)
Checks if this principal plays the specified role. |
java.lang.String |
toString()
Gets string representation of this principal. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public PrincipalWithRoles(java.lang.String name,
java.util.Set roles)
name - the principal's unique name.roles - collection of principal's roles, contains
objects of String. Cannot be null.| Method Detail |
public java.lang.String getName()
getName in interface java.security.Principalpublic boolean equals(java.lang.Object obj)
PrincipalWithRoles or derived and has
equal name.
equals in interface java.security.Principalobj - another principal.
true if principals are the same.public int hashCode()
hashCode in interface java.security.Principalpublic java.lang.String toString()
toString in interface java.security.Principalpublic boolean isInRole(java.lang.String role)
true for
role "user" and always false for role "nobody".
role - the role name.
true if this principal plays the role.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||