Interface AuthenticationHandler<ParameterType,TokenType>
-
- Type Parameters:
ParameterType- defining the parameter type forsetParams(Object)TokenType- defining the token type forgetToken()
- All Superinterfaces:
java.lang.AutoCloseable,java.io.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 java.io.CloseableAnAuthenticationHandlerencapsulates 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); } }AnAuthenticationHandlermay be stateful and therefore is aCloseable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()TokenTypegetToken()Retrieves the last token generated.booleanisDone()Tells whether is authentication mechanism is done (successfully or unsuccessfully).voidprocess()Produces the next authentication token, if any.voidsetParams(ParameterType input)voidstart()Produces the initial authentication token that can be then retrieved viagetToken().
-
-
-
Method Detail
-
start
void start() throws java.lang.ExceptionProduces the initial authentication token that can be then retrieved viagetToken().- Throws:
java.lang.Exception- if an error occurs
-
process
void process() throws java.lang.ExceptionProduces the next authentication token, if any.- Throws:
java.lang.Exception- if an error occurs
-
setParams
void setParams(ParameterType input)
- Parameters:
input- to set, may benull
-
getToken
TokenType getToken() throws java.lang.Exception
Retrieves the last token generated.- Returns:
- the token, or
nullif there is none - Throws:
java.lang.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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-