Interface AuthenticationHandler<ParameterType,TokenType>

Type Parameters:
ParameterType - defining the parameter type for setParams(Object)
TokenType - defining the token type for getToken()
All Superinterfaces:
AutoCloseable, Closeable
All Known Subinterfaces:
HttpClientConnector.HttpAuthenticationHandler
All Known Implementing Classes:
AbstractAuthenticationHandler, BasicAuthentication, GssApiAuthentication, HttpClientConnector.HttpBasicAuthentication, HttpClientConnector.NegotiateAuthentication, Socks5ClientConnector.SocksBasicAuthentication, Socks5ClientConnector.SocksGssApiAuthentication

public interface AuthenticationHandler<ParameterType,TokenType> extends Closeable
An AuthenticationHandler encapsulates a possibly multi-step authentication protocol. Intended usage:
 setParams(something);
 start();
 sendToken(getToken());
 while (!isDone()) {
        setParams(receiveMessageAndExtractParams());
        process();
        Object t = getToken();
        if (t != null) {
                sendToken(t);
        }
 }
 
An AuthenticationHandler may be stateful and therefore is a Closeable.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    Retrieves the last token generated.
    boolean
    Tells whether is authentication mechanism is done (successfully or unsuccessfully).
    void
    Produces the next authentication token, if any.
    void
    Sets the parameters for the next token generation via start() or process().
    void
    Produces the initial authentication token that can be then retrieved via getToken().
  • Method Details

    • start

      void start() throws Exception
      Produces the initial authentication token that can be then retrieved via getToken().
      Throws:
      Exception - if an error occurs
    • process

      void process() throws Exception
      Produces the next authentication token, if any.
      Throws:
      Exception - if an error occurs
    • setParams

      void setParams(ParameterType input)
      Sets the parameters for the next token generation via start() or process().
      Parameters:
      input - to set, may be null
    • getToken

      TokenType getToken() throws Exception
      Retrieves the last token generated.
      Returns:
      the token, or null if there is none
      Throws:
      Exception - if an error occurs
    • isDone

      boolean isDone()
      Tells whether is authentication mechanism is done (successfully or unsuccessfully).
      Returns:
      whether this authentication is done
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable