public class PrincipalMethodArgumentResolver extends Object implements HandlerMethodArgumentResolver
Principal from Spring Security context via
SecurityContext.getAuthentication().
The resolver checks both ThreadLocal context via SecurityContextHolder
for Spring MVC applications, and ReactiveSecurityContextHolder for
Spring WebFlux applications. It returns .
| Constructor and Description |
|---|
PrincipalMethodArgumentResolver() |
| Modifier and Type | Method and Description |
|---|---|
Object |
resolveArgument(MethodParameter parameter,
DataFetchingEnvironment environment)
Resolve a method parameter to a value.
|
boolean |
supportsParameter(MethodParameter parameter)
Return "true" if the argument is
Principal or a sub-type. |
public boolean supportsParameter(MethodParameter parameter)
Principal or a sub-type.supportsParameter in interface HandlerMethodArgumentResolverpublic Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment)
HandlerMethodArgumentResolverresolveArgument in interface HandlerMethodArgumentResolverparameter - the method parameter to resolve. This parameter must
have previously checked via HandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter).environment - the environment to use to resolve the valuenull if not resolved;
the value may also be a Mono if it
requires asynchronous resolution.