Class BearerTokenAuthenticator

java.lang.Object
org.apache.arrow.flight.auth2.BearerTokenAuthenticator
All Implemented Interfaces:
CallHeaderAuthenticator
Direct Known Subclasses:
GeneratedBearerTokenAuthenticator

public abstract class BearerTokenAuthenticator extends Object implements CallHeaderAuthenticator
Partial implementation of CallHeaderAuthenticator for bearer-token based authentication.
  • Constructor Details

  • Method Details

    • authenticate

      public CallHeaderAuthenticator.AuthResult authenticate(CallHeaders incomingHeaders)
      Description copied from interface: CallHeaderAuthenticator
      Validate the auth headers sent by the client.
      Specified by:
      authenticate in interface CallHeaderAuthenticator
      Parameters:
      incomingHeaders - The incoming headers to authenticate.
      Returns:
      an auth result containing a peer identity and optionally a bearer token.
    • getAuthResultWithBearerToken

      protected abstract CallHeaderAuthenticator.AuthResult getAuthResultWithBearerToken(CallHeaderAuthenticator.AuthResult authResult)
      Callback to run when the initial authenticator succeeds.
      Parameters:
      authResult - A successful initial authentication result.
      Returns:
      an alternate AuthResult based on the original AuthResult that will write a bearer token to output headers.
    • validateBearer

      protected abstract CallHeaderAuthenticator.AuthResult validateBearer(String bearerToken)
      Validate the bearer token.
      Parameters:
      bearerToken - The bearer token to validate.
      Returns:
      A successful AuthResult if validation succeeded.