Class EmailOtpPlugin

java.lang.Object
io.meeds.social.security.plugin.EmailOtpPlugin
All Implemented Interfaces:
io.meeds.web.security.plugin.OtpPlugin

@Service public class EmailOtpPlugin extends Object implements io.meeds.web.security.plugin.OtpPlugin
  • Constructor Details

    • EmailOtpPlugin

      public EmailOtpPlugin()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface io.meeds.web.security.plugin.OtpPlugin
    • canUse

      public boolean canUse(String userName)
      Specified by:
      canUse in interface io.meeds.web.security.plugin.OtpPlugin
    • validateOtp

      public boolean validateOtp(String userName, String otpCode)
      Specified by:
      validateOtp in interface io.meeds.web.security.plugin.OtpPlugin
    • consumeOtp

      public boolean consumeOtp(String userName, String otpCode)
      Removes the code from the cache when it is the one given, so that it never validates again. Only the request that removes it wins: a concurrent one finds it gone. Another code the user holds, such as one sent after this one was validated, stays: it is not removed, or put back when it arrived between the read and the removal.
      Specified by:
      consumeOtp in interface io.meeds.web.security.plugin.OtpPlugin
    • generateOtpCode

      public void generateOtpCode(String userName)
      Specified by:
      generateOtpCode in interface io.meeds.web.security.plugin.OtpPlugin