public static Single<Boolean> validate(UnitRequest request) {
        LOG.debug("ValidateAccessToken");
        if (!isSecure(request.getContext().getUri())) {
            //No secure requirement, then we do not check the access token.
            return Single.just(true);
        }
        return fetchAccessTokenAndReturnScope(request)
                .map(optionalScope ->
                        optionalScope.isPresent() && Scope.validate(optionalScope.get(), request.getContext().getGroup(), request.getContext().getUnit())
                );

    }
public static Single < Boolean > validate ( UnitRequest request ) { LOG . debug ( "ValidateAccessToken" ) ; if ( ! isSecure ( request . getContext ( ) . getUri ( ) ) ) { return Single . just ( true ) ; } return fetchAccessTokenAndReturnScope ( request ) . map ( optionalScope -> optionalScope . isPresent ( ) && Scope . validate ( optionalScope . get ( ) , request . getContext ( ) . getGroup ( ) , request . getContext ( ) . getUnit ( ) ) ) ; }
@param request the unit request
@return true if validation passed false otherwise.