Class UsernamePasswordAuthenticationMechanism

  • All Implemented Interfaces:
    org.wildfly.security.http.HttpServerAuthenticationMechanism

    public abstract class UsernamePasswordAuthenticationMechanism
    extends Object
    implements org.wildfly.security.http.HttpServerAuthenticationMechanism
    A base class for HTTP mechanisms that operate on validation of plain text usernames and passwords.
    Author:
    Darran Lofthouse
    • Constructor Detail

      • UsernamePasswordAuthenticationMechanism

        protected UsernamePasswordAuthenticationMechanism​(CallbackHandler callbackHandler)
        Constructs a new UsernamePasswordAuthenticationMechanism instance.
        Parameters:
        callbackHandler - the CallbackHandler used for authentication.
    • Method Detail

      • authenticate

        protected boolean authenticate​(String realmName,
                                       String username,
                                       char[] password)
                                throws org.wildfly.security.http.HttpAuthenticationException
        Authenticates the user for provided realm using their username and password.
        Parameters:
        realmName - the realm for which the user is authenticating.
        username - the username of the authenticating user.
        password - the password of the authenticating user.
        Returns:
        true if the user is authenticated for the realm, false otherwise.
        Throws:
        org.wildfly.security.http.HttpAuthenticationException - if there was an IOException caused by the CallbackHandler.
      • authorize

        protected boolean authorize​(String username)
                             throws org.wildfly.security.http.HttpAuthenticationException
        Checks if the user is authorized.
        Parameters:
        username - the username to authorize.
        Returns:
        true if the user is authorized, false otherwise.
        Throws:
        org.wildfly.security.http.HttpAuthenticationException - if there was an IOException caused by the CallbackHandler.