ParameterType
- defining the parameter type for setParams(Object)
TokenType
- defining the token type for getToken()
public interface AuthenticationHandler<ParameterType,TokenType>
extends java.io.Closeable
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
.Modifier and Type | Method and Description |
---|---|
void |
close() |
TokenType |
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 via
getToken() . |
void start() throws java.lang.Exception
getToken()
.java.lang.Exception
- if an error occursvoid process() throws java.lang.Exception
java.lang.Exception
- if an error occursvoid setParams(ParameterType input)
input
- to set, may be null
TokenType getToken() throws java.lang.Exception
null
if there is nonejava.lang.Exception
- if an error occursboolean isDone()
void close()
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable