Commit cf191ace authored by AfirSraftGarrier's avatar AfirSraftGarrier

上报错误方法改变

parent 799fad48
...@@ -80,9 +80,14 @@ public class AuthManager { ...@@ -80,9 +80,14 @@ public class AuthManager {
log.info("in black..."); log.info("in black...");
return false; return false;
} }
Apply apply = allApply.get(appId); String theAppId = device.getAppId();
if (theAppId == null) {
log.info("no real valid appId...");
return false;
}
Apply apply = allApply.get(theAppId);
String appKey = apply.getAppKey(); String appKey = apply.getAppKey();
String input = "app_id=" + appId + "&sn=" + sn; String input = "app_id=" + theAppId + "&sn=" + sn;
String valSHA1 = HmacUtil.encrypt(input, appKey, HmacUtil.HMAC_SHA1).toUpperCase(); String valSHA1 = HmacUtil.encrypt(input, appKey, HmacUtil.HMAC_SHA1).toUpperCase();
if (CommonUtil.toUpperCaseByEnglish(sign).equals(CommonUtil.toUpperCaseByEnglish(valSHA1))) { if (CommonUtil.toUpperCaseByEnglish(sign).equals(CommonUtil.toUpperCaseByEnglish(valSHA1))) {
return true; return true;
...@@ -102,11 +107,6 @@ public class AuthManager { ...@@ -102,11 +107,6 @@ public class AuthManager {
return false; return false;
} }
DeviceVo device = deviceManager.getDevice(sn); DeviceVo device = deviceManager.getDevice(sn);
String tempAppId = device.getAppId();
if (!appId.equals(tempAppId)) {
log.info("appId and sn no matching ...");
return false;
}
// 未绑定 // 未绑定
if (device.getSnBind() == null) { if (device.getSnBind() == null) {
log.info("bind sn null..."); log.info("bind sn null...");
...@@ -117,9 +117,14 @@ public class AuthManager { ...@@ -117,9 +117,14 @@ public class AuthManager {
log.info("in black..."); log.info("in black...");
return false; return false;
} }
Apply apply = allApply.get(appId); String theAppId = device.getAppId();
if (theAppId == null) {
log.info("no real valid appId...");
return false;
}
Apply apply = allApply.get(theAppId);
String appKey = apply.getAppKey(); String appKey = apply.getAppKey();
String input = "app_id=" + appId + "&sn=" + sn + "&sn_bind=" + device.getSnBind(); String input = "app_id=" + theAppId + "&sn=" + sn + "&sn_bind=" + device.getSnBind();
String valSHA1 = HmacUtil.encrypt(input, appKey, HmacUtil.HMAC_SHA1).toUpperCase(); String valSHA1 = HmacUtil.encrypt(input, appKey, HmacUtil.HMAC_SHA1).toUpperCase();
if (CommonUtil.toUpperCaseByEnglish(sign).equals(CommonUtil.toUpperCaseByEnglish(valSHA1))) { if (CommonUtil.toUpperCaseByEnglish(sign).equals(CommonUtil.toUpperCaseByEnglish(valSHA1))) {
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment