org.apache.catalina.authenticator

Class FormAuthenticator

public class FormAuthenticator extends AuthenticatorBase

An Authenticator and Valve implementation of FORM BASED Authentication, as described in the Servlet API Specification, Version 2.2.

Version: $Revision: 892804 $ $Date: 2009-12-21 13:56:09 +0100 (Mon, 21 Dec 2009) $

Author: Craig R. McClanahan Remy Maucherat

Field Summary
protected StringcharacterEncoding
Character encoding to use to read the username and password parameters from the request.
protected static Stringinfo
Descriptive information about this implementation.
Method Summary
booleanauthenticate(Request request, Response response, LoginConfig config)
Authenticate the user making this request, based on the specified login configuration.
protected voidforwardToErrorPage(Request request, Response response, LoginConfig config)
Called to forward to the error page
protected voidforwardToLoginPage(Request request, Response response, LoginConfig config)
Called to forward to the login page
StringgetCharacterEncoding()
Return the character encoding to use to read the username and password.
StringgetInfo()
Return descriptive information about this Valve implementation.
protected booleanmatchRequest(Request request)
Does this request match the saved one (so that it must be the redirect we signalled after successful authentication?
protected booleanrestoreRequest(Request request, Session session)
Restore the original request from information stored in our session.
protected StringsavedRequestURL(Session session)
Return the request URI (with the corresponding query string, if any) from the saved request so that we can redirect to it.
protected voidsaveRequest(Request request, Session session)
Save the original request information into our session.
voidsetCharacterEncoding(String encoding)
Set the character encoding to be used to read the username and password.

Field Detail

characterEncoding

protected String characterEncoding
Character encoding to use to read the username and password parameters from the request. If not set, the encoding of the request body will be used.

info

protected static final String info
Descriptive information about this implementation.

Method Detail

authenticate

public boolean authenticate(Request request, Response response, LoginConfig config)
Authenticate the user making this request, based on the specified login configuration. Return true if any specified constraint has been satisfied, or false if we have created a response challenge already.

Parameters: request Request we are processing response Response we are creating config Login configuration describing how authentication should be performed

Throws: IOException if an input/output error occurs

forwardToErrorPage

protected void forwardToErrorPage(Request request, Response response, LoginConfig config)
Called to forward to the error page

Parameters: request Request we are processing response Response we are creating config Login configuration describing how authentication should be performed

Throws: IOException If the forward to the error page fails and the call to HttpServletResponse#sendError(int, String) throws an IOException

forwardToLoginPage

protected void forwardToLoginPage(Request request, Response response, LoginConfig config)
Called to forward to the login page

Parameters: request Request we are processing response Response we are creating config Login configuration describing how authentication should be performed

Throws: IOException If the forward to the login page fails and the call to HttpServletResponse#sendError(int, String) throws an IOException

getCharacterEncoding

public String getCharacterEncoding()
Return the character encoding to use to read the username and password.

getInfo

public String getInfo()
Return descriptive information about this Valve implementation.

matchRequest

protected boolean matchRequest(Request request)
Does this request match the saved one (so that it must be the redirect we signalled after successful authentication?

Parameters: request The request to be verified

restoreRequest

protected boolean restoreRequest(Request request, Session session)
Restore the original request from information stored in our session. If the original request is no longer present (because the session timed out), return false; otherwise, return true.

Parameters: request The request to be restored session The session containing the saved information

savedRequestURL

protected String savedRequestURL(Session session)
Return the request URI (with the corresponding query string, if any) from the saved request so that we can redirect to it.

Parameters: session Our current session

saveRequest

protected void saveRequest(Request request, Session session)
Save the original request information into our session.

Parameters: request The request to be saved session The session to contain the saved information

Throws: IOException

setCharacterEncoding

public void setCharacterEncoding(String encoding)
Set the character encoding to be used to read the username and password.
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.