@Override
    public CompletionStage<Boolean> authorize(ServiceRequestContext ctx, HttpRequest data) {
        final String cookie = data.headers().get(HttpHeaderNames.COOKIE);
        if (cookie == null) {
            return UnmodifiableFuture.completedFuture(false);
        }

        final boolean authenticated = Cookie.fromCookieHeader(cookie).stream().anyMatch(
                c -> "username".equals(c.name()) && !Strings.isNullOrEmpty(c.value()));
        return UnmodifiableFuture.completedFuture(authenticated);
    }
Checks whether the request has right permission to access the service. In this example, a {@code Cookie}
header is used to hold the information. If a {@code username} key exists in the {@code Cookie} header,
the request is treated as authenticated.
examples/saml-service-provider/src/main/java/example/armeria/server/saml/sp/MyAuthHandler.java