Open iKrushYou opened 5 years ago
We are able to listen for success events using the following:
@Component
public class AuthSuccessListener implements ApplicationListener<AuthenticationSuccessEvent> {
...
}
This worked for me:
@Component
public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
@Autowired
AuthenticationSuccessHandler authenticationTimeStamper;
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
//Do what needs to be done
//pass to the next handler
authenticationTimeStamper.onAuthenticationSuccess(request, response, authentication);
}
In user-context.xml
<security:http authentication-manager-ref="authenticationManager">
<security:form-login login-page="/login" authentication-failure-url="/login?error=failure"
authentication-success-handler-ref="myAuthenticationHandler" />
<bean id="myAuthenticationHandler"
class="com.my.idp.MyAuthenticationSuccessHandler" />
I'm trying to implement an successhandler for my login but can't seem to get it working
I do apologize that this is a question and not an issue.. but I was hoping that posting directly to the repo I might get a better answer than on SO