Ver Fonte

otpType

MaxKey há 4 anos atrás
pai
commit
0f19da93f4

+ 10 - 10
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/AbstractOtpAuthn.java

@@ -44,9 +44,9 @@ public abstract class AbstractOtpAuthn {
 
     StringGenerator stringGenerator;
     
-    protected String optType = OptTypes.TIMEBASED_OPT;
+    protected String otpType = OtpTypes.TIMEBASED_OTP;
 
-    public static final class OptTypes {
+    public static final class OtpTypes {
         // 手机
         public static String  MOBILE = "MOBILE";
         // 短信
@@ -54,13 +54,13 @@ public abstract class AbstractOtpAuthn {
         // 邮箱
         public static String EMAIL = "EMAIL";
         //TIMEBASED_OPT
-        public static String TIMEBASED_OPT = "TOPT";
+        public static String TIMEBASED_OTP = "TOPT";
         // HmacOTP
-        public static String HOTP_OPT = "HOTP";
+        public static String HOTP_OTP = "HOTP";
 
-        public static String RSA_OPT = "RSA";
+        public static String RSA_OTP = "RSA";
         
-        public static String CAP_OPT = "CAP";
+        public static String CAP_OTP = "CAP";
 
     }
 
@@ -134,12 +134,12 @@ public abstract class AbstractOtpAuthn {
         this.crypto = crypto;
     }
 
-    public String getOptType() {
-        return optType;
+    public String getOtpType() {
+        return otpType;
     }
 
-    public void setOptType(String optType) {
-        this.optType = optType;
+    public void setOtpType(String optType) {
+        this.otpType = optType;
     }
 
     public void setOptTokenStore(AbstractOtpTokenStore optTokenStore) {

+ 1 - 1
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/CapOtpAuthn.java

@@ -35,7 +35,7 @@ public class CapOtpAuthn extends AbstractOtpAuthn {
     
     
     public CapOtpAuthn() {
-        optType = OptTypes.CAP_OPT;
+        otpType = OtpTypes.CAP_OTP;
     }
 
     @Override

+ 1 - 1
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/CounterBasedOtpAuthn.java

@@ -30,7 +30,7 @@ public class CounterBasedOtpAuthn extends AbstractOtpAuthn {
 
 
     public CounterBasedOtpAuthn() {
-        optType = OptTypes.HOTP_OPT;
+        otpType = OtpTypes.HOTP_OTP;
     }
 
     @Override

+ 1 - 1
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/HotpOtpAuthn.java

@@ -34,7 +34,7 @@ public class HotpOtpAuthn extends AbstractOtpAuthn {
     int truncation = -1;
 
     public HotpOtpAuthn() {
-        optType = OptTypes.HOTP_OPT;
+        otpType = OtpTypes.HOTP_OTP;
     }
 
     @Override

+ 3 - 3
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/MailOtpAuthn.java

@@ -38,7 +38,7 @@ public class MailOtpAuthn extends AbstractOtpAuthn {
     String messageTemplate = "{0} You Token is {1} , it validity in {2}  minutes.";
     
     public MailOtpAuthn() {
-        optType = OptTypes.EMAIL;
+        otpType = OtpTypes.EMAIL;
     }
 
     @Override
@@ -68,7 +68,7 @@ public class MailOtpAuthn extends AbstractOtpAuthn {
                     userInfo, 
                     token, 
                     userInfo.getMobile(), 
-                    OptTypes.EMAIL);
+                    OtpTypes.EMAIL);
             return true;
         } catch (Exception e) {
             e.printStackTrace();
@@ -78,7 +78,7 @@ public class MailOtpAuthn extends AbstractOtpAuthn {
 
     @Override
     public boolean validate(UserInfo userInfo, String token) {
-        return this.optTokenStore.validate(userInfo, token, OptTypes.EMAIL, interval);
+        return this.optTokenStore.validate(userInfo, token, OtpTypes.EMAIL, interval);
     }
 
     public void setEmailConfig(EmailConfig emailConfig) {

+ 1 - 1
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/MobileOtpAuthn.java

@@ -25,7 +25,7 @@ public class MobileOtpAuthn extends AbstractOtpAuthn {
     
     
     public MobileOtpAuthn() {
-        optType = OptTypes.SMS;
+        otpType = OtpTypes.SMS;
     }
 
     @Override

+ 1 - 1
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/RsaOtpAuthn.java

@@ -35,7 +35,7 @@ public class RsaOtpAuthn extends AbstractOtpAuthn {
     
     
     public RsaOtpAuthn() {
-        optType = OptTypes.RSA_OPT;
+        otpType = OtpTypes.RSA_OTP;
     }
 
     @Override

+ 3 - 3
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/sms/SmsOtpAuthnAliyun.java

@@ -42,7 +42,7 @@ public class SmsOtpAuthnAliyun extends SmsOtpAuthn {
     private static final  Logger logger = LoggerFactory.getLogger(SmsOtpAuthnAliyun.class);
     
     public SmsOtpAuthnAliyun() {
-        optType = OptTypes.SMS;
+        otpType = OtpTypes.SMS;
     }
 
     //请替换你在管理后台应用下申请的accessKeyId
@@ -83,7 +83,7 @@ public class SmsOtpAuthnAliyun extends SmsOtpAuthn {
                             userInfo, 
                             token, 
                             userInfo.getMobile(), 
-                            OptTypes.SMS);
+                            OtpTypes.SMS);
                     return true;
                 }
             } catch  (Exception e) {
@@ -95,7 +95,7 @@ public class SmsOtpAuthnAliyun extends SmsOtpAuthn {
 
     @Override
     public boolean validate(UserInfo userInfo, String token) {
-        return this.optTokenStore.validate(userInfo, token, OptTypes.SMS, interval);
+        return this.optTokenStore.validate(userInfo, token, OtpTypes.SMS, interval);
     }
 
     public String getAccessKeyId() {

+ 3 - 3
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/sms/SmsOtpAuthnTencentCloud.java

@@ -52,7 +52,7 @@ public class SmsOtpAuthnTencentCloud extends SmsOtpAuthn {
     String sign;
     
     public SmsOtpAuthnTencentCloud() {
-        optType = OptTypes.SMS;
+        otpType = OtpTypes.SMS;
     }
     
 
@@ -89,7 +89,7 @@ public class SmsOtpAuthnTencentCloud extends SmsOtpAuthn {
                             userInfo, 
                             token, 
                             userInfo.getMobile(), 
-                            OptTypes.SMS);
+                            OtpTypes.SMS);
                     return true;
                 }
                
@@ -102,7 +102,7 @@ public class SmsOtpAuthnTencentCloud extends SmsOtpAuthn {
 
     @Override
     public boolean validate(UserInfo userInfo, String token) {
-        return this.optTokenStore.validate(userInfo, token, OptTypes.SMS, interval);
+        return this.optTokenStore.validate(userInfo, token, OtpTypes.SMS, interval);
     }
 
 

+ 3 - 3
maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/sms/SmsOtpAuthnYunxin.java

@@ -45,7 +45,7 @@ public class SmsOtpAuthnYunxin extends SmsOtpAuthn {
     private static final  Logger logger = LoggerFactory.getLogger(SmsOtpAuthnYunxin.class);
     
     public SmsOtpAuthnYunxin() {
-        optType = OptTypes.SMS;
+        otpType = OtpTypes.SMS;
     }
 
     //发送验证码的请求路径URL
@@ -122,7 +122,7 @@ public class SmsOtpAuthnYunxin extends SmsOtpAuthn {
                                         userInfo, 
                                         yunxinSms.getObj(), 
                                         userInfo.getMobile(), 
-                                        OptTypes.SMS);
+                                        OtpTypes.SMS);
                 return true;
             } catch  (Exception e) {
                 logger.error(" produce code error ", e);
@@ -137,7 +137,7 @@ public class SmsOtpAuthnYunxin extends SmsOtpAuthn {
 
     @Override
     public boolean validate(UserInfo userInfo, String token) {
-        return this.optTokenStore.validate(userInfo, token, OptTypes.SMS, interval);
+        return this.optTokenStore.validate(userInfo, token, OtpTypes.SMS, interval);
     }
 
     

+ 1 - 1
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LoginEndpoint.java

@@ -151,7 +151,7 @@ public class LoginEndpoint {
 			modelAndView.addObject("isKerberos", applicationConfig.getLoginConfig().isKerberos());
 			modelAndView.addObject("isMfa", applicationConfig.getLoginConfig().isMfa());
 			if(applicationConfig.getLoginConfig().isMfa()) {
-			    modelAndView.addObject("optType", tfaOptAuthn.getOptType());
+			    modelAndView.addObject("optType", tfaOptAuthn.getOtpType());
 			    modelAndView.addObject("optInterval", tfaOptAuthn.getInterval());
 			}