Class BasicAuthenticator

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

    public class BasicAuthenticator
    extends AuthenticatorBase
    An Authenticator and Valve implementation of HTTP BASIC Authentication, as outlined in RFC 2617: "HTTP Authentication: Basic and Digest Access Authentication."
    Version:
    $Revision: 1.7 $ $Date: 2007/05/05 05:31:52 $
    Author:
    Craig R. McClanahan
    • Constructor Detail

      • BasicAuthenticator

        public BasicAuthenticator()
    • 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
      • parseUsername

        protected String parseUsername​(String authorization)
        Parse the username from the specified authorization credentials. If none can be found, return null.
        Parameters:
        authorization - Authorization credentials from this request
      • parsePassword

        protected char[] parsePassword​(String authorization)
        Parse the password from the specified authorization credentials. If none can be found, return null.
        Parameters:
        authorization - Authorization credentials from this request