code/app/be/objectify/deadbolt/java/filters/DeadboltRoutePathFilter.java
@Override
    public CompletionStage<Result> apply(final Function<Http.RequestHeader, CompletionStage<Result>> next,
                                         final Http.RequestHeader requestHeader)
    {
        final Optional<AuthorizedRoute> maybeAuthRoute = authorizedRoutes.apply(requestHeader.method(),
                                                                                requestHeader.attrs().get(Router.Attrs.HANDLER_DEF).path());
        return maybeAuthRoute.map(authRoute -> authRoute.constraint().apply(requestHeader,
                                                                            authRoute.handler().orElse(handler),
                                                                            next)
        ).orElseGet(() -> next.apply(requestHeader));
    }
@Override
    public CompletionStage<Result> apply(final Function<Http.RequestHeader, CompletionStage<Result>> next,
                                         final Http.RequestHeader requestHeader)
    {
        final Optional<AuthorizedRoute> maybeAuthRoute = authorizedRoutes.apply(requestHeader.method(),
                                                                                requestHeader.attrs().get(Router.Attrs.HANDLER_DEF).path());
        return maybeAuthRoute.map(authRoute -> authRoute.constraint().apply(requestHeader,
                                                                            authRoute.handler().orElse(handler),
                                                                            next)
        ).orElseGet(() -> next.apply(requestHeader));
    }
If a constraint is defined for a given route, test that constraint before allowing the request to proceed.

@param next          the next step in the filter chain
@param requestHeader the request header
@return a future for the result