Announcement Announcement Module
Collapse
No announcement yet.
AuthenticationHandler sendRedirect doesn't update URL Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X