0

After updating spring 3 to 4 HandlerInterceptorAdapter preHandle method get the HttpServletRequest RequestURI as /login but user was successfully Authenticated and redirected to /dashboard API

inside prehandle method it always return to login and return true

onAuthenticationSuccess method

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
              Authentication authentication) throws IOException, ServletException {
    ....
    ....
    sendRedirect(request, response, "/" + Path.ADMIN_DASHBOARD);
    ....
    ....
}

HandlerInterceptorAdapter code

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
  
    String reqMapParam = request.getServletPath();
    String uri = request.getRequestURI();

......
if (uri.endsWith("login")) {
   request.getSession().invalidate();
   return true;
   }
        
  response.sendRedirect(request.getContextPath() + "/dashboard");
  return false;

}

versions that I am using Spring - 4.3.0.RELEASE Spring Security - 4.2.3.RELEASE

So any help is most appreciated. Thank you

0 Answers0