Class EndpointAccessContext
- java.lang.Object
-
- de.codecamp.vaadin.security.spring.access.endpoint.EndpointAccessContext
-
- All Implemented Interfaces:
AccessContext
public class EndpointAccessContext extends Object implements AccessContext
AnAccessContextencapsulating an access attempt to an endpoint.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.codecamp.vaadin.security.spring.access.AccessContext
AccessContext.TargetType
-
-
Constructor Summary
Constructors Constructor Description EndpointAccessContext(Method endpointMethod, javax.servlet.http.HttpServletRequest request)Creates a newEndpointAccessContext.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <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.static <A extends Annotation>
Optional<A>findAnnotation(Method endpointMethod, Class<A> annotationType)Tries to find the first matching annotation of the given type on the endpoint method.MethodgetEndpointMethod()javax.servlet.http.HttpServletRequestgetRequest()AccessContext.TargetTypegetTargetType()The type of the target for which to check access; either a route or and endpoint.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.codecamp.vaadin.security.spring.access.AccessContext
asEndpointAccessContext, asRouteAccessContext, isEndpoint, isRoute
-
-
-
-
Constructor Detail
-
EndpointAccessContext
public EndpointAccessContext(Method endpointMethod, javax.servlet.http.HttpServletRequest request)
Creates a newEndpointAccessContext.- Parameters:
endpointMethod- the endpoint method to be checked for accessrequest- the HTTP request trying to access the endpoint
-
-
Method Detail
-
getTargetType
public AccessContext.TargetType getTargetType()
Description copied from interface:AccessContextThe type of the target for which to check access; either a route or and endpoint.- Specified by:
getTargetTypein interfaceAccessContext- Returns:
- type of the target for which to check access
-
getEndpointMethod
public Method getEndpointMethod()
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()
-
findAnnotation
public <A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType)
Description copied from interface:AccessContextA 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.- Specified by:
findAnnotationin interfaceAccessContext- Type Parameters:
A- the annotation type- Parameters:
annotationType- the annotation type- Returns:
- the first matching annotation
-
findAnnotation
public static <A extends Annotation> Optional<A> findAnnotation(Method endpointMethod, Class<A> annotationType)
Tries to find the first matching annotation of the given type on the endpoint method. If none is found, the endpoint class is examined. This method also examines superclasses and interfaces and supports meta-annotations.- Type Parameters:
A- the annotation type- Parameters:
endpointMethod- the endpoint methodannotationType- the annotation type being looked for- Returns:
- the first matching annotation
-
-