Interface AuthenticationHandler<P,T>
- Type Parameters:
P- defining the parameter type forsetParams(Object)T- defining the token type forgetToken()
- All Superinterfaces:
AutoCloseable, Closeable
- All Known Implementing Classes:
AbstractAuthenticationHandler, BasicAuthentication, GssApiAuthentication
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.voidvoidstart()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 occursIOException
-
process
-
setParams
-
getToken
Retrieves the last token generated.- Returns:
- the token, or
nullif there is none - Throws:
Exception- if an error occursIOException
-
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
-