-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Issue when using @AuthenticationPrincipal on interfaces #16177
Milestone
Comments
K-e-l-v-i-n-12
added
status: waiting-for-triage
An issue we've not yet triaged
type: bug
A general bug
labels
Nov 26, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 2, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 2, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 5, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 5, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 5, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 6, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 6, 2024
jzheaux
added a commit
that referenced
this issue
Dec 6, 2024
Confirm that responses are a valid JSON map Issue gh-16177
jzheaux
added
in: web
An issue in web modules (web, webmvc)
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Dec 6, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 7, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 7, 2024
jzheaux
pushed a commit
to kse-music/spring-security
that referenced
this issue
Dec 9, 2024
jzheaux
added a commit
to kse-music/spring-security
that referenced
this issue
Dec 10, 2024
jzheaux
pushed a commit
that referenced
this issue
Dec 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the current version of Spring Security (version 6.4), a changed behavior occurs when using the
@AuthenticationPrincipal
annotation on an interface. If the annotation is applied directly to the concrete implementation, everything works as expected and theUserDetails
object is passed correctly. However, if the annotation is applied to an interface, the implementation receives a new or empty UserDetails object.Reproduction of the problem:
The problem can be reproduced with the example project: K-e-l-v-i-n-12/spring-security
Steps to reproduce:
http://localhost:8080/userByInterface
(any username/password). The response is: Hello, null.http://localhost:8080/userByImplementation
(any username/password). The response is: Hello, test.Actual behaviour:
If
@AuthenticationPrincipal
is applied to an interface, the implementation receives an empty UserDetails object.Expected behaviour:
The UserDetails object should be passed correctly even when an interface is used.
Proposed solution:
Extend support for @AuthenticationPrincipal to interfaces.
The text was updated successfully, but these errors were encountered: