mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-02 08:42:35 +00:00
CurrentSecurityContext JavaDoc
Fixes gh-7489
This commit is contained in:
parent
350bce761f
commit
1630b3b1f3
@ -22,7 +22,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation that is used to resolve {@link SecurityContext#getAuthentication()} to a method
|
* Annotation that is used to resolve the {@link org.springframework.security.core.context.SecurityContext} as a method
|
||||||
* argument.
|
* argument.
|
||||||
*
|
*
|
||||||
* @author Dan Zheng
|
* @author Dan Zheng
|
||||||
@ -46,29 +46,24 @@ import java.lang.annotation.Target;
|
|||||||
public @interface CurrentSecurityContext {
|
public @interface CurrentSecurityContext {
|
||||||
/**
|
/**
|
||||||
* True if a {@link ClassCastException} should be thrown when the current
|
* True if a {@link ClassCastException} should be thrown when the current
|
||||||
* {@link SecurityContext} is the incorrect type. Default is false.
|
* {@link org.springframework.security.core.context.SecurityContext} is the incorrect type. Default is false.
|
||||||
*
|
*
|
||||||
* @return
|
* @return whether or not to error on an invalid type
|
||||||
*/
|
*/
|
||||||
boolean errorOnInvalidType() default false;
|
boolean errorOnInvalidType() default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified will use the provided SpEL expression to resolve the security context. This
|
* If specified, will use the provided SpEL expression to resolve the security context. This
|
||||||
* is convenient if users need to transform the result.
|
* is convenient if applications need to transform the result.
|
||||||
|
*
|
||||||
|
* For example, if an application needs to extract its custom {@code Authentication} implementation,
|
||||||
|
* then it could specify the appropriate SpEL like so:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* @CurrentSecurityContext(expression = "authentication") Authentication authentication
|
* @CurrentSecurityContext(expression = "authentication") CustomAuthentication authentication
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>
|
* @return the expression to use
|
||||||
* if you want to retrieve more object from the authentcation, you can see the following the expression
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* @CurrentSecurityContext(expression = "authentication.principal") Object principal
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @return the expression to use.
|
|
||||||
*/
|
*/
|
||||||
String expression() default "";
|
String expression() default "";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user