public abstract class AbstractAuthenticator extends AbstractFilter
| Modifier and Type | Field and Description |
|---|---|
static String |
PRINCIPAL
The constant that contains the principal, set by concrete authenticators
and consumed by the authorization endpoint.
|
AUTH_STATE, RETURN_URI| Constructor and Description |
|---|
AbstractAuthenticator() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain,
String authStateValue,
String returnUri)
Implement this method to perform the actual authentication.
|
abstract boolean |
canCommence(javax.servlet.http.HttpServletRequest request)
Implement this method to state whether the given request is a continuation that can be handled.
|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
void |
init(javax.servlet.FilterConfig filterConfig) |
protected void |
setPrincipal(javax.servlet.ServletRequest request,
AuthenticatedPrincipal principal)
Set the given principal on the request.
|
getAuthStateValue, getReturnUri, setAuthStateValuepublic static final String PRINCIPAL
public final void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic abstract boolean canCommence(javax.servlet.http.HttpServletRequest request)
request - the HttpServletRequestpublic abstract void authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain,
String authStateValue,
String returnUri)
throws IOException,
javax.servlet.ServletException
BasicAuthenticator or
FormLoginAuthenticator as an example.
In general, the contract is:
assert that the user is authenticated. You can use the request and response for this. When not yet authenticated:
AbstractFilter.getAuthStateValue(javax.servlet.ServletRequest) to
pass-around for user agent communicationAbstractFilter.getReturnUri(javax.servlet.ServletRequest) if you need to
step out and return to the current location
When authenticated:
AbstractFilter.setAuthStateValue(javax.servlet.ServletRequest, String)#setPrincipal(ServletRequest, RolesPrincipal)request - the ServletRequestresponse - the ServletResponsechain - the original http servlet filter chainauthStateValue - the authState nonce to set back on the ServletRequest when
donereturnUri - the startpoint of the chain if you want to return from a form or
other (external) componentIOExceptionjavax.servlet.ServletExceptionprotected final void setPrincipal(javax.servlet.ServletRequest request,
AuthenticatedPrincipal principal)
request - the original ServletRequestprincipal - the Principal to set.public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
javax.servlet.ServletExceptionpublic void destroy()
Copyright © 2012–2013 SURFnet bv, The Netherlands. All rights reserved.