Class SecurityGlobalExceptionHandler
java.lang.Object
cn.herodotus.engine.oauth2.core.exception.SecurityGlobalExceptionHandler
Description: 统一异常处理器
- Author:
- : gengwei.zheng
- Date:
- : 2019/11/18 8:12
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic cn.herodotus.engine.assistant.definition.domain.Result<String>authenticationException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) 统一异常处理 AuthenticationExceptionstatic cn.herodotus.engine.assistant.definition.domain.Result<String>exception(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) static cn.herodotus.engine.assistant.definition.domain.Result<String>oAuth2AuthenticationException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) static cn.herodotus.engine.assistant.definition.domain.Result<String>resolveException(Exception ex, String path) static cn.herodotus.engine.assistant.definition.domain.Result<String>resolveSecurityException(Exception exception, String path) 静态解析认证异常static cn.herodotus.engine.assistant.definition.domain.Result<String>restTemplateException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Rest Template 错误处理static cn.herodotus.engine.assistant.definition.domain.Result<String>validationBindException(org.springframework.validation.BindException ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) static cn.herodotus.engine.assistant.definition.domain.Result<String>validationMethodArgumentException(org.springframework.web.bind.MethodArgumentNotValidException ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
-
Constructor Details
-
SecurityGlobalExceptionHandler
public SecurityGlobalExceptionHandler()
-
-
Method Details
-
restTemplateException
@ExceptionHandler({org.springframework.web.client.HttpClientErrorException.class,org.springframework.web.client.HttpServerErrorException.class}) public static cn.herodotus.engine.assistant.definition.domain.Result<String> restTemplateException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Rest Template 错误处理- Parameters:
ex- 错误request- 请求response- 响应- Returns:
- Result 对象
- See Also:
-
validationMethodArgumentException
@ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class) public static cn.herodotus.engine.assistant.definition.domain.Result<String> validationMethodArgumentException(org.springframework.web.bind.MethodArgumentNotValidException ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
validationBindException
@ExceptionHandler(org.springframework.validation.BindException.class) public static cn.herodotus.engine.assistant.definition.domain.Result<String> validationBindException(org.springframework.validation.BindException ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
authenticationException
@ExceptionHandler({org.springframework.security.core.AuthenticationException.class,PlatformAuthenticationException.class}) public static cn.herodotus.engine.assistant.definition.domain.Result<String> authenticationException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) 统一异常处理 AuthenticationException- Parameters:
ex- 错误request- 请求response- 响应- Returns:
- Result 对象
-
oAuth2AuthenticationException
@ExceptionHandler(org.springframework.security.oauth2.core.OAuth2AuthenticationException.class) public static cn.herodotus.engine.assistant.definition.domain.Result<String> oAuth2AuthenticationException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
exception
@ExceptionHandler({java.lang.Exception.class,cn.herodotus.engine.assistant.definition.exception.PlatformException.class,cn.herodotus.engine.assistant.definition.exception.PlatformRuntimeException.class}) public static cn.herodotus.engine.assistant.definition.domain.Result<String> exception(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
resolveException
-
resolveSecurityException
public static cn.herodotus.engine.assistant.definition.domain.Result<String> resolveSecurityException(Exception exception, String path) 静态解析认证异常- Parameters:
exception- 错误信息- Returns:
- Result 对象
-