code/app/be/objectify/deadbolt/java/filters/FilterConstraints.java
public FilterFunction subjectPresent(final Optional<String> content)
    {
        return (Http.RequestHeader requestHeader,
                DeadboltHandler handler,
                Function<Http.RequestHeader, CompletionStage<Result>> next) ->
                beforeAuthCheckCache.apply(handler, requestHeader, content)
                       .thenCompose(maybePreAuth -> maybePreAuth._1.map(preAuthResult -> (CompletionStage<Result>) CompletableFuture.completedFuture(preAuthResult))
                                                                .orElseGet(() -> constraintLogic.subjectPresent(maybePreAuth._2,
                                                                                                                handler,
                                                                                                                content,
                                                                                                                (rh, hdlr, cntent) -> next.apply(rh),
                                                                                                                (rh, hdlr, cntent) -> hdlr.onAuthFailure(rh,
                                                                                                                                                          cntent),
                                                                                                                ConstraintPoint.FILTER)));
    }
public FilterFunction subjectPresent(final Optional<String> content)
    {
        return (Http.RequestHeader requestHeader,
                DeadboltHandler handler,
                Function<Http.RequestHeader, CompletionStage<Result>> next) ->
                beforeAuthCheckCache.apply(handler, requestHeader, content)
                       .thenCompose(maybePreAuth -> maybePreAuth._1.map(preAuthResult -> (CompletionStage<Result>) CompletableFuture.completedFuture(preAuthResult))
                                                                .orElseGet(() -> constraintLogic.subjectPresent(maybePreAuth._2,
                                                                                                                handler,
                                                                                                                content,
                                                                                                                (rh, hdlr, cntent) -> next.apply(rh),
                                                                                                                (rh, hdlr, cntent) -> hdlr.onAuthFailure(rh,
                                                                                                                                                          cntent),
                                                                                                                ConstraintPoint.FILTER)));
    }
public FilterFunction subjectPresent ( final Optional < String > content ) { return ( Http . RequestHeader requestHeader , DeadboltHandler handler , Function < Http . RequestHeader , CompletionStage < Result > > next ) -> beforeAuthCheckCache . apply ( handler , requestHeader , content ) . thenCompose ( maybePreAuth -> maybePreAuth . _1 . map ( preAuthResult -> ( CompletionStage < Result > ) CompletableFuture . completedFuture ( preAuthResult ) ) . orElseGet ( ( ) -> constraintLogic . subjectPresent ( maybePreAuth . _2 , handler , content , ( rh , hdlr , cntent ) -> next . apply ( rh ) , ( rh , hdlr , cntent ) -> hdlr . onAuthFailure ( rh , cntent ) , ConstraintPoint . FILTER ) ) ) ; }
A constraint that requires a subject to be present.

@param content is passed to {@link DeadboltHandler#onAuthFailure(Http.RequestHeader, Optional)} if the authorization fails
@return a function that wraps the constraint
@see ConstraintLogic#subjectPresent(Http.RequestHeader, DeadboltHandler, Optional, TriFunction, TriFunction, ConstraintPoint)
A constraint that requires a subject to be present .