org.apache.cassandra.auth

## Class AuthenticatedUser

- java.lang.Object
- - org.apache.cassandra.auth.AuthenticatedUser

-     public class AuthenticatedUser
      extends java.lang.Object

  Returned from IAuthenticator#authenticate(), represents an authenticated user everywhere internally. Holds the name of the user and the roles that have been granted to the user. The roles will be cached for roles_validity_in_ms.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static AuthenticatedUser` | `ANONYMOUS_USER`
    `static java.lang.String` | `ANONYMOUS_USERNAME`
    `static AuthenticatedUser` | `SYSTEM_USER`
    `static java.lang.String` | `SYSTEM_USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthenticatedUser(java.lang.String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.String` | `getName()`
    `java.util.Set<Permission>` | `getPermissions(IResource resource)`
    `RoleResource` | `getPrimaryRole()`
    `java.util.Set<RoleResource>` | `getRoles()` Get the roles that have been granted to the user via the IRoleManager
    `int` | `hashCode()`
    `boolean` | `isAnonymous()` If IAuthenticator doesn't require authentication, this method may return true.
    `boolean` | `isSuper()` Checks the user's superuser status.
    `boolean` | `isSystem()` Some internal operations are performed on behalf of Cassandra itself, in those cases the system user should be used where an identity is required see CreateRoleStatement#execute() and overrides of SchemaAlteringStatement#grantPermissionsToCreator()
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### SYSTEM_USERNAME

          public static final java.lang.String SYSTEM_USERNAME

      See Also:
        Constant Field Values

    - #### SYSTEM_USER

          public static final AuthenticatedUser SYSTEM_USER

    - #### ANONYMOUS_USERNAME

          public static final java.lang.String ANONYMOUS_USERNAME

      See Also:
        Constant Field Values

    - #### ANONYMOUS_USER

          public static final AuthenticatedUser ANONYMOUS_USER

  - ### Constructor Detail

    - #### AuthenticatedUser

          public AuthenticatedUser(java.lang.String name)

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

    - #### getPrimaryRole

          public RoleResource getPrimaryRole()

    - #### isSuper

          public boolean isSuper()

      Checks the user's superuser status. Only a superuser is allowed to perform CREATE USER and DROP USER queries. Im most cased, though not necessarily, a superuser will have Permission.ALL on every resource (depends on IAuthorizer implementation).

    - #### isAnonymous

          public boolean isAnonymous()

      If IAuthenticator doesn't require authentication, this method may return true.

    - #### isSystem

          public boolean isSystem()

      Some internal operations are performed on behalf of Cassandra itself, in those cases the system user should be used where an identity is required see CreateRoleStatement#execute() and overrides of SchemaAlteringStatement#grantPermissionsToCreator()

    - #### getRoles

          public java.util.Set<RoleResource> getRoles()

      Get the roles that have been granted to the user via the IRoleManager
      Returns:
        a list of roles that have been granted to the user

    - #### getPermissions

          public java.util.Set<Permission> getPermissions(IResource resource)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

Copyright © 2018 The Apache Software Foundation