Class FormAuthenticator

  • All Implemented Interfaces:
    Authenticator, Contained, Lifecycle, Valve, GlassFishValve

    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: 1.8.2.2 $ $Date: 2008/04/17 18:37:04 $
    Author:
    Craig R. McClanahan, Remy Maucherat
    • Constructor Detail

      • FormAuthenticator

        public FormAuthenticator()
    • Method Detail

      • authenticate

        public boolean authenticate​(HttpRequest request,
                                    HttpResponse response,
                                    LoginConfig config)
                             throws IOException
        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.
        Specified by:
        authenticate in class AuthenticatorBase
        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
      • matchRequest

        protected boolean matchRequest​(HttpRequest request)
        Does this request match the saved one (so that it must be the redirect we signaled after successful authentication?
        Parameters:
        request - The request to be verified
      • restoreRequest

        protected boolean restoreRequest​(HttpRequest request,
                                         Session session)
                                  throws IOException
        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
        Throws:
        IOException
      • forwardToLoginPage

        protected void forwardToLoginPage​(HttpRequest request,
                                          HttpResponse response,
                                          LoginConfig config)
        Called to forward to the login page. may redirect current request to HTTPS
        Parameters:
        request - HttpRequest we are processing
        response - HttpResponse we are creating
        config - Login configuration describing how authentication should be performed
      • forwardToErrorPage

        protected void forwardToErrorPage​(HttpRequest request,
                                          HttpResponse response,
                                          LoginConfig config)
        Called to forward to the error page. may redirect current request to HTTPS
        Parameters:
        request - HttpRequest we are processing
        response - HttpResponse we are creating
        config - Login configuration describing how authentication should be performed
      • saveRequest

        protected void saveRequest​(HttpRequest request,
                                   Session session)
                            throws IOException
        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
      • 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