mobile login
This commit is contained in:
@@ -47,13 +47,12 @@ public class SmsOtpAuthn extends AbstractOtpAuthn {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void loadProperties() throws IOException {
|
||||
Resource resource = new ClassPathResource(
|
||||
ConstantsProperties.classPathResource(
|
||||
ConstantsProperties.classPathResource(
|
||||
ConstantsProperties.applicationPropertySource)));
|
||||
properties = new Properties();
|
||||
properties.load(resource.getInputStream());
|
||||
public void setProperties(Properties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
protected void loadProperties() throws IOException {
|
||||
|
||||
}
|
||||
|
||||
public void initPropertys() {
|
||||
|
||||
@@ -138,10 +138,10 @@ public class SmsOtpAuthnAliyun extends SmsOtpAuthn {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.accessKeyId = this.properties.getProperty("config.otp.sms.aliyun.accesskeyid");
|
||||
this.accessSecret = this.properties.getProperty("config.otp.sms.aliyun.accesssecret");
|
||||
this.templateCode = this.properties.getProperty("config.otp.sms.aliyun.templatecode");
|
||||
this.signName = this.properties.getProperty("config.otp.sms.aliyun.signname");
|
||||
this.accessKeyId = this.properties.getProperty("maxkey.otp.sms.aliyun.accesskeyid");
|
||||
this.accessSecret = this.properties.getProperty("maxkey.otp.sms.aliyun.accesssecret");
|
||||
this.templateCode = this.properties.getProperty("maxkey.otp.sms.aliyun.templatecode");
|
||||
this.signName = this.properties.getProperty("maxkey.otp.sms.aliyun.signname");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -181,11 +181,11 @@ public class SmsOtpAuthnTencentCloud extends SmsOtpAuthn {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.secretId = this.properties.getProperty("config.otp.sms.tencentcloud.secretid");
|
||||
this.secretKey = this.properties.getProperty("config.otp.sms.tencentcloud.secretkey");
|
||||
this.smsSdkAppid = this.properties.getProperty("config.otp.sms.tencentcloud.smssdkappid");
|
||||
this.templateId = this.properties.getProperty("config.otp.sms.tencentcloud.templateid");
|
||||
this.sign = this.properties.getProperty("config.otp.sms.tencentcloud.sign");
|
||||
this.secretId = this.properties.getProperty("maxkey.otp.sms.tencentcloud.secretid");
|
||||
this.secretKey = this.properties.getProperty("maxkey.otp.sms.tencentcloud.secretkey");
|
||||
this.smsSdkAppid = this.properties.getProperty("maxkey.otp.sms.tencentcloud.smssdkappid");
|
||||
this.templateId = this.properties.getProperty("maxkey.otp.sms.tencentcloud.templateid");
|
||||
this.sign = this.properties.getProperty("maxkey.otp.sms.tencentcloud.sign");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SmsOtpAuthnYunxin extends SmsOtpAuthn {
|
||||
).randomGenerate();
|
||||
String checkSum = SmsOtpAuthnYunxinCheckSumBuilder
|
||||
.getCheckSum(appSecret, nonce, curTime);
|
||||
|
||||
logger.debug("AppKey " +appKey+" ,Nonce "+nonce+", CurTime "+curTime+" ,checkSum "+checkSum);
|
||||
// 设置请求的header
|
||||
httpPost.addHeader("AppKey", appKey);
|
||||
httpPost.addHeader("Nonce", nonce);
|
||||
@@ -118,9 +118,11 @@ public class SmsOtpAuthnYunxin extends SmsOtpAuthn {
|
||||
YunxinSms yunxinSms =
|
||||
JsonUtils.gson2Object(responseString,YunxinSms.class);
|
||||
logger.debug("responseEntity code " + yunxinSms.getObj());
|
||||
nonce = yunxinSms.getObj() == null ?nonce:yunxinSms.getObj();
|
||||
logger.debug("nonce " + nonce);
|
||||
this.optTokenStore.store(
|
||||
userInfo,
|
||||
yunxinSms.getObj(),
|
||||
nonce,
|
||||
userInfo.getMobile(),
|
||||
OtpTypes.SMS);
|
||||
return true;
|
||||
@@ -210,9 +212,9 @@ public class SmsOtpAuthnYunxin extends SmsOtpAuthn {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.appKey = this.properties.getProperty("config.otp.sms.yunxin.appkey");
|
||||
this.appSecret = this.properties.getProperty("config.otp.sms.yunxin.appsecret");
|
||||
this.templateId = this.properties.getProperty("config.otp.sms.yunxin.templateid");
|
||||
this.appKey = this.properties.getProperty("maxkey.otp.sms.yunxin.appkey");
|
||||
this.appSecret = this.properties.getProperty("maxkey.otp.sms.yunxin.appsecret");
|
||||
this.templateId = this.properties.getProperty("maxkey.otp.sms.yunxin.templateid");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,14 +35,14 @@ public class SmsOtpAuthnYunxinCheckSumBuilder {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
|
||||
MessageDigest messageDigest
|
||||
= MessageDigest.getInstance(algorithm);
|
||||
messageDigest.update(value.getBytes());
|
||||
return getFormattedText(messageDigest.digest());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getFormattedText(byte[] bytes) {
|
||||
int len = bytes.length;
|
||||
StringBuilder buf = new StringBuilder(len * 2);
|
||||
@@ -52,8 +52,6 @@ public class SmsOtpAuthnYunxinCheckSumBuilder {
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private static final char[] HEX_DIGITS = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd','e', 'f' };
|
||||
private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user