public void establishTrust(String conduitName, URLConnectionInfo connectionInfo, Message message) throws UntrustedURLConnectionIOException { if (orig != null) { orig.establishTrust(conduitName, connectionInfo, message); } HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo; if (info.getServerCertificates() == null || info.getServerCertificates().length == 0) { throw new UntrustedURLConnectionIOException( "No server certificates were found" ); } X509Certificate[] certs = (X509Certificate[])info.getServerCertificates(); if (!certConstraints.matches(certs[0])) { throw new UntrustedURLConnectionIOException( "The server certificate(s) do not match the defined cert constraints" ); } } }
public void establishTrust(String conduitName, URLConnectionInfo connectionInfo, Message message) throws UntrustedURLConnectionIOException { if (orig != null) { orig.establishTrust(conduitName, connectionInfo, message); } HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo; if (info.getServerCertificates() == null || info.getServerCertificates().length == 0) { throw new UntrustedURLConnectionIOException( "No server certificates were found" ); } X509Certificate[] certs = (X509Certificate[])info.getServerCertificates(); if (!certConstraints.matches(certs[0])) { throw new UntrustedURLConnectionIOException( "The server certificate(s) do not match the defined cert constraints" ); } } }
public void establishTrust(String conduitName, URLConnectionInfo connectionInfo, Message message) throws UntrustedURLConnectionIOException { if (orig != null) { orig.establishTrust(conduitName, connectionInfo, message); } HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo; if (info.getServerCertificates() == null || info.getServerCertificates().length == 0) { throw new UntrustedURLConnectionIOException( "No server certificates were found" ); } else { X509Certificate[] certs = (X509Certificate[])info.getServerCertificates(); if (!certConstraints.matches(certs[0])) { throw new UntrustedURLConnectionIOException( "The server certificate(s) do not match the defined cert constraints" ); } } } }