Package io.deephaven.auth
Class AnonymousAuthenticationHandler
java.lang.Object
io.deephaven.auth.AnonymousAuthenticationHandler
- All Implemented Interfaces:
AuthenticationRequestHandler
Handler to accept an empty payload and accept that user as anonymous. To prevent anonymous access, do not enable this
authentication handler.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.auth.AuthenticationRequestHandler
AuthenticationRequestHandler.HandshakeResponseListener, AuthenticationRequestHandler.MetadataResponseListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis handler can be referred to via both Arrow Flight's original Auth and Auth2.voidinitialize(String targetUrl) Initialize request handler with the provided url.login(long protocolVersion, ByteBuffer payload, AuthenticationRequestHandler.HandshakeResponseListener listener) Given a protocol version (very likely to be zero) and payload bytes, if possible authenticate this user.login(String payload, AuthenticationRequestHandler.MetadataResponseListener listener) Given a payload string, if possible authenticate this user.Return the targetUrl as the only valid url for this handler.
-
Constructor Details
-
AnonymousAuthenticationHandler
public AnonymousAuthenticationHandler()
-
-
Method Details
-
getAuthType
Description copied from interface:AuthenticationRequestHandlerThis handler can be referred to via both Arrow Flight's original Auth and Auth2. To use via the original Arrow Flight Handshake, the request should be sent in aWrappedAuthenticationRequestwith this handler's identity string. To use via Arrow Flight Auth 2's metadata header, then theAuth2Constants.AUTHORIZATION_HEADERshould be prefixed with this handler's identity string.- Specified by:
getAuthTypein interfaceAuthenticationRequestHandler- Returns:
- the type string used to identify the handler
-
initialize
Description copied from interface:AuthenticationRequestHandlerInitialize request handler with the provided url.- Specified by:
initializein interfaceAuthenticationRequestHandler- Parameters:
targetUrl- the base url of the hosted UI
-
urls
Return the targetUrl as the only valid url for this handler. With anonymous authentication there's no query parameters to add, so just return the targetUrl.- Specified by:
urlsin interfaceAuthenticationRequestHandler- Parameters:
targetUrl- the base url of the hosted UI- Returns:
- a list containing the targetUrl
-
login
public Optional<AuthContext> login(long protocolVersion, ByteBuffer payload, AuthenticationRequestHandler.HandshakeResponseListener listener) Description copied from interface:AuthenticationRequestHandlerGiven a protocol version (very likely to be zero) and payload bytes, if possible authenticate this user. If the handler can correctly decode the payload and confirm the user's identity, an appropriate UserContext should be returned. If the payload is correctly decoded and definitely isn't a valid user, an exception may be thrown. If there is ambiguity in decoding the payload (leading to apparent "not a valid user") or the payload cannot be decoded, an empty optional should be returned. Note that regular arrow flight clients cannot specify the protocolVersion; to be compatible with flight auth assume protocolVersion will be zero.- Specified by:
loginin interfaceAuthenticationRequestHandler- Parameters:
protocolVersion- Mostly unused, this is an allowed field to set on HandshakeRequests from the Flight gRPC call.payload- The byte payload of the handshake, such as an encoded protobuf.listener- The handshake response observer, which enables multi-request authentication.- Returns:
- AuthContext for this user if applicable else Empty
-
login
public Optional<AuthContext> login(String payload, AuthenticationRequestHandler.MetadataResponseListener listener) Description copied from interface:AuthenticationRequestHandlerGiven a payload string, if possible authenticate this user. If the handler can correctly decode the payload and confirm the user's identity, an appropriate UserContext should be returned. If the payload is correctly decoded and definitely isn't a valid user, an exception may be thrown. If there is ambiguity in decoding the payload (leading to apparent "not a valid user") or the payload cannot be decoded, an empty optional should be returned. Note that metadata can only be sent with the initial gRPC response; multi-message authentication via gRPC metadata headers require multiple gRPC call attempts.- Specified by:
loginin interfaceAuthenticationRequestHandler- Parameters:
payload- The byte payload of theAuthorizationheader, such as an encoded protobuf or b64 encoded string.listener- The metadata response observer, which enables multi-request authentication.- Returns:
- AuthContext for this user if applicable else Empty
-