From 336eb77c1a07ca3e3ead4482b51f848fa16ab3b7 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期日, 12 十一月 2023 20:15:38 +0800
Subject: [PATCH] 自定义流水相关开发

---
 Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java b/Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java
index f7ae9a8..18730fb 100644
--- a/Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java
+++ b/Source/UBCS/ubcs-auth/src/main/java/com/vci/ubcs/auth/service/BladeUserDetailsServiceImpl.java
@@ -40,11 +40,13 @@
 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;
 
@@ -132,8 +134,8 @@
 			throw new UserDeniedAuthorizationException(TokenUtil.USER_HAS_TOO_MANY_FAILS);
 		}
 
-		//瓒呯骇绠$悊鍛橀厤缃枃浠堕厤缃处鍙峰瘑鐮侊紝瀹炵幇鐧诲綍, 榛樿绉熸埛id涓�000000
-		if(tenantId.equals(this.tenantId)){
+		//瓒呯骇绠$悊鍛橀厤缃枃浠堕厤缃处鍙峰瘑鐮侊紝瀹炵幇鐧诲綍, 榛樿绉熸埛id鍜岃秴绠′负閰嶇疆鍑烘潵鐨�
+		if(tenantId.equals(this.tenantId) && userName.equals(username)){
 			if (!this.userName.equals(username) && !password.equalsIgnoreCase(this.password)) {
 				setFailCount(tenantId, username, count,strategy.getLockingTime());
 				throw new UsernameNotFoundException(TokenUtil.USER_NOT_FOUND);
@@ -194,6 +196,10 @@
 					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)) {

--
Gitblit v1.9.3