@Target(value={PARAMETER,ANNOTATION_TYPE})
@Retention(value=RUNTIME)
@Documented
public @interface CurrentSecurityContext
SecurityContext as a method argument.See: CurrentSecurityContextArgumentResolver For Servlet
See: CurrentSecurityContextArgumentResolver For WebFlux
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
errorOnInvalidType
True if a
ClassCastException should be thrown when the current
SecurityContext is the incorrect
type. |
java.lang.String |
expression
If specified, will use the provided SpEL expression to resolve the security
context.
|
public abstract boolean errorOnInvalidType
ClassCastException should be thrown when the current
SecurityContext is the incorrect
type. Default is false.public abstract java.lang.String expression
Authentication
implementation, then it could specify the appropriate SpEL like so:
@CurrentSecurityContext(expression = "authentication") CustomAuthentication authentication