public class GrantedAuthorityImpl extends java.lang.Object implements GrantedAuthority, java.io.Serializable
GrantedAuthority.
Stores a String representation of an authority granted to the Authentication object.
If compared to a custom authority which returns null from getAuthority(), the compareTo
method will return -1, so the custom authority will take precedence.
| Constructor and Description |
|---|
GrantedAuthorityImpl(java.lang.String role) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.lang.Object o) |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAuthority()
If the
GrantedAuthority can be represented as a String and that
String is sufficient in precision to be relied upon for an access control decision by an AccessDecisionManager (or delegate), this method should return such a String. |
int |
hashCode() |
java.lang.String |
toString() |
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String getAuthority()
GrantedAuthorityGrantedAuthority can be represented as a String and that
String is sufficient in precision to be relied upon for an access control decision by an AccessDecisionManager (or delegate), this method should return such a String.If the
GrantedAuthority cannot be expressed with sufficient precision as a String,
null should be returned. Returning null will require an
AccessDecisionManager (or delegate) to specifically support the GrantedAuthority
implementation, so returning null should be avoided unless actually required.
getAuthority in interface GrantedAuthoritynull if the granted authority cannot be
expressed as a String with sufficient precision).public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparable