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 Implementing Classes:
AbstractAuthenticationHandler
,BasicAuthentication
,GssApiAuthentication
public interface AuthenticationHandler<ParameterType,TokenType> extends Closeable
AnAuthenticationHandler
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); } }
AnAuthenticationHandler
may be stateful and therefore is aCloseable
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 viagetToken()
.
-
-
-
Method Detail
-
start
void start() throws Exception
Produces the initial authentication token that can be then retrieved viagetToken()
.- Throws:
Exception
- if an error occurs
-
process
void process() throws Exception
Produces the next authentication token, if any.- Throws:
Exception
- if an error occurs
-
setParams
void setParams(ParameterType input)
- Parameters:
input
- to set, may benull
-
getToken
TokenType getToken() throws Exception
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
-
-