Interface OtpPlugin


public interface OtpPlugin
  • 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)
    • getCodeTtlMinutes

      default long getCodeTtlMinutes()
      Returns:
      validity of a sent code in minutes, 0 when the method does not expire its codes
    • getSendIntervalSeconds

      default long getSendIntervalSeconds()
      Returns:
      minimal delay in seconds between two sends of a code to the same user, 0 when the method does not throttle them