Class MockTwoFactorPasswordGenerator

    • Constructor Detail

      • MockTwoFactorPasswordGenerator

        public MockTwoFactorPasswordGenerator()
    • Method Detail

      • generatePasswords

        @NotNull
        public Set<Integer> generatePasswords​(@NotNull
                                              String secretKey,
                                              long timestamp)
        Description copied from interface: TwoFactorPasswordGenerator
        Generates and returns all TOTP passwords that will be considered as correct, using secret key and UNIX timestamp. The multiple correct passwords are allowed to prevent time desynchroniation between client and server. For example, password from previous 30-sec. epoch can be allowed.
        Specified by:
        generatePasswords in interface TwoFactorPasswordGenerator
        Parameters:
        secretKey - secret key
        timestamp - current UNIX timestamp in seconds
        Returns:
        set of all correct password
      • setCorrectPasswords

        public void setCorrectPasswords​(@NotNull
                                        String mockSecretKey,
                                        @NotNull
                                        Set<Integer> passwords)
      • setCorrectPassword

        public void setCorrectPassword​(@NotNull
                                       String mockSecretKey,
                                       int password)
      • reset

        public void reset()