Class LoginEntryPoint

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean, org.springframework.security.web.AuthenticationEntryPoint

    public class LoginEntryPoint
    extends org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
    Extends Spring security to handle session timeout requests differently for AJAX. 1. return non redirecting HTTP status code: 403 2. Remove the initial request URL
    • Constructor Detail

      • LoginEntryPoint

        public LoginEntryPoint()
        Construct a redirect entry point with the default login form URL
      • LoginEntryPoint

        public LoginEntryPoint​(String loginFormUrl)
        Construct a redirect entry point with the specified login form URL
        Parameters:
        loginFormUrl - the login form URL (required)
    • Method Detail

      • commence

        public void commence​(HttpServletRequest request,
                             HttpServletResponse response,
                             org.springframework.security.core.AuthenticationException authException)
                      throws IOException,
                             ServletException
        Specified by:
        commence in interface org.springframework.security.web.AuthenticationEntryPoint
        Overrides:
        commence in class org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
        Parameters:
        request - the servlet request
        response - the servlet response
        authException - the Authentication Exception
        Throws:
        IOException - if an IO error occurs
        ServletException - if a servlet error occurs
        See Also:
        AuthenticationEntryPoint.commence(HttpServletRequest, HttpServletResponse, AuthenticationException)
      • determineUrlToUseForThisRequest

        protected String determineUrlToUseForThisRequest​(HttpServletRequest request,
                                                         HttpServletResponse response,
                                                         org.springframework.security.core.AuthenticationException exception)
        Allows subclasses to modify the login form URL that should be applicable for a given request.
        Overrides:
        determineUrlToUseForThisRequest in class org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
        Parameters:
        request - the request
        response - the response
        exception - the exception
        Returns:
        the URL (cannot be null or empty; defaults to LoginUrlAuthenticationEntryPoint.getLoginFormUrl())