deephaven_enterprise.client.auth#

class AuthClient(host=None, port=None, rpc_timeout_seconds=120, channel=None)[source]#

Bases: object

AuthClient authenticates to a Deephaven authentication server and produces tokens for use with other Deephaven services.

Presently, password and private key authentication are provided.

Create an AuthClient and connect to the server.

You may either specify the host and port to connect to, or provide your own grpc channel. The simplest case is to simply provide the host and port, but if you need advanced channel configuration or want to share the channel for several clients, then you can create it and pass it in.

Parameters:
  • host (Optional[str]) – the host to connect to, requires port

  • port (Optional[int]) – the port to connect to, requires host

  • rpc_timeout_seconds (int) – the rpc timeout period to use, defaults to 120 seconds if not provided

  • channel (Optional[Channel]) – a pre-created channel to use for the gRPC messages

close()[source]#

Logout from the authentication server. No further tokens may be requested by this client.

Return type:

None

get_token(service)[source]#

Get an authentication token to present to another Deephaven service. This token may only be used one time, as it is consumed by the authentication server during the verification process.

Parameters:

service (str) – the service that will verify the token (e.g., “PersistentQueryController”)

Return type:

Token

Returns:

the token

password(user, password, effective_user=None)[source]#

Authenticates to the server using a username and password.

Parameters:
  • user (str) – the user to authenticate

  • password (str) – the user’s password

  • effective_user (Optional[str]) – the user to operate as, defaults to the user to authenticate

Return type:

None

ping()[source]#

Pings the server, refreshing our cookie. :returns: True if a ping was sent, False if there is no active cookie.

private_key(file)[source]#

Authenticate to the server using a Deephaven format private key file.

https://deephaven.io/enterprise/docs/resources/how-to/connect-from-java/#instructions-for-setting-up-private-keys

Parameters:

file (str) – the file containing the private key produced by generate-iris-keys

Return type:

None

exception AuthenticationFailedException[source]#

Bases: Exception

This Exception is raised when the server responds to our authentication request with a failure (e.g. bad password or bad key). Other errors, like the server not responding at all are not covered by this Exception.

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.