Commit 67e359fa authored by 向怀芳's avatar 向怀芳 🎱

1. 处理账号登录锁定异常

parent 72342a61
...@@ -35,13 +35,14 @@ public class SictWebResponseExceptionTranslator implements WebResponseExceptionT ...@@ -35,13 +35,14 @@ public class SictWebResponseExceptionTranslator implements WebResponseExceptionT
// Try to extract a SpringSecurityException from the stacktrace // Try to extract a SpringSecurityException from the stacktrace
Throwable[] causeChain = throwableAnalyzer.determineCauseChain(e); 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); causeChain);
if (ase != null) { if (ase != null) {
if(ase instanceof AccountLockedException){
return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e, HttpStatus.LOCKED.value()));
}
return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e)); return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment