Java Code Examples for io.undertow.security.api.SecurityContext#isAuthenticationRequired()

The following examples show how to use io.undertow.security.api.SecurityContext#isAuthenticationRequired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatawaveAuthenticationMechanism.java    From datawave with Apache License 2.0 6 votes vote down vote up
private Certificate[] getPeerCertificates(HttpServerExchange exchange, SSLSessionInfo sslSession, SecurityContext securityContext)
                throws SSLPeerUnverifiedException {
    try {
        return sslSession.getPeerCertificates();
    } catch (RenegotiationRequiredException e) {
        // we only renegotiate if authentication is required
        if (forceRenegotiation && securityContext.isAuthenticationRequired()) {
            try {
                sslSession.renegotiate(exchange, SslClientAuthMode.REQUESTED);
                return sslSession.getPeerCertificates();
            } catch (IOException | RenegotiationRequiredException e1) {
                // ignore
            }
        }
    }
    throw new SSLPeerUnverifiedException("");
}
 
Example 2
Source File: AuthenticationRequiredPredicate.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
@Override
public boolean resolve(HttpServerExchange value) {
    SecurityContext sc = value.getSecurityContext();
    if(sc == null) {
        return false;
    }
    return sc.isAuthenticationRequired();
}
 
Example 3
Source File: AuthenticationRequiredPredicate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean resolve(HttpServerExchange value) {
    SecurityContext sc = value.getSecurityContext();
    if(sc == null) {
        return false;
    }
    return sc.isAuthenticationRequired();
}