Package org.apache.cassandra.auth
Class CassandraPrincipal
- java.lang.Object
-
- org.apache.cassandra.auth.CassandraPrincipal
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.Principal
public class CassandraPrincipal extends java.lang.Object implements java.security.Principal, java.io.Serializable
This class implements the
Principal
interface and represents a user.Principals such as this
CassPrincipal
may be associated with a particularSubject
to augment thatSubject
with an additional identity. Refer to theSubject
class for more information on how to achieve this. Authorization decisions can then be based upon the Principals associated with aSubject
.- See Also:
Principal
,Subject
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CassandraPrincipal(java.lang.String name)
Create a CassPrincipal with a username.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Compares the specified Object with thisCassPrincipal
for equality.java.lang.String
getName()
Return the username for thisCassPrincipal
.int
hashCode()
Return a hash code for thisCassPrincipal
.java.lang.String
toString()
Return a string representation of thisCassPrincipal
.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Return the username for thisCassPrincipal
.- Specified by:
getName
in interfacejava.security.Principal
- Returns:
- the username for this
CassPrincipal
-
toString
public java.lang.String toString()
Return a string representation of thisCassPrincipal
.- Specified by:
toString
in interfacejava.security.Principal
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this
CassPrincipal
.
-
equals
public boolean equals(java.lang.Object o)
Compares the specified Object with thisCassPrincipal
for equality. Returns true if the given object is also aCassPrincipal
and the two CassPrincipals have the same username.- Specified by:
equals
in interfacejava.security.Principal
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- Object to be compared for equality with thisCassPrincipal
.- Returns:
- true if the specified Object is equal equal to this
CassPrincipal
.
-
hashCode
public int hashCode()
Return a hash code for thisCassPrincipal
.- Specified by:
hashCode
in interfacejava.security.Principal
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this
CassPrincipal
.
-
-