ASF Bugzilla – Attachment 26581 Details for
Bug 48208
allow to configure a custom client certificate Trust Manager in server.xml per connector attribute "trustManagerClassName"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
patch for tomcat 6 svn revision 1065625
patch.txt (text/plain), 2.63 KB, created by
Luciana Moreira
on 2011-01-31 11:23:10 UTC
(
hide
)
Description:
patch for tomcat 6 svn revision 1065625
Filename:
MIME Type:
Creator:
Luciana Moreira
Created:
2011-01-31 11:23:10 UTC
Size:
2.63 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P tomcat6 >Index: java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java >=================================================================== >--- java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java (revision 1065625) >+++ java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java (working copy) >@@ -27,6 +27,7 @@ > import java.net.Socket; > import java.net.SocketException; > import java.security.KeyStore; >+import java.security.NoSuchAlgorithmException; > import java.security.SecureRandom; > import java.security.cert.CRL; > import java.security.cert.CRLException; >@@ -551,13 +552,13 @@ > if (crlf == null) { > TrustManagerFactory tmf = TrustManagerFactory.getInstance(algorithm); > tmf.init(trustStore); >- tms = tmf.getTrustManagers(); >+ tms = getTrustManagers(tmf); > } else { > TrustManagerFactory tmf = TrustManagerFactory.getInstance(algorithm); > CertPathParameters params = getParameters(algorithm, crlf, trustStore); > ManagerFactoryParameters mfp = new CertPathTrustManagerParameters(params); > tmf.init(mfp); >- tms = tmf.getTrustManagers(); >+ tms = getTrustManagers(tmf); > } > } > >@@ -565,6 +566,30 @@ > } > > /** >+ * Gets the TrustManagers >+ * @return >+ * @throws NoSuchAlgorithmException >+ * @throws ClassNotFoundException >+ * @throws IllegalAccessException >+ * @throws InstantiationException >+ */ >+ private TrustManager[] getTrustManagers(TrustManagerFactory tmf) throws NoSuchAlgorithmException, ClassNotFoundException, InstantiationException, IllegalAccessException { >+ String trustManagerName = (String) attributes.get("trustManageClassName"); >+ if(trustManagerName != null && !"".equals(trustManagerName)) { >+ ClassLoader classLoader = getClass().getClassLoader(); >+ Class<?> trustManagerClass = classLoader.loadClass(trustManagerName); >+ if(!(TrustManager.class.isAssignableFrom(trustManagerClass))){ >+ throw new InstantiationException( >+ "The attribute trustManagerClassName must point to a class that implements javax.net.ssl.TrustManager"); >+ } >+ Object trustManagerObject = trustManagerClass.newInstance(); >+ TrustManager trustManager = (TrustManager) trustManagerObject; >+ return new TrustManager[]{ trustManager }; >+ } >+ return tmf.getTrustManagers(); >+ } >+ >+ /** > * Return the initialization parameters for the TrustManager. > * Currently, only the default <code>PKIX</code> is supported. > * >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 48208
:
24546
|
26581
|
26732