Interface OtpPlugin


public interface OtpPlugin
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canUse(String userName)
     
    default boolean
    consumeOtp(String userName, String otpCode)
    Consumes the OTP code of a designated user once it was validated, so that it never validates again.
    void
    Generates a new OTP code for a designated username
     
    boolean
    validateOtp(String userName, String otpCode)
    Validates and clear OTP code for a designated user
  • Method Details

    • getName

      String getName()
      Returns:
      Plugin name
    • canUse

      boolean canUse(String userName)
      Parameters:
      userName - user login
      Returns:
      true if user can use this otp plugin, else false
    • generateOtpCode

      void generateOtpCode(String userName)
      Generates a new OTP code for a designated username
      Parameters:
      userName -
    • validateOtp

      boolean validateOtp(String userName, String otpCode)
      Validates and clear OTP code for a designated user
      Parameters:
      userName -
      otpCode -
      Returns:
      true if valid, else false
    • consumeOtp

      default boolean consumeOtp(String userName, String otpCode)
      Consumes the OTP code of a designated user once it was validated, so that it never validates again. A method holding no code to consume answers true.
      Parameters:
      userName -
      otpCode -
      Returns:
      true when this call consumed the code, false when the code was no longer there (another request consumed it first, or it expired)