You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
currently the plugin doesn't support https (or at least to skip self signed
certificate).
Would be great to add it.
What I did to support it:
1) add in Confluence:
if (endpoint.startsWith("https")) {
try {
YesConfiguration.configureJVm();
}
catch (final Exception e) {
throw new IllegalStateException(e);
}
}
2) YesConfiguration is:
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class YesConfiguration {
public static SSLSocketFactory newInstance() throws Exception {
final SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, new TrustManager[] { new YesTrustManager() }, null);
return ctx.getSocketFactory();
}
public static void configureJVm() throws Exception {
HttpsURLConnection.setDefaultSSLSocketFactory(newInstance());
HttpsURLConnection.setDefaultHostnameVerifier(new YesHostnameVerifier());
}
public static class YesHostnameVerifier implements HostnameVerifier {
@Override
public boolean verify(final String s, final SSLSession sslSession) {
return true;
}
}
public static class YesTrustManager implements X509TrustManager {
@Override
public void checkClientTrusted(final X509Certificate[] x509Certificates, final String s) throws CertificateException {
// no-op
}
@Override
public void checkServerTrusted(final X509Certificate[] x509Certificates, final String s) throws CertificateException {
// no-op
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
}
Side note : a more advanced version could support HostnameVerifier and
X509TrustManager qualified names
Original issue reported on code.google.com by rmannibucau@gmail.com on 7 Jul 2014 at 4:02
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
rmannibucau@gmail.com
on 7 Jul 2014 at 4:02The text was updated successfully, but these errors were encountered: