-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add @AuthenticationPrincipal/@CurrentSecurityContext Interface Support for Expression Templates #16201
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @kse-music! I've left some feedback inline.
In addition, let's please change the argument resolvers to fall back to MethodParameter#findParameterAnnotation
(the previous behavior) if they haven't supplied an AnnotationTemplateExpressionDefaults
.
The reason for this is historically the argument resolvers have simply picked the first annotation they find instead of enforcing Security's no-duplicate policy and we don't want to change that expectation in a minor release.
.../main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java
Outdated
Show resolved
Hide resolved
195eba4
to
760ec9c
Compare
@jzheaux All feedback is done.But if fall back to For example #15286.
Unless support meta-annotations also need to provide an |
That's correct. Please see this section of the reference for more details. |
Thanks, @jzheaux . Now all checks have now passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @kse-music, great job. I've left some feedback inline.
.../main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java
Outdated
Show resolved
Hide resolved
...ngframework/security/web/method/annotation/AuthenticationPrincipalArgumentResolverTests.java
Outdated
Show resolved
Hide resolved
.../springframework/security/web/method/annotation/AuthenticationPrincipalArgumentResolver.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java
Outdated
Show resolved
Hide resolved
@kse-music, one more thing. I'm not comfortable releasing this big of a change on a maintenance release. So let's split this PR into two: One for the additional support in |
4bab2ed
to
5ad3baf
Compare
3a20373
to
1f052b9
Compare
I've opened #16248. Would you please change the commit message to point to that ticket instead? |
01f378c
to
d856fb1
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kse-music, thanks for your patience while I got back to this. After some testing, I have some additional feedback; are you able to address it?
.../java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScannerTests.java
Show resolved
Hide resolved
@jzheaux All feedback is done. |
Lovely, @kse-music. All merged and thank you again. |
Closes gh-16248