增加认证日志
This commit is contained in:
@@ -81,7 +81,6 @@ public class AuthController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("postAccessToken");
|
String methodDescribe = getMethodDescribe("postAccessToken");
|
||||||
String username = parameters.get(SecurityConstants.USERNAME);
|
String username = parameters.get(SecurityConstants.USERNAME);
|
||||||
String grantType = parameters.get(SecurityConstants.GRANT_TYPE);
|
String grantType = parameters.get(SecurityConstants.GRANT_TYPE);
|
||||||
log.error("登录参数为:" + parameters);
|
|
||||||
if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_CAPTCHA)) {
|
if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_CAPTCHA)) {
|
||||||
username = DesUtils.aesDecrypt(username);
|
username = DesUtils.aesDecrypt(username);
|
||||||
} else if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_SMS_CODE)) {
|
} else if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_SMS_CODE)) {
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class CaptchaTokenGranter extends AbstractTokenGranter {
|
|||||||
userAuth = authenticationManager.authenticate(userAuth);
|
userAuth = authenticationManager.authenticate(userAuth);
|
||||||
} catch (AccountStatusException | BadCredentialsException ase) {
|
} catch (AccountStatusException | BadCredentialsException ase) {
|
||||||
//covers expired, locked, disabled cases
|
//covers expired, locked, disabled cases
|
||||||
ase.printStackTrace();
|
|
||||||
throw new InvalidGrantException(ase.getMessage());
|
throw new InvalidGrantException(ase.getMessage());
|
||||||
}
|
}
|
||||||
// If the username/password are wrong the spec says we should send 400/invalid grant
|
// If the username/password are wrong the spec says we should send 400/invalid grant
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class Sm4AuthenticationProvider extends AbstractUserDetailsAuthentication
|
|||||||
}
|
}
|
||||||
|
|
||||||
String presentedPassword = authentication.getCredentials().toString();
|
String presentedPassword = authentication.getCredentials().toString();
|
||||||
|
log.error("用户当前密码:"+presentedPassword);
|
||||||
BusinessUser businessUser = (BusinessUser)userDetails;
|
BusinessUser businessUser = (BusinessUser)userDetails;
|
||||||
String secretKey = businessUser.getSecretKey();
|
String secretKey = businessUser.getSecretKey();
|
||||||
Sm4Utils sm4 = new Sm4Utils(secretKey);
|
Sm4Utils sm4 = new Sm4Utils(secretKey);
|
||||||
@@ -54,6 +55,8 @@ public class Sm4AuthenticationProvider extends AbstractUserDetailsAuthentication
|
|||||||
String sm4PwdOnce = sm4.encryptData_ECB(presentedPassword);
|
String sm4PwdOnce = sm4.encryptData_ECB(presentedPassword);
|
||||||
//SM4加密(密码+工作秘钥)
|
//SM4加密(密码+工作秘钥)
|
||||||
String sm4PwdTwice = sm4.encryptData_ECB(sm4PwdOnce + secretKey);
|
String sm4PwdTwice = sm4.encryptData_ECB(sm4PwdOnce + secretKey);
|
||||||
|
log.error("加密后的:"+sm4PwdTwice);
|
||||||
|
log.error("数据库的:"+businessUser.getPassword());
|
||||||
if(!businessUser.getPassword().equalsIgnoreCase(sm4PwdTwice)){
|
if(!businessUser.getPassword().equalsIgnoreCase(sm4PwdTwice)){
|
||||||
throw new BadCredentialsException(messages.getMessage(
|
throw new BadCredentialsException(messages.getMessage(
|
||||||
"AbstractUserDetailsAuthenticationProvider.badCredentials",
|
"AbstractUserDetailsAuthenticationProvider.badCredentials",
|
||||||
|
|||||||
Reference in New Issue
Block a user