org.apache.cassandra.service

## Class ClientState

- java.lang.Object
- - org.apache.cassandra.service.ClientState

Direct Known Subclasses:
  ThriftClientState

    public class ClientState
    extends java.lang.Object

State related to a client connection.

### Field Summary

Fields
`static SemanticVersion` `DEFAULT_CQL_VERSION`

### Constructor Summary

Constructors
`protected` `ClientState(java.net.SocketAddress remoteAddress)`

### Method Summary

Methods
`void` `ensureHasPermission(Permission perm, IResource resource)`
`void` `ensureIsSuper(java.lang.String message)`
`void` `ensureNotAnonymous()`
`static ClientState` `forExternalCalls(java.net.SocketAddress remoteAddress)`
`static ClientState` `forInternalCalls()`
`static SemanticVersion[]` `getCQLSupportedVersion()`
`SemanticVersion` `getCQLVersion()`
`java.lang.String` `getKeyspace()`
`java.lang.String` `getRawKeyspace()`
`java.net.SocketAddress` `getRemoteAddress()`
`AuthenticatedUser` `getUser()`
`void` `hasAllKeyspacesAccess(Permission perm)`
`void` `hasColumnFamilyAccess(java.lang.String keyspace, java.lang.String columnFamily, Permission perm)`
`void` `hasKeyspaceAccess(java.lang.String keyspace, Permission perm)`
`void` `login(AuthenticatedUser user)` Attempts to login the given user.
`void` `setCQLVersion(java.lang.String str)`
`void` `setKeyspace(java.lang.String ks)`
`void` `validateLogin()`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_CQL_VERSION

    public static final SemanticVersion DEFAULT_CQL_VERSION

### Constructor Detail

#### ClientState

    protected ClientState(java.net.SocketAddress remoteAddress)

### Method Detail

#### forInternalCalls

    public static ClientState forInternalCalls()

Returns:
  a ClientState object for internal C* calls (not limited by any kind of auth).

#### forExternalCalls

    public static ClientState forExternalCalls(java.net.SocketAddress remoteAddress)

Returns:
  a ClientState object for external clients (thrift/native protocol users).

#### getRemoteAddress

    public java.net.SocketAddress getRemoteAddress()

#### getRawKeyspace

    public java.lang.String getRawKeyspace()

#### getKeyspace

    public java.lang.String getKeyspace()
                                 throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### setKeyspace

    public void setKeyspace(java.lang.String ks)
                     throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### login

    public void login(AuthenticatedUser user)
               throws AuthenticationException

Attempts to login the given user.

Throws:
  `AuthenticationException`

#### hasAllKeyspacesAccess

    public void hasAllKeyspacesAccess(Permission perm)
                               throws UnauthorizedException

Throws:
  `UnauthorizedException`

#### hasKeyspaceAccess

    public void hasKeyspaceAccess(java.lang.String keyspace,
                         Permission perm)
                           throws UnauthorizedException,
                                  InvalidRequestException

Throws:
  `UnauthorizedException`
  `InvalidRequestException`

#### hasColumnFamilyAccess

    public void hasColumnFamilyAccess(java.lang.String keyspace,
                             java.lang.String columnFamily,
                             Permission perm)
                               throws UnauthorizedException,
                                      InvalidRequestException

Throws:
  `UnauthorizedException`
  `InvalidRequestException`

#### ensureHasPermission

    public void ensureHasPermission(Permission perm,
                           IResource resource)
                             throws UnauthorizedException

Throws:
  `UnauthorizedException`

#### validateLogin

    public void validateLogin()
                       throws UnauthorizedException

Throws:
  `UnauthorizedException`

#### ensureNotAnonymous

    public void ensureNotAnonymous()
                            throws UnauthorizedException

Throws:
  `UnauthorizedException`

#### ensureIsSuper

    public void ensureIsSuper(java.lang.String message)
                       throws UnauthorizedException

Throws:
  `UnauthorizedException`

#### setCQLVersion

    public void setCQLVersion(java.lang.String str)
                       throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### getUser

    public AuthenticatedUser getUser()

#### getCQLVersion

    public SemanticVersion getCQLVersion()

#### getCQLSupportedVersion

    public static SemanticVersion[] getCQLSupportedVersion()