You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AuthenticationSuccessEvent not published for oauth2Login()Β #6009
An AuthenticationManagerBuilder@Bean is registered via AuthenticationConfiguration.authenticationManagerBuilder(). It's also associated with the AuthenticationEventPublisher registered in the context using AuthenticationManagerBuilder.authenticationEventPublisher().
However, WebSecurityConfigurerAdapter.setApplicationContext() initializes 2 instances of AuthenticationManagerBuilder, but does not associate it with the AuthenticationEventPublisher registered in the context.
We need to ensure that the initialization and association of the AuthenticationEventPublisher (registered in the context) is consistent between AuthenticationConfiguration and WebSecurityConfigurerAdapter.
@jgrandja thanks! I will gladly retest and report back, when you have a fix. Any idea on how complex and time consuming it will be? Just so I know if I should wait for a fix, or go ahead and use something else for Audit logging.
changed the title [-]AuthenticationSuccessEvent not published in case of OAuth2 login[/-][+]AuthenticationSuccessEvent not published for oauth2Login()[/+]on Oct 23, 2018
After retest (with 5.1.2.BUILD-SNAPSHOT): I can confirm AuthenticationSuccessEvents er being published, and I can also find AUTHENTICATION_SUCCESS events at Actuator endpoint /auditevents. Thanks a lot for quick fix!
Activity
philwebb commentedon Oct 22, 2018
/cc @ismarslomic
ismarslomic commentedon Oct 22, 2018
*FailureEvents are published though. So the issue is related to *SuccessEvents only
jgrandja commentedon Oct 22, 2018
An
AuthenticationManagerBuilder@Beanis registered viaAuthenticationConfiguration.authenticationManagerBuilder(). It's also associated with theAuthenticationEventPublisherregistered in the context usingAuthenticationManagerBuilder.authenticationEventPublisher().However,
WebSecurityConfigurerAdapter.setApplicationContext()initializes 2 instances ofAuthenticationManagerBuilder, but does not associate it with theAuthenticationEventPublisherregistered in the context.We need to ensure that the initialization and association of the
AuthenticationEventPublisher(registered in the context) is consistent betweenAuthenticationConfigurationandWebSecurityConfigurerAdapter.ismarslomic commentedon Oct 22, 2018
@jgrandja thanks! I will gladly retest and report back, when you have a fix. Any idea on how complex and time consuming it will be? Just so I know if I should wait for a fix, or go ahead and use something else for Audit logging.
Edit: workarounds are also welcome :)
[-]AuthenticationSuccessEvent not published in case of OAuth2 login[/-][+]AuthenticationSuccessEvent not published for oauth2Login()[/+]Set AuthenticationEventPublisher on each AuthenticationManagerBuilder
Set AuthenticationEventPublisher on each AuthenticationManagerBuilder
jgrandja commentedon Oct 23, 2018
@ismarslomic The fix has been applied to master and backported to 5.1.2 and 5.0.10.
ismarslomic commentedon Oct 23, 2018
After retest (with 5.1.2.BUILD-SNAPSHOT): I can confirm
AuthenticationSuccessEvents er being published, and I can also findAUTHENTICATION_SUCCESSevents at Actuator endpoint/auditevents. Thanks a lot for quick fix!Prevent duplicate AuthenticationSuccessEvent