I am trying to add handler on user login. In basic spring security it could be implemented by this code:
protected void configure(HttpSecurity http) throws Exception {
http.
//some configurations
.formLogin().successHandler(authenticationSuccessHandler);
}
Unfortunalty, this way do not work with oauth2 password flow because user do not authenticate using login form(there is direct request to oauth/token endpoint). I have found this answer, and wonder is there cleaner way?
UPD: If I use AuthenticationSuccessEvent - I receive this event on every request, Perhaps because I use JWT authentication.