Class CustomAccessDeniedHandler
java.lang.Object
springboot.bg.harisauto.common.config.security.CustomAccessDeniedHandler
- All Implemented Interfaces:
org.springframework.security.web.access.AccessDeniedHandler
@Component
public class CustomAccessDeniedHandler
extends Object
implements org.springframework.security.web.access.AccessDeniedHandler
CustomAccessDeniedHandler.java - Handles access denied exceptions by redirecting users.
- Author:
- Kristian Popov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.access.AccessDeniedException exception) Redirects users to the home page if they are not authorized to access a resource.
-
Constructor Details
-
CustomAccessDeniedHandler
public CustomAccessDeniedHandler()
-
-
Method Details
-
handle
public void handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.access.AccessDeniedException exception) throws IOException Redirects users to the home page if they are not authorized to access a resource.- Specified by:
handlein interfaceorg.springframework.security.web.access.AccessDeniedHandler- Parameters:
request- that resulted in anAccessDeniedExceptionresponse- so that the user agent can be advised of the failureexception- that caused the invocation- Throws:
IOException- IOException
-