Interface AccessContext
-
- All Known Implementing Classes:
EndpointAccessContext,RouteAccessContext
public interface AccessContextThis class provides the context information toAccessEvaluators, either for a route or an entpoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAccessContext.TargetTypeThe currently supported types of targets for which access can be controlled.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default EndpointAccessContextasEndpointAccessContext()Casts this access context to aEndpointAccessContextwhich provides more information that is specific to this target type.default RouteAccessContextasRouteAccessContext()Casts this access context to aRouteAccessContextwhich provides more information that is specific to this target type.<A extends Annotation>
Optional<A>findAnnotation(Class<A> annotationType)A convenience method that allows to find the first matching annotation of a certain type, looking in locations and in an order that makes the most sense for the target type of this access context.AccessContext.TargetTypegetTargetType()The type of the target for which to check access; either a route or and endpoint.default booleanisEndpoint()Returns whether this is an endpoint access context, i.e.default booleanisRoute()Returns whether this is a route access context, i.e.
-
-
-
Method Detail
-
getTargetType
AccessContext.TargetType getTargetType()
The type of the target for which to check access; either a route or and endpoint.- Returns:
- type of the target for which to check access
-
findAnnotation
<A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType)
A convenience method that allows to find the first matching annotation of a certain type, looking in locations and in an order that makes the most sense for the target type of this access context. This method does support meta-annotations.- Type Parameters:
A- the annotation type- Parameters:
annotationType- the annotation type- Returns:
- the first matching annotation
-
isRoute
default boolean isRoute()
Returns whether this is a route access context, i.e. whetherasRouteAccessContext()can be safely called.- Returns:
- whether this is a route access context
-
asRouteAccessContext
default RouteAccessContext asRouteAccessContext()
Casts this access context to aRouteAccessContextwhich provides more information that is specific to this target type. Check thetypebefore calling this method to see if this is possible.- Returns:
- this access context as a
RouteAccessContext
-
isEndpoint
default boolean isEndpoint()
Returns whether this is an endpoint access context, i.e. whetherasEndpointAccessContext()can be safely called.- Returns:
- whether this is an endpoint access context
-
asEndpointAccessContext
default EndpointAccessContext asEndpointAccessContext()
Casts this access context to aEndpointAccessContextwhich provides more information that is specific to this target type. Check thetypebefore calling this method to see if this is possible.- Returns:
- this access context as a
EndpointAccessContext
-
-