public java.security.cert.X509Certificate[] | getSSLClientCertificateChain(javax.servlet.http.HttpServletRequest request)Gets the SSL client certificate chain with which the client
had authenticated itself to the SSL offloader, and which the
SSL offloader has added as a custom request header on the
given request.
X509Certificate[] certs = null;
String clientCert = request.getHeader("Proxy-auth-cert");
if (clientCert != null) {
clientCert = clientCert.replaceAll("% d% a", "\n");
clientCert = "-----BEGIN CERTIFICATE-----\n" + clientCert
+ "\n-----END CERTIFICATE-----";
byte[] certBytes = new byte[clientCert.length()];
clientCert.getBytes(0, clientCert.length(), certBytes, 0);
ByteArrayInputStream bais = new ByteArrayInputStream(certBytes);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
certs = new X509Certificate[1];
certs[0] = (X509Certificate) cf.generateCertificate(bais);
}
return certs;
|