Fix WebAuthn to publish authentication events gh-18113#18938
Open
suuuuuuminnnnnn wants to merge 2 commits intospring-projects:mainfrom
Open
Fix WebAuthn to publish authentication events gh-18113#18938suuuuuuminnnnnn wants to merge 2 commits intospring-projects:mainfrom
suuuuuuminnnnnn wants to merge 2 commits intospring-projects:mainfrom
Conversation
0d02a30 to
9af4217
Compare
Signed-off-by: suuuuuuminnnnnn <sumin45402214@gmail.com>
jzheaux
reviewed
Mar 31, 2026
Contributor
jzheaux
left a comment
There was a problem hiding this comment.
Thanks, @suuuuuuminnnnnn! I've left some feedback inline.
| ProviderManager providerManager = new ProviderManager( | ||
| new WebAuthnAuthenticationProvider(rpOperations, userDetailsService)); | ||
| getBeanOrNull(AuthenticationEventPublisher.class).ifPresent(providerManager::setAuthenticationEventPublisher); | ||
| providerManager = postProcess(providerManager); |
Contributor
There was a problem hiding this comment.
While post-processing the provider manager is certainly useful, is it possible to leave this out of this commit? In this way, one can look at the commit and see what was needed to add events.
Author
There was a problem hiding this comment.
sure — i can drop the postProcess(providerManager) from this change to keep the fix focused on wiring the AuthenticationEventPublisher. if you think post-processing is still desirable here, i can follow up with a separate pr.
Author
There was a problem hiding this comment.
updated in the latest commit — postProcess(providerManager) removed.
Signed-off-by: suuuuuuminnnnnn <sumin45402214@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes gh-18113
WebAuthnConfigurer creates a ProviderManager directly via new ProviderManager(...),
bypassing the AuthenticationManagerBuilder pipeline that normally injects the
AuthenticationEventPublisher. As a result, WebAuthn authentication always uses
ProviderManager's default NullEventPublisher, silently ignoring any
AuthenticationEventPublisher bean registered by the user.
This commit wires the AuthenticationEventPublisher bean into the ProviderManager
using the existing getBeanOrNull() helper, matching the behavior of other
authentication mechanisms such as form login. If no bean is present, the existing
NullEventPublisher fallback is preserved.