Interface RouteAccessControl

  • All Known Implementing Classes:
    AccessCombinerAllRequired, AccessCombinerAnyRequired
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface RouteAccessControl
    Controls access to a mounted route. Each request must first pass through the route's route access control and get a true response, otherwise the request is handled by the handleAccessDenied(RequestContext, HttpServletResponse) method.
    • Method Detail

      • canAccess

        boolean canAccess​(RequestContext context)
        Return true if access is granted.
      • handleAccessDenied

        default void handleAccessDenied​(RequestContext context,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws java.io.IOException
        What to do if the access is denied. Default implementation simply returns error code 403
        Throws:
        java.io.IOException
      • requireAny

        static RouteAccessControl requireAny​(RouteAccessControl... multiple)
        Static convenience combiner to require at least one of any number of different access controls