Class AuthExceptionHandler

java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
com.skava.core.security.CommonExceptionHandler
com.skava.core.errorhandler.ExceptionResponseProcessor
com.skava.auth.helper.AuthExceptionHandler
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.MessageSourceAware
Direct Known Subclasses:
AggregatedAccessController, AuthGroupController, ClientRoleController, ClientSessionController, CollectionAttributeController, CollectionController, CollectionPropertyController, DynamicPrivilegeController, FeaturesPrivilegeMappingController, FeaturesRoleMappingController, GroupAttributeController, OpenAuthClientController, PrivilegeController, PrivilegeSetController, RoleController, SessionController, UserAttributeController, UserRoleController

public class AuthExceptionHandler extends com.skava.core.errorhandler.ExceptionResponseProcessor
This class handles exceptions by constructing and returning the validation response with error codes and localized message.
Version:
$Id: $Id
Author:
Infosys Equinox
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    CONST_API_VERSION_DEFAULT holds the api version default vlaue
    protected static final String
     
    protected static final String
    The Constant X_TOTAL_COUNT.

    Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

    logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    com.skava.core.validation.ValidationErrorResponse
    This method construct the validation response for the given authorization response enumerator.
    com.skava.core.validation.ValidationErrorResponse
    handleAccessDeniedException(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.access.AccessDeniedException accessDeniedException)
    This method is used to construct ValidationErrorResponse and set error code and localized message for access denied exception.
    com.skava.core.validation.ValidationErrorResponse
    handleResourceNotFoundException(jakarta.servlet.http.HttpServletRequest request, com.skava.core.errorhandler.ResourceNotFoundException resourceNotFoundException)
    This method used to construct ValidationErrorResponse and set error code and localized message for resource not found exception.
    com.skava.core.validation.ValidationErrorResponse
    handleRunTimeException(jakarta.servlet.http.HttpServletRequest request, RuntimeException runtimeException)
    This method is used to construct ValidationErrorResponse and set error code and localized message for run time exception.

    Methods inherited from class com.skava.core.errorhandler.ExceptionResponseProcessor

    getExceptionResponse, handleExceptionInternal, handleMethodArgumentNotValid

    Methods inherited from class com.skava.core.security.CommonExceptionHandler

    handleExceptionInternal, handleInternalException

    Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

    createProblemDetail, createResponseEntity, getMessageSource, handleAsyncRequestNotUsableException, handleAsyncRequestTimeoutException, handleConversionNotSupported, handleErrorResponseException, handleException, handleHandlerMethodValidationException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMaxUploadSizeExceededException, handleMethodValidationException, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleNoResourceFoundException, handleServletRequestBindingException, handleTypeMismatch, setMessageSource

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AuthExceptionHandler

      public AuthExceptionHandler()
      Default constructor
  • Method Details

    • handleResourceNotFoundException

      @ResponseStatus(value=NOT_FOUND, code=NOT_FOUND) @ExceptionHandler(com.skava.core.errorhandler.ResourceNotFoundException.class) public com.skava.core.validation.ValidationErrorResponse handleResourceNotFoundException(jakarta.servlet.http.HttpServletRequest request, com.skava.core.errorhandler.ResourceNotFoundException resourceNotFoundException)
      This method used to construct ValidationErrorResponse and set error code and localized message for resource not found exception.
      Parameters:
      request - a HttpServletRequest object. client request.
      resourceNotFoundException - a ResourceNotFoundException object. a exception for response code and message construction.
      Returns:
      a ValidationErrorResponse object. a validation response for resource not found exception.
    • handleAccessDeniedException

      @ResponseStatus(value=FORBIDDEN, code=FORBIDDEN) @ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) public com.skava.core.validation.ValidationErrorResponse handleAccessDeniedException(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.access.AccessDeniedException accessDeniedException)
      This method is used to construct ValidationErrorResponse and set error code and localized message for access denied exception.
      Parameters:
      request - a HttpServletRequest object. client request.
      accessDeniedException - a AccessDeniedException object. a exception for response code and message construction.
      Returns:
      a ValidationErrorResponse object. a validation response for access denied exception.
    • handleRunTimeException

      @ResponseStatus(value=BAD_REQUEST, code=BAD_REQUEST) @ExceptionHandler(java.lang.RuntimeException.class) public com.skava.core.validation.ValidationErrorResponse handleRunTimeException(jakarta.servlet.http.HttpServletRequest request, RuntimeException runtimeException)
      This method is used to construct ValidationErrorResponse and set error code and localized message for run time exception.
      Parameters:
      request - a HttpServletRequest object. client request.
      runtimeException - a RuntimeException object. a exception for response code and message construction.
      Returns:
      a ValidationErrorResponse object. a validation response for run time exception.
    • getValidationResponse

      public com.skava.core.validation.ValidationErrorResponse getValidationResponse(AuthResponseCodes authResponseCode)
      This method construct the validation response for the given authorization response enumerator.
      Parameters:
      authResponseCode - a AuthResponseCodes object. a Authorization response code enumerator to handle validation responses.
      Returns:
      a ValidationErrorResponse object. localized validation response for the given response.