Browse Source

Update MaxKeyConfig.java

shimingxy 5 years ago
parent
commit
2919ed8d6a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java

+ 5 - 1
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java

@@ -186,7 +186,8 @@ public class MaxKeyConfig  implements InitializingBean {
     //default tfaOptAuthn
     @Bean(name = "tfaOptAuthn")
     public AbstractOptAuthn tfaOptAuthn(
-            @Value("${config.login.mfa.type}")String mfaType) {    
+            @Value("${config.login.mfa.type}")String mfaType,
+            MailOtpAuthn tfaMailOptAuthn) {    
         
         if(mfaType.equalsIgnoreCase("SmsOtpAuthnAliyun")) {
             SmsOtpAuthnAliyun tfaOptAuthn = new SmsOtpAuthnAliyun();
@@ -203,6 +204,9 @@ public class MaxKeyConfig  implements InitializingBean {
             tfaOptAuthn.initPropertys();
             _logger.debug("SmsOtpAuthnYunxin inited.");
             return tfaOptAuthn;
+        }else if(mfaType.equalsIgnoreCase("MailOtpAuthn")) {
+            _logger.debug("MailOtpAuthn inited.");
+            return tfaMailOptAuthn;
         }else {
             TimeBasedOtpAuthn tfaOptAuthn = new TimeBasedOtpAuthn();
             _logger.debug("TimeBasedOtpAuthn inited.");