zouxuan 5 年之前
父节点
当前提交
8401a25ed0

+ 10 - 0
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/core/filter/UsernameAuthenticationFilter.java

@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.authentication.AuthenticationServiceException;
+import org.springframework.security.authentication.LockedException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
@@ -80,6 +81,15 @@ public class UsernameAuthenticationFilter extends AbstractAuthenticationProcessi
 		if (userInfo == null) {
 			throw new UsernameNotFoundException("404.9");
 		}
+
+		if(!userInfo.getSysUser().getIsSuperAdmin()){
+			if(clientId.equalsIgnoreCase("system")){
+				Integer lockFlag = sysUserService.queryEmployeeLockFlag(userInfo.getSysUser().getId());
+				if(lockFlag == 1){
+					throw new LockedException("账户被锁定");
+				}
+			}
+		}
 	
 		if (!StringUtils.upperCase(userInfo.getSysUser().getUserType()).contains(StringUtils.upperCase(clientId))) {
 			throw new UsernameNotFoundException("用户不存在");

+ 1 - 0
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/core/handler/BaseAuthenticationSuccessEventHandler.java

@@ -22,6 +22,7 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.LockedException;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException;