diff --git a/services/src/main/java/org/keycloak/services/x509/NginxProxySslClientCertificateLookup.java b/services/src/main/java/org/keycloak/services/x509/NginxProxySslClientCertificateLookup.java index a27796f754..7448f7c7fe 100644 --- a/services/src/main/java/org/keycloak/services/x509/NginxProxySslClientCertificateLookup.java +++ b/services/src/main/java/org/keycloak/services/x509/NginxProxySslClientCertificateLookup.java @@ -123,10 +123,10 @@ public class NginxProxySslClientCertificateLookup extends AbstractClientCertific // Get the client certificate X509Certificate clientCert = getCertificateFromHttpHeader(httpRequest, sslClientCertHttpHeader); - log.debugf("End user certificate found : Subject DN=[%s] SerialNumber=[%s]", clientCert.getSubjectDN().toString(), clientCert.getSerialNumber().toString() ); - + if (clientCert != null) { - + log.debugf("End user certificate found : Subject DN=[%s] SerialNumber=[%s]", clientCert.getSubjectDN(), clientCert.getSerialNumber()); + // Rebuilding the end user certificate chain using Keycloak Truststore X509Certificate[] certChain = buildChain(clientCert); if ( certChain == null || certChain.length == 0 ) {