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 usernamegetName()booleanvalidateOtp(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)
-