I have a custom AuthenticationSuccessHandler.
What I want to do is to set some session data within onAuthenticationSuccess method.
To store session data I want to use a session-scoped bean, which works fine within any controller.
But if I try to retrieve it within onAuthenticationSuccess method, I get an exception:
Error creating bean with name 'scopedTarget.sessionData': Scope 'session' is not active for the current thread;
My code is:
WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
SessionData sessionData = context.getBean(SessionData.class);
Any ideas?