Class BasicAuthenticator

  • public abstract class BasicAuthenticator
    extends Authenticator
    BasicAuthenticator provides an implementation of HTTP Basic authentication. It is an abstract class and must be extended to provide an implementation of checkCredentials(String,String) which is called to verify each incoming request.
    • Field Detail

      • realm

        protected String realm
    • Constructor Detail

      • BasicAuthenticator

        public BasicAuthenticator​(String realm)
        Creates a BasicAuthenticator for the given HTTP realm
        realm - The HTTP Basic authentication realm
        NullPointerException - if the realm is an empty string
    • Method Detail

      • getRealm

        public String getRealm()
        returns the realm this BasicAuthenticator was created with
        the authenticator's realm string.
      • checkCredentials

        public abstract boolean checkCredentials​(String username,
                                                 String password)
        called for each incoming request to verify the given name and password in the context of this Authenticator's realm. Any caching of credentials must be done by the implementation of this method
        username - the username from the request
        password - the password from the request
        true if the credentials are valid, false otherwise.