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 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:
    `Principal`, `Subject`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CassandraPrincipal(java.lang.String name)` Create a CassPrincipal with a username.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)` Compares the specified Object with this `CassPrincipal` for equality.
    `java.lang.String` | `getName()` Return the username for this `CassPrincipal`.
    `int` | `hashCode()` Return a hash code for this `CassPrincipal`.
    `java.lang.String` | `toString()` Return a string representation of this `CassPrincipal`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.security.Principal

      `implies`

- - ### Constructor Detail

    - #### CassandraPrincipal

          public CassandraPrincipal(java.lang.String name)

      Create a CassPrincipal with a username.

      Parameters:
        `name` - the username for this user.
      Throws:
        `java.lang.NullPointerException` - if the `name` is `null`.

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Return the username for this `CassPrincipal`.

      Specified by:
        `getName` in interface `java.security.Principal`
      Returns:
        the username for this `CassPrincipal`

    - #### toString

          public java.lang.String toString()

      Return a string representation of this `CassPrincipal`.

      Specified by:
        `toString` in interface `java.security.Principal`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of this `CassPrincipal`.

    - #### equals

          public boolean equals(java.lang.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 `java.security.Principal`
      Overrides:
        `equals` in class `java.lang.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 `java.security.Principal`
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a hash code for this `CassPrincipal`.

Copyright © 2018 The Apache Software Foundation