WebAuthnAuthenticationProvider does not pass UserDetails to WebAuthnAuthentication
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java
- Domain
- authentication, security
Research direction
Start at webauthn/src/main/java/org/springframework/security/web/webauthn/authentication/WebAuthnAuthenticationProvider.java around line 77 and trace the authentication flow described in the issue. Reproduce the WebAuthn login, inspect SecurityContext.getAuthentication().getPrincipal(), and consider the issue complete when it is the retrieved UserDetails instance rather than an ImmutablePublicKeyCredentialUserEntity.
Written by the indexing model from the issue text.
Description
Describe the bug
WebAuthnAuthenticationProvider creates a WebAuthnAuthentication with a principal of type PublicKeyCredentialUserEntity instead of UserDetails.
To Reproduce
- authenticate via webauthn
- check
SecurityContext.getAuthentication().getPrincipal()- it is anImmutablePublicKeyCredentialUserEntity
Expected behavior
The retrieved UserDetails instance should be used as principal of the created WebAuthnAuthentication (WebAuthnAuthenticationProvider javadoc looks correct).
Sample
sample app will be referenced asap:
- run
- http://localhost:8080/login - user / password
- http://localhost:8080/webauthn/register - register a passkey
- http://localhost:8080/logout
- http://localhost:8080/login - use passkey
- check debug console log
2025-10-27T15:19:44.309+01:00 DEBUG 40608 --- [demo] [nio-8080-exec-2] o.s.s.w.w.a.WebAuthnAuthenticationFilter : Set SecurityContextHolder to WebAuthnAuthentication [Principal=org.springframework.security.web.webauthn.api.ImmutablePublicKeyCredentialUserEntity@205490ff, Credentials=[PROTECTED], Authenticated=true, Details=null, Granted Authorities=[ROLE_USER, FactorGrantedAuthority [authority=FACTOR_WEBAUTHN, issuedAt=2025-10-27T14:19:42.009552700Z]]]
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spring-projects/spring-security
-
status: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
spring-projects/spring-security#19733 ·
-
status: waiting-for-triage type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spring-projects/spring-security#19730 ·
-
status: waiting-for-triage type: bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
spring-projects/spring-security#19728 ·
-
status: waiting-for-triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
spring-projects/spring-security#19725 ·
-
in: build type: task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spring-projects/spring-security#19717 ·
All issues in spring-projects/spring-security
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100