All Known Implementing Classes:
EndpointAccessContext, RouteAccessContext

public interface AccessContext
This class provides the context information to AccessEvaluators, either for a route or an entpoint.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The currently supported types of targets for which access can be controlled.
  • Method Summary

    Modifier and Type
    Method
    Description
    Casts this access context to a EndpointAccessContext which provides more information that is specific to this target type.
    Casts this access context to a RouteAccessContext which 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.
    The type of the target for which to check access; either a route or and endpoint.
    default boolean
    Returns whether this is an endpoint access context, i.e.
    default boolean
    Returns whether this is a route access context, i.e.
  • Method Details

    • 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. whether asRouteAccessContext() can be safely called.
      Returns:
      whether this is a route access context
    • asRouteAccessContext

      default RouteAccessContext asRouteAccessContext()
      Casts this access context to a RouteAccessContext which provides more information that is specific to this target type. Check the type before 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. whether asEndpointAccessContext() can be safely called.
      Returns:
      whether this is an endpoint access context
    • asEndpointAccessContext

      default EndpointAccessContext asEndpointAccessContext()
      Casts this access context to a EndpointAccessContext which provides more information that is specific to this target type. Check the type before calling this method to see if this is possible.
      Returns:
      this access context as a EndpointAccessContext