-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AuthenticationFailureBadCredentialsEvent published twice #6281
Comments
we should discussion how to publish the failure event between Parent and Child ProviderManager authentication Parent throw AuthenticationFailureCredentialsExpiredEvent, Child throw AuthenticationFailureBadCredentialsEvent, do we need to publish both the two failure exception? i think we should to do so so i think it is reasonable to publish twice AuthenticationFailureBadCredentialsEvent here, because they are authenticated from two AuthenticationManager, it is just a coincidence that the two AuthenticationManager throw the same Failure Exception |
@jgrandja i think it is not a bug, can we first discussion it please, see the above picture, the AuthenticatiionSuccessEvent should only publish once, but the failure events should all to be published |
@clevertension my specific case is related @rwinch @jgrandja if this is a bug, would it be possible to fix i in a 5.1.x update? |
@mptardy if we have two different failure event during the invocation of the ProviderManager.authentication(), one is AuthenticationFailureBadCredentialsEvent, another is AuthenticationFailureCredentialsExpiredEvent, should we only publish one, or both two? |
@clevertension in my opinion, each type of failure should get published only once. But I have a hard time imagine how both these failures could happen during one authentication call. Either your credentials were wrong and you get a |
this one authentication call is a recursively call, because it have a field AuthenticationManager parent, ok, your advice is also reasonable, let's wait for the feedback |
@clevertension Regarding your scenario
This use case is not valid. If the credentials are bad (wrong password) than both parent and child would throw Furthermore, if the parent and child I really would like to understand your specific use case more to be sure we are not missing anything. Are you able to provide a sample of your specific use case? I might be able to suggest a different configuration to avoid these kind of edge cases. |
Yes, it will be back patched to 5.1.x and 5.0.x |
I changed my |
Summary
AuthenticationFailureBadCredentialsEvent
gets published twice with due the fix of #6009, WebSecurityConfigurerAdapter.java:203.Actual Behavior
If you create a
ApplicationListener<AuthenticationFailureBadCredentialsEvent>
and listen toAuthenticationFailureBadCredentialsEvent
, you get notified twice when the users provides wrong credentials.Expected Behavior
Same as
AuthenticationSuccessEvent
, theAuthenticationFailureBadCredentialsEvent
should get published only once.Configuration
Can be reproduced if you use spring-boot-samples/spring-boot-sample-web-secure-custom and add an
ApplicationListener<AuthenticationFailureBadCredentialsEvent>
.Version
Spring Security 5.1.2.RELEASE
Sample
Take spring-boot-samples/spring-boot-sample-web-secure-custom and add an
ApplicationListener<AuthenticationFailureBadCredentialsEvent>
.spring-boot-sample-web-secure-custom.zip
The text was updated successfully, but these errors were encountered: