diff options
author | Christina Fu <cfu@redhat.com> | 2017-06-14 14:57:10 -0700 |
---|---|---|
committer | Christina Fu <cfu@redhat.com> | 2017-06-15 12:03:14 -0700 |
commit | 63c9582009b3858a6878863b9658d04c9aad45c1 (patch) | |
tree | 82210aa52c0e4ab00b8f9412767afeaf4010b6d8 /base/server/cms/src/com/netscape/cms/servlet/base | |
parent | 1f9db90b4f490f615a67a0f2d26b378345c6ab6a (diff) | |
download | pki-63c9582009b3858a6878863b9658d04c9aad45c1.tar.gz pki-63c9582009b3858a6878863b9658d04c9aad45c1.tar.xz pki-63c9582009b3858a6878863b9658d04c9aad45c1.zip |
Ticket#2737 CMC: check HTTPS client authentication cert against CMC signer
This patch adds enforcement in CMCUserSignedAuth to make sure SSL client authentication is performed and the authenticated cert matches that of the CMC signing cert.
Some auditing adjustments are also done.
Diffstat (limited to 'base/server/cms/src/com/netscape/cms/servlet/base')
-rw-r--r-- | base/server/cms/src/com/netscape/cms/servlet/base/CMSServlet.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/base/CMSServlet.java b/base/server/cms/src/com/netscape/cms/servlet/base/CMSServlet.java index 9dc74701a..65dc06aa3 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/base/CMSServlet.java +++ b/base/server/cms/src/com/netscape/cms/servlet/base/CMSServlet.java @@ -843,6 +843,10 @@ public abstract class CMSServlet extends HttpServlet { * get ssl client authenticated certificate */ protected X509Certificate getSSLClientCertificate(HttpServletRequest httpReq) throws EBaseException { + return getSSLClientCertificate(httpReq, true); + } + + protected X509Certificate getSSLClientCertificate(HttpServletRequest httpReq, boolean clientCertRequired) throws EBaseException { X509Certificate cert = null; @@ -855,7 +859,11 @@ public abstract class CMSServlet extends HttpServlet { X509Certificate[] allCerts = (X509Certificate[]) httpReq.getAttribute(CERT_ATTR); if (allCerts == null || allCerts.length == 0) { - throw new EBaseException("You did not provide a valid certificate for this operation"); + if (!clientCertRequired) { + return null; + } else { + throw new EBaseException("You did not provide a valid certificate for this operation"); + } } cert = allCerts[0]; |