Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.undertow.predicate;
 
 
 import java.util.Map;
 import java.util.Set;

Predicate that returns true if authentication is required.

Author(s):
Stuart Douglas
public class AuthenticationRequiredPredicate implements Predicate {
    @Override
    public boolean resolve(HttpServerExchange value) {
        SecurityContext sc = value.getSecurityContext();
        if(sc == null) {
            return false;
        }
        return sc.isAuthenticationRequired();
    }
    public static class Builder implements PredicateBuilder {
        @Override
        public String name() {
            return "auth-required";
        }
        @Override
        public Map<StringClass<?>> parameters() {
            final Map<StringClass<?>> params = new HashMap<>();
            return params;
        }
        @Override
        public Set<StringrequiredParameters() {
            final Set<Stringparams = new HashSet<>();
            return params;
        }
        @Override
        public String defaultParameter() {
            return null;
        }
        @Override
        public Predicate build(final Map<StringObjectconfig) {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X