Package io.deephaven.client.impl
Class Authentication
java.lang.Object
io.deephaven.client.impl.Authentication
-
Field Summary
Modifier and TypeFieldDescriptionstatic final io.grpc.Metadata.Key<String>
The "authorization" header. -
Method Summary
Modifier and TypeMethodDescriptionstatic Authentication
authenticate
(DeephavenChannel channel, String authenticationTypeAndValue) Starts an authentication request.void
await()
Causes the current thread to wait until the authentication request is finished, unless the thread is interrupted.boolean
Causes the current thread to wait for up toduration
until the authentication request is finished, unless the thread is interrupted, or the specified waiting time elapses.void
Waits for the request to finish.boolean
awaitOrCancel
(Duration duration) Causes the current thread to wait for up toduration
until the authentication request is finished, unless the thread is interrupted, or the specified waiting time elapses.Upon success, will return a channel that handles setting the Bearer token when messages are sent, and handles updating the Bearer token when messages are received.void
Cancels the request.The configuration constants.error()
The error.future()
The future.void
Throws if an error has been returned.
-
Field Details
-
AUTHORIZATION_HEADER
The "authorization" header. This is a misnomer in the specification, this is really an "authentication" header.
-
-
Method Details
-
authenticate
public static Authentication authenticate(DeephavenChannel channel, String authenticationTypeAndValue) Starts an authentication request.- Parameters:
channel
- the channelauthenticationTypeAndValue
- the authentication type and optional value- Returns:
- the authentication
-
await
Causes the current thread to wait until the authentication request is finished, unless the thread is interrupted.- Throws:
InterruptedException
- if the current thread is interrupted while waiting
-
await
Causes the current thread to wait for up toduration
until the authentication request is finished, unless the thread is interrupted, or the specified waiting time elapses.- Parameters:
duration
- the duration to wait- Returns:
- true if the authentication request is done and false if the waiting time elapsed before the request is done
- Throws:
InterruptedException
- if the current thread is interrupted while waiting
-
awaitOrCancel
Waits for the request to finish. On interrupted, will cancel the request, and re-throw the interrupted exception.- Throws:
InterruptedException
- if the current thread is interrupted while waiting
-
awaitOrCancel
Causes the current thread to wait for up toduration
until the authentication request is finished, unless the thread is interrupted, or the specified waiting time elapses. On interrupted, will cancel the request, and re-throw the interrupted exception. On timed-out, will cancel the request.- Parameters:
duration
- the duration to wait- Returns:
- true if the authentication request is done and false if the waiting time elapsed before the request is done
- Throws:
InterruptedException
- if the current thread is interrupted while waiting
-
future
The future. Is always completed successfully withthis
when done. The caller is still responsible for checkingerror()
as necessary. Presented as an alternative to the await methods.- Returns:
- the future
-
cancel
Cancels the request.- Parameters:
message
- the messagecause
- the cause
-
bearerChannel
Upon success, will return a channel that handles setting the Bearer token when messages are sent, and handles updating the Bearer token when messages are received. The request must already be finished.Note: the caller is responsible for ensuring at least some messages are sent as appropriate during the token timeout schedule. See
configurationConstants()
. -
configurationConstants
The configuration constants. The request must already be finished.- Returns:
- the configuration constants
-
error
The error. The request must already be finished.- Returns:
- the error
-
throwOnError
public void throwOnError()Throws if an error has been returned. The request must already be finished.- Throws:
RuntimeException
- if an error has been returned
-