-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Closed
Copy link
Labels
in: webAn issue in web modules (web, webmvc)An issue in web modules (web, webmvc)type: enhancementA general enhancementA general enhancement
Description
To get the current security context in a Spring MVC handler method, one needs to use the @CurrentSecurityContext
annotation like so:
@GetMapping
public String method(@CurrentSecurityContext SecurityContext context) { ... {
This is particularly useful when using the expression feature like the following:
@GetMapping
public String method(@CurrentSecurityContext(expression="authentication.name") String name) { ... {
But when I just need the SecurityContext
, it's unnecessary boilerplate. It would be nice if the argument resolver also matched directly on the SecurityContext
type so that one could do:
@GetMapping
public String method(SecurityContext context) { ... {
This change would need to be made in both the servlet and reactive argument resolvers.
Metadata
Metadata
Assignees
Labels
in: webAn issue in web modules (web, webmvc)An issue in web modules (web, webmvc)type: enhancementA general enhancementA general enhancement