Class CassandraPrincipal

java.lang.Object
org.apache.cassandra.auth.CassandraPrincipal
All Implemented Interfaces:
Serializable, Principal

public class CassandraPrincipal extends Object implements Principal, Serializable

This class implements the Principal interface and represents a user.

Principals such as this CassPrincipal may be associated with a particular Subject to augment that Subject with an additional identity. Refer to the Subject class for more information on how to achieve this. Authorization decisions can then be based upon the Principals associated with a Subject.

See Also:
  • Constructor Details

    • CassandraPrincipal

      public CassandraPrincipal(String name)
      Create a CassPrincipal with a username.

      Parameters:
      name - the username for this user.
      Throws:
      NullPointerException - if the name is null.
  • Method Details

    • getName

      public String getName()
      Return the username for this CassPrincipal.

      Specified by:
      getName in interface Principal
      Returns:
      the username for this CassPrincipal
    • toString

      public String toString()
      Return a string representation of this CassPrincipal.

      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
      Returns:
      a string representation of this CassPrincipal.
    • equals

      public boolean equals(Object o)
      Compares the specified Object with this CassPrincipal for equality. Returns true if the given object is also a CassPrincipal and the two CassPrincipals have the same username.

      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
      Parameters:
      o - Object to be compared for equality with this CassPrincipal.
      Returns:
      true if the specified Object is equal equal to this CassPrincipal.
    • hashCode

      public int hashCode()
      Return a hash code for this CassPrincipal.

      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object
      Returns:
      a hash code for this CassPrincipal.