|
|
@ -48,7 +48,7 @@ public class PasswordAuthStrategy implements IAuthStrategy { |
|
|
private final SysLoginService loginService; |
|
|
private final SysLoginService loginService; |
|
|
private final SysUserMapper userMapper; |
|
|
private final SysUserMapper userMapper; |
|
|
private final PasswordService passwordService; |
|
|
private final PasswordService passwordService; |
|
|
private final ICryptoSensitiveHsmService ICryptoSensitiveHsmService; |
|
|
private final ICryptoSensitiveHsmService iCryptoSensitiveHsmService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public LoginVo login(String body, SysClientVo client) { |
|
|
public LoginVo login(String body, SysClientVo client) { |
|
|
@ -68,14 +68,14 @@ public class PasswordAuthStrategy implements IAuthStrategy { |
|
|
SysUser user = loadUserByUsername(username); |
|
|
SysUser user = loadUserByUsername(username); |
|
|
loginService.checkLogin(LoginType.PASSWORD, tenantId, username, () -> { |
|
|
loginService.checkLogin(LoginType.PASSWORD, tenantId, username, () -> { |
|
|
String bizId = String.valueOf(user.getUserId()); |
|
|
String bizId = String.valueOf(user.getUserId()); |
|
|
try { |
|
|
// try {
|
|
|
return !ICryptoSensitiveHsmService.verifyPassword("sys_user", bizId, password); |
|
|
// return !ICryptoSensitiveHsmService.verifyPassword("sys_user", bizId, password);
|
|
|
} catch (Exception e) { |
|
|
// } catch (Exception e) {
|
|
|
log.warn("HSM密码校验失败, userId={}, 降级使用MD5校验", user.getUserId()); |
|
|
log.warn("HSM密码校验失败, userId={}, 降级使用MD5校验", user.getUserId()); |
|
|
String salt = user.getSalt(); |
|
|
String salt = user.getSalt(); |
|
|
String encodedPassword = user.getPassword(); |
|
|
String encodedPassword = user.getPassword(); |
|
|
return !passwordService.matches(password, encodedPassword, username, salt); |
|
|
return !passwordService.matches(password, encodedPassword, username, salt); |
|
|
} |
|
|
// }
|
|
|
}); |
|
|
}); |
|
|
return loginService.buildLoginUser(user); |
|
|
return loginService.buildLoginUser(user); |
|
|
}); |
|
|
}); |
|
|
|