Class SecurityGlobalExceptionHandler

java.lang.Object
cn.herodotus.engine.oauth2.core.exception.SecurityGlobalExceptionHandler

@RestControllerAdvice public class SecurityGlobalExceptionHandler extends Object

Description: 统一异常处理器

Author:
: gengwei.zheng
Date:
: 2019/11/18 8:12
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static cn.herodotus.engine.assistant.definition.domain.Result<String>
    authenticationException(Exception ex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    统一异常处理 AuthenticationException
    static 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>
     
    static cn.herodotus.engine.assistant.definition.domain.Result<String>
    静态解析认证异常
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static cn.herodotus.engine.assistant.definition.domain.Result<String> resolveException(Exception ex, String path)
    • resolveSecurityException

      public static cn.herodotus.engine.assistant.definition.domain.Result<String> resolveSecurityException(Exception exception, String path)
      静态解析认证异常
      Parameters:
      exception - 错误信息
      Returns:
      Result 对象