Class EmailOtpPlugin

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

@Service public class EmailOtpPlugin extends Object implements io.meeds.web.security.plugin.OtpPlugin
Generates, caches and validates email OTP codes: the code is stored under a purpose-bound cache key (getCacheKey(String)) and the email is sent through the common BrandedEmailSender with a per-plugin content fragment and subject key.
  • 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
    • generateOtpCode

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

      protected String getCacheKey(String userName)
      Key under which the OTP code of a user is stored, distinct by plugin so that a code generated for one purpose can never validate another one
    • getEmailSubjectKey

      protected String getEmailSubjectKey()