| | |
| | | import com.vci.ubcs.system.entity.Tenant; |
| | | import com.vci.ubcs.system.feign.ISysClient; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.AuthorityUtils; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.security.oauth2.common.exceptions.InvalidGrantException; |
| | | import org.springframework.security.oauth2.common.exceptions.UserDeniedAuthorizationException; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | setFailCount(tenantId, username, count,strategy.getLockingTime()); |
| | | throw new UsernameNotFoundException(TokenUtil.USER_NOT_FOUND); |
| | | } |
| | | // 用户状态为1时说明该用户被锁定 |
| | | if(user.getUserStatus() == 1){ |
| | | throw new InvalidGrantException(TokenUtil.USER_LOCK); |
| | | } |
| | | String hex = DigestUtil.hex(password); |
| | | // 用户存在但密码错误,超过次数则锁定账号 |
| | | if (grantType != null && !grantType.equals(TokenUtil.REFRESH_TOKEN_KEY) && !user.getPassword().equals(hex)) { |