Results 1 to 2 of 2

Thread: AuthenticationHandler sendRedirect doesn't update URL

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Default AuthenticationHandler sendRedirect doesn't update URL

    Hello

    I'm using spring 3.1.1 and having a problem that I couldn't find in any another thread. I have a custom AutenticationHandler, and inside this handler i want to redirect the user based on some custom logic...

    Here's my code:

    Code:
    @Override
    	public void onAuthenticationSuccess(HttpServletRequest request,
    			HttpServletResponse response, Authentication authentication)
    			throws IOException, ServletException {
    		User user = (User) authentication.getDetails();
    
    		if (user.hasMoreThanOneUnity()) {
    			response.sendRedirect(request.getContextPath() + "/selectUnity");
    		} else {
    			user.setUnity(user.unitiesWithAccess().iterator().next());
    			response.sendRedirect(request.getContextPath() + "/login/start");
    		}
    	}
    The code is working, but whats is upseting me is that the browser URL isn't updated by sendRedirect, so, if the user hits update browser button, then he will be in the login page again.

    Is there some way to update the browser URL? I'm doing something wrong?

    Thanks in Advance

  2. #2
    Join Date
    Jul 2012
    Posts
    2

    Default

    Sorry for the post.

    It's working, Spring had notthing to do with it.

    The problem was that the requests was sent through AJAX, so i have to manually handle the redirect by javascript.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •