Introduce @CurrentSecurityContext for method arguments #6546
Labels
in: core
An issue in spring-security-core
in: web
An issue in web modules (web, webmvc)
type: enhancement
A general enhancement
Milestone
A user can easily obtain the current user principal using the
@AuthenticationPrincipal
annotation, say in a Spring MVC application:It would be nice to be able to do something more fundamental, like obtain the current security context:
and thus:
This ought to work for both Servlet and WebFlux applications, so we'd need to have two argument resolvers, one that retrieved the security context from
SecurityContextHolder
and another that got it fromReactiveSecurityContextHolder
. Likely, they could be modeled afterAuthenticationPrincipalArgumentResolver
.We'd also want to register these respectively in
WebMvcSecurityConfiguration
andServerHttpSecurityConfiguration
.The text was updated successfully, but these errors were encountered: