| | |
| | | public class BladeUserDetailsServiceImpl implements UserDetailsService { |
| | | |
| | | /** |
| | | * 允许错误次数 |
| | | * 默认允许错误次数 |
| | | */ |
| | | //public static final Integer FAIL_COUNT = 5; |
| | | public static final Integer FAIL_COUNT = 5; |
| | | public static final String FAIL_COUNT_VALUE = "account.failCount"; |
| | | |
| | | /** |
| | |
| | | private final BladeRedis bladeRedis; |
| | | |
| | | private final JwtProperties jwtProperties; |
| | | |
| | | |
| | | /** |
| | | * 超级管理员信息 |
| | |
| | | // 判断登录是否锁定 |
| | | int count = getFailCount(tenantId, username); |
| | | //为防止取值为空报错的情况,当为空的时候给默认只为5次便锁定用户登录,但是一般很难出现这种情况,因为我feign里面是给了默认密码策略查询的 |
| | | int failCountValue = Func.isEmpty(strategy) ? 5:Func.toInt(strategy.getLockingNum()); |
| | | |
| | | int failCountValue = Func.isEmpty(strategy) ? FAIL_COUNT:Func.toInt(strategy.getLockingNum()); |
| | | int failCount = Func.toInt(ParamCache.getValue(FAIL_COUNT_VALUE), failCountValue); |
| | | |
| | | if (count >= failCount) { |
| | | throw new UserDeniedAuthorizationException(TokenUtil.USER_HAS_TOO_MANY_FAILS); |
| | | } |
| | | // 将请求头放进线程中 |
| | | |
| | | //超级管理员配置文件配置账号密码,实现登录, 默认租户id为000000 |
| | | if(tenantId.equals(this.tenantId)){ |
| | | if (!this.userName.equals(username) && !password.equalsIgnoreCase(this.password)) { |