From 67e359fa8f842c16ce2ff2ab21a8cf0a7d11d44f Mon Sep 17 00:00:00 2001 From: fshenye <512914587@qq.com> Date: Fri, 21 Oct 2022 17:05:13 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=A4=84=E7=90=86=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=94=81=E5=AE=9A=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/SictWebResponseExceptionTranslator.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cloud-common/cloud-common-security/src/main/java/cn/sh/stc/sict/cloud/common/security/component/SictWebResponseExceptionTranslator.java b/cloud-common/cloud-common-security/src/main/java/cn/sh/stc/sict/cloud/common/security/component/SictWebResponseExceptionTranslator.java index bd68dae..1a437b3 100644 --- a/cloud-common/cloud-common-security/src/main/java/cn/sh/stc/sict/cloud/common/security/component/SictWebResponseExceptionTranslator.java +++ b/cloud-common/cloud-common-security/src/main/java/cn/sh/stc/sict/cloud/common/security/component/SictWebResponseExceptionTranslator.java @@ -35,13 +35,14 @@ public class SictWebResponseExceptionTranslator implements WebResponseExceptionT // Try to extract a SpringSecurityException from the stacktrace Throwable[] causeChain = throwableAnalyzer.determineCauseChain(e); + Exception ase = (AccountLockedException) throwableAnalyzer.getFirstThrowableOfType(AccountLockedException.class, causeChain); + if(ase != null){ + return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e, HttpStatus.LOCKED.value())); + } - Exception ase = (AuthenticationException) throwableAnalyzer.getFirstThrowableOfType(AuthenticationException.class, + ase = (AuthenticationException) throwableAnalyzer.getFirstThrowableOfType(AuthenticationException.class, causeChain); if (ase != null) { - if(ase instanceof AccountLockedException){ - return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e, HttpStatus.LOCKED.value())); - } return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e)); } -- 2.22.0