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 TypeMethodDescriptionvoid
close()
getToken()
Retrieves the last token generated.boolean
isDone()
Tells whether is authentication mechanism is done (successfully or unsuccessfully).void
process()
Produces the next authentication token, if any.void
setParams
(ParameterType input) void
start()
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
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-