Class ReverseUsernameAsPassword

  • All Implemented Interfaces:
    AuthenticationMechanismInterface

    public class ReverseUsernameAsPassword
    extends UsernamePasswordMechanism
    Example of an authentication method that returns ok when password is the reversed username. I.e. username "niber" and password "rebin" returns success.
    • Constructor Detail

      • ReverseUsernameAsPassword

        public ReverseUsernameAsPassword()
        Constructs a new ReverseUsernameAsPassword instance.
    • Method Detail

      • authenticate

        public UsernamePasswordMechanism.UsernamePasswordMechanismResponse authenticate​(java.lang.String username,
                                                                                        java.lang.String password)
        The authentication method that checks if the password is the reversed username.
         E.g.
         Username: johndoe, Password: eodnhoj -> OK!
         Username: kalle, Password: elak -> NOT OK!
         
        Specified by:
        authenticate in class UsernamePasswordMechanism
        Parameters:
        username - The username.
        password - The password.
        Returns:
        UsernamePasswordMechanismResponse encapsulating the response code.
      • testConnect

        protected boolean testConnect()
        According to abstract class this must be implemented.
        Specified by:
        testConnect in class UsernamePasswordMechanism
        Returns:
        Always true since this authentication method does not need to test any connection or allocation of necessary resources.
      • needsReloading

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