Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

SEC-1569: AuthenticationSuccessEvent is published twice when ProviderManager has a parent ProviderManager #1811

spring-issuemaster opened this Issue Sep 10, 2010 · 4 comments


None yet
1 participant

spring-issuemaster commented Sep 10, 2010 edited by rwinch

Nikita D (Migrated from SEC-1569) said:

I've configured spring security using the namespace. In particular, I have the following configs:

    <sec:anonymous enabled="true"/>

  <sec:authentication-manager erase-credentials="true">
    <sec:authentication-provider ref="myAuthProvider"/>

This results in a ProviderManager that has the AnonymousAuthenticationProvider and a parent ProviderManager which has MyAuthProvider. During a valid authentication attempt by a user, the AnonymousAuthenticationProvider is skipped and the parent ProviderManager is invoked (line 148 in ProviderManager). This one successfully authenticates the user and publishes an AuthenticationSuccessEvent. The problem is that when this parent ProviderManager returns, the first ProviderManager publishes the success event again (lines 157-165).

Luke Taylor said:

Are you sure you aren't seeing both the event from the filter and the one from the ProviderManager. Could you provide some log output or other information to illustrate the problem please?

Nikita D said:

DEBUG log output.

Nikita D said:

Hi Luke, you are right, the eventPublisher of the parent ProviderManager is actually a NullEventPublisher. The second success event is coming from UsernamePasswordAuthenticationFilter which publishes an InteractiveAuthenticationSuccessEvent (as opposed to the AuthenticationSuccessEvent published by the ProviderManager). I've attached the DEBUG log for reference. I'm guessing the two events are intentional and I can just ignore one in my listener based on the even class? Thank you for the help, sorry for logging this too hastily.

Luke Taylor said:

No problem.

@spring-issuemaster spring-issuemaster added this to the 3.1.0.M2 milestone Feb 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment