Announcement Announcement Module
Collapse
No announcement yet.
My simple AuthenticationSuccessHandler disrupts login flow Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • My simple AuthenticationSuccessHandler disrupts login flow

    Hello,

    I've just written a small implementation of AuthenticationSuccessHandler to interrogate the principal of the Authentication object and put something in the session:
    Code:
        public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
            String timeZoneId = null;
            UserDetailsAgent uda = (UserDetailsAgent) authentication.getPrincipal();
                timeZoneId = uda.getAgent().getTimezoneId();
            // Store the time zone id in the session
            request.getSession().setAttribute(SESSION_ATTR_NAME_TIME_ZONE_ID,
                    timeZoneId != null ? timeZoneId : defaultTimeZoneId);
        }
    Now after logging in, I don't get redirected/forwarded anywhere. I'm left at http://localhost:8080/myapp/j_spring_security_check. How can I include my logic without disrupting what normally happens?

    Thanks,

    PUK

  • #2
    It's up to you to control the flow from the AuthenticationSuccessHandler. That's one of the main reasons for introducing the strategy. The number of different configuration options was getting out of hand. There's a section in the manual which describes this.

    Comment

    Working...
    X