Interface AuthenticationHandler<ParameterType,TokenType>
- Type Parameters:
ParameterType- defining the parameter type forsetParams(Object)TokenType- defining the token type forgetToken()
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
HttpClientConnector.HttpAuthenticationHandler
- All Known Implementing Classes:
AbstractAuthenticationHandler,BasicAuthentication,GssApiAuthentication,HttpClientConnector.HttpBasicAuthentication,HttpClientConnector.NegotiateAuthentication,Socks5ClientConnector.SocksBasicAuthentication,Socks5ClientConnector.SocksGssApiAuthentication
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 TypeMethodDescriptionvoidclose()getToken()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 Details
-
start
Produces the initial authentication token that can be then retrieved viagetToken().- Throws:
Exception- if an error occurs
-
process
Produces the next authentication token, if any.- Throws:
Exception- if an error occurs
-
setParams
- Parameters:
input- to set, may benull
-
getToken
Retrieves the last token generated.- Returns:
- the token, or
nullif 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-