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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handle(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      handle in interface org.springframework.security.web.access.AccessDeniedHandler
      Parameters:
      request - that resulted in an AccessDeniedException
      response - so that the user agent can be advised of the failure
      exception - that caused the invocation
      Throws:
      IOException - IOException