Package com.skava.auth.helper
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
FieldsModifier and TypeFieldDescriptionstatic final String
CONST_API_VERSION_DEFAULT holds the api version default vlaueprotected 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 -
Method Summary
Modifier and TypeMethodDescriptioncom.skava.core.validation.ValidationErrorResponse
getValidationResponse
(AuthResponseCodes authResponseCode) 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
-
Field Details
-
DEFAULT_LIMIT
- See Also:
-
X_TOTAL_COUNT
The Constant X_TOTAL_COUNT.- See Also:
-
CONST_API_VERSION_DEFAULT
CONST_API_VERSION_DEFAULT holds the api version default vlaue- See Also:
-
-
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
- aHttpServletRequest
object. client request.resourceNotFoundException
- aResourceNotFoundException
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
- aHttpServletRequest
object. client request.accessDeniedException
- aAccessDeniedException
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
- aHttpServletRequest
object. client request.runtimeException
- aRuntimeException
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
- aAuthResponseCodes
object. a Authorization response code enumerator to handle validation responses.- Returns:
- a
ValidationErrorResponse
object. localized validation response for the given response.
-