Package io.meeds.web.security.plugin
Interface OtpPlugin
public interface OtpPlugin
-
Method Summary
Modifier and TypeMethodDescriptionbooleandefault booleanconsumeOtp(String userName, String otpCode) Consumes the OTP code of a designated user once it was validated, so that it never validates again.voidgenerateOtpCode(String userName) Generates a new OTP code for a designated usernamedefault longgetName()default longbooleanvalidateOtp(String userName, String otpCode) Validates and clear OTP code for a designated user
-
Method Details
-
getName
String getName()- Returns:
- Plugin name
-
canUse
- Parameters:
userName- user login- Returns:
- true if user can use this otp plugin, else false
-
generateOtpCode
Generates a new OTP code for a designated username- Parameters:
userName-
-
validateOtp
Validates and clear OTP code for a designated user- Parameters:
userName-otpCode-- Returns:
- true if valid, else false
-
consumeOtp
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
-