Class ExampleChallenge

  • All Implemented Interfaces:
    AuthenticationMechanismInterface

    public class ExampleChallenge
    extends BaseAuthenticationPlugin
    Example of an authentication method that implements a challenge. The flow is: The default case challenges the user for "username". Then user replies with username, the authentication method responds with the "first" challenge for the "first password". If the user responds with same password as username, the authentication method replies with the "second" challenge for the "second password" which also has to be equal to the username. If equal in this second state the authentication method returns AUTHENTICATED. All other cases it returns NOT AUTHENTICATED.
    • Constructor Detail

      • ExampleChallenge

        public ExampleChallenge()
        Constructor for the plugin. Should be called by the implementing class.
    • Method Detail

      • init

        public boolean init​(AuthenticationMechanismConfiguration configuration,
                            AuthenticationMechanismHandler handler)
        Initialization of the authentication method. The configuration is forwarded to the authentication method as well as the authentication handler which can assist the method for instance with session and logging issues.
        Specified by:
        init in interface AuthenticationMechanismInterface
        Overrides:
        init in class BaseAuthenticationPlugin
        Parameters:
        configuration - The configuration handler.
        handler - The authentication method handler.
        Returns:
        The authentication method should return true, if ready to receive authentication requests. False, if authentication method already in this call can determine that it will be unable to perform authentication, if for instance a configuration parameter is missing.
      • authenticate

        public AuthenticationReply authenticate​(AuthenticationRequest request)
        Perform an authentication request.
        Parameters:
        request - The authentication request containing information on which the authentication can be based.
        Returns:
        The authentication reply containing information about the success or failure of the authentication.
      • exit

        public boolean exit()
        Termination. Close down any persistent connections or other resources allocated during run-time of the mechanism.
        Returns:
        True, if termination went well. False, if not sucessful.
      • getName

        public java.lang.String getName()
        Returns the name of the authentication method.
        Returns:
        The name of the authentication method.
      • needsReloading

        public boolean needsReloading​(java.lang.String transactionKey)