public interface AuthenticationHandler
AuthenticationFilter manages the lifecycle of the authentication handler.
Implementations must be thread-safe as one instance is initialized and used for all requests.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
JWT_SSO_ENABLED |
static java.lang.String |
NON_BROWSER_USER_AGENTS |
static java.lang.String |
NON_BROWSER_USER_AGENTS_DEFAULT |
static java.lang.String |
WWW_AUTHENTICATE |
| Modifier and Type | Method and Description |
|---|---|
AuthenticationToken |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Performs an authentication step for the given HTTP client request.
|
void |
destroy()
Destroys the authentication handler instance.
|
java.lang.String |
getType()
Returns the authentication type of the authentication handler.
|
void |
init(java.util.Properties config)
Initializes the authentication handler instance.
|
boolean |
shouldAuthenticate(javax.servlet.http.HttpServletRequest request)
Should the request be authenticated by the handler or not.
|
static final java.lang.String WWW_AUTHENTICATE
static final java.lang.String JWT_SSO_ENABLED
static final java.lang.String NON_BROWSER_USER_AGENTS
static final java.lang.String NON_BROWSER_USER_AGENTS_DEFAULT
java.lang.String getType()
void init(java.util.Properties config) throws javax.servlet.ServletException
This method is invoked by the AuthenticationFilter.init(javax.servlet.FilterConfig) method.
config - configuration properties to initialize the handler.javax.servlet.ServletException - thrown if the handler could not be initialized.void destroy()
This method is invoked by the AuthenticationFilter.destroy() method.
AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, AuthenticationException
This method is invoked by the AuthenticationFilter only if the HTTP client request is
not yet authenticated.
Depending upon the authentication mechanism being implemented, a particular HTTP client may end up making a sequence of invocations before authentication is successfully established (this is the case of Kerberos SPNEGO).
This method must return an AuthenticationToken only if the the HTTP client request has
been successfully and fully authenticated.
If the HTTP client request has not been completely authenticated, this method must take over
the corresponding HTTP response and it must return null.
request - the HTTP client request.response - the HTTP client response.AuthenticationToken if the HTTP client request has been authenticated,
null otherwise (in this case it must take care of the response).java.io.IOException - thrown if an IO error occurred.AuthenticationException - thrown if an Authentication error occurred.boolean shouldAuthenticate(javax.servlet.http.HttpServletRequest request)
This is useful for deciding if a request should be handled by this handler or just forwarded to the next filter in chain. For example, if it's a java client in a long running application then the SSO handler can decide to not authenticate it and pass it on to the next filter
If the method returns TRUE the request will have to go through
this authentication handler
If the method returns FALSE the request is expected to be
passed on to the next filter in the chain
request - the HTTP client request.TRUE if this request should be authenticated by the handler,
FALSE otherwise.