XML RPC Service over SSL with Basic Authentication from Spring Application?

So, there is a stacktrace like this: Caused by: javax.net.ssl. SSLHandshakeException: java.security.cert. CertificateException: No subject alternative DNS name matching example.Com found.

At com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Alerts. GetSSLException(Alerts. Java:174) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl.

Fatal(SSLSocketImpl. Java:1623) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker. FatalSE(Handshaker.

Java:198) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker. FatalSE(Handshaker. Java:192) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.

ClientHandshaker. ServerCertificate(ClientHandshaker. Java:1074) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.

ClientHandshaker. ProcessMessage(ClientHandshaker. Java:128) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker.

ProcessLoop(Handshaker. Java:529) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker. Process_record(Handshaker.

Java:465) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl. ReadRecord(SSLSocketImpl. Java:884) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl.

PerformInitialHandshake(SSLSocketImpl. Java:1120) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl. StartHandshake(SSLSocketImpl.

Java:1147) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl. StartHandshake(SSLSocketImpl. Java:1131) at example.Com.

Www.protocol.https.HttpsClient. AfterConnect(HttpsClient. Java:434) at example.Com.

Www.protocol.https. AbstractDelegateHttpsURLConnection. Connect(AbstractDelegateHttpsURLConnection.

Java:166) at example.Com.Www.protocol.http. HttpURLConnection. GetOutputStream(HttpURLConnection.

Java:904) at example.Com. Www.protocol.https. HttpsURLConnectionImpl.

GetOutputStream(HttpsURLConnectionImpl. Java:230) at com.caucho.burlap.client.BurlapProxy. Invoke(BurlapProxy.

Java:139) ... 24 more Caused by: java.security.cert. CertificateException: No subject alternative DNS name matching example.Com found. At sun.security.util.HostnameChecker.

MatchDNS(HostnameChecker. Java:193) at sun.security.util.HostnameChecker. Match(HostnameChecker.

Java:77) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl. X509TrustManagerImpl. CheckIdentity(X509TrustManagerImpl.

Java:264) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl. X509TrustManagerImpl. CheckServerTrusted(X509TrustManagerImpl.

Java:250) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl. ClientHandshaker. ServerCertificate(ClientHandshaker.

Java:1053) ... 36 more It's an usual exception from HttpURLConnection when the SSL certificate doesn't match to the domain I've not created the whole Spring environment but the following test works for me: Test public void test7() throws Exception { final BurlapProxyFactory factory = new NoSslCertificateCheckBurlapProxyFactory(); final String url = "https://example.Com/service"; final Service service = (Service) factory. Create(Service. Class, url); service.

GetColour("5"); } NoSslCertificateCheckBurlapProxyFactory. Java : import example. Com0.

IOException; import example. Com1. URL; import example.

Com1. URLConnection; import javax.net.ssl. HostnameVerifier; import javax.net.ssl.

HttpsURLConnection; import com.caucho.burlap.client. BurlapProxyFactory; public class NoSslCertificateCheckBurlapProxyFactory extends BurlapProxyFactory { private final HostnameVerifier hostnameVerifier; public NoSslCertificateCheckBurlapProxyFactory() { hostnameVerifier = new NoCheckHostnameVerifier(); } @Override protected URLConnection openConnection(final URL url) throws IOException { final URLConnection connection = super. OpenConnection(url); if (connection instanceof HttpsURLConnection) { final HttpsURLConnection httpsURLConnection = (HttpsURLConnection) connection; httpsURLConnection.

SetHostnameVerifier(hostnameVerifier); } return connection; } } NoCheckHostnameVerifier. Java : import javax.net.ssl. HostnameVerifier; import javax.net.ssl.

SSLSession; public class NoCheckHostnameVerifier implements HostnameVerifier { @Override public boolean verify(final String hostname, final SSLSession session) { return true; } } So, if I'm right you just need to change the bean class from bean id="colourService" class="org.springframework.remoting.caucho. BurlapProxyFactoryBean to bean id="colourService" class="your.package. NoSslCertificateCheckBurlapProxyFactory Configuring basic authentication should be the following (I haven't tested): property name="username" value="user1".

So, there is a stacktrace like this: Caused by: javax.net.ssl. SSLHandshakeException: java.security.cert. CertificateException: No subject alternative DNS name matching example.Com found.

At com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Alerts. GetSSLException(Alerts. Java:174) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl.

Fatal(SSLSocketImpl. Java:1623) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker. FatalSE(Handshaker.

Java:198) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker. FatalSE(Handshaker. Java:192) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.

ClientHandshaker. ServerCertificate(ClientHandshaker. Java:1074) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.

ClientHandshaker. ProcessMessage(ClientHandshaker. Java:128) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker.

ProcessLoop(Handshaker. Java:529) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.Handshaker. Process_record(Handshaker.

Java:465) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl. ReadRecord(SSLSocketImpl. Java:884) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl.

PerformInitialHandshake(SSLSocketImpl. Java:1120) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl. StartHandshake(SSLSocketImpl.

Java:1147) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl.SSLSocketImpl. StartHandshake(SSLSocketImpl. Java:1131) at example.Com.

Www.protocol.https.HttpsClient. AfterConnect(HttpsClient. Java:434) at example.Com.

Www.protocol.https. AbstractDelegateHttpsURLConnection. Connect(AbstractDelegateHttpsURLConnection.

Java:166) at example.Com.Www.protocol.http. HttpURLConnection. GetOutputStream(HttpURLConnection.

Java:904) at example.Com. Www.protocol.https. HttpsURLConnectionImpl.

GetOutputStream(HttpsURLConnectionImpl. Java:230) at com.caucho.burlap.client.BurlapProxy. Invoke(BurlapProxy.

Java:139) ... 24 more Caused by: java.security.cert. CertificateException: No subject alternative DNS name matching example.Com found. At sun.security.util.HostnameChecker.

MatchDNS(HostnameChecker. Java:193) at sun.security.util.HostnameChecker. Match(HostnameChecker.

Java:77) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl. X509TrustManagerImpl. CheckIdentity(X509TrustManagerImpl.

Java:264) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl. X509TrustManagerImpl. CheckServerTrusted(X509TrustManagerImpl.

Java:250) at com.sun.net.ssl" rel="nofollow">com.sun.net.ssl.internal.ssl. ClientHandshaker. ServerCertificate(ClientHandshaker.

Java:1053) ... 36 more It's an usual exception from HttpURLConnection when the SSL certificate doesn't match to the domain. I've not created the whole Spring environment but the following test works for me: @Test public void test7() throws Exception { final BurlapProxyFactory factory = new NoSslCertificateCheckBurlapProxyFactory(); final String url = "https://example. Com/service"; final Service service = (Service) factory.

Create(Service. Class, url); service. GetColour("5"); } NoSslCertificateCheckBurlapProxyFactory.

Java: import javax.net. IOException; import example. Com0.

URL; import example. Com0. URLConnection; import javax.net.ssl.

HostnameVerifier; import javax.net.ssl. HttpsURLConnection; import com.caucho.burlap.client. BurlapProxyFactory; public class NoSslCertificateCheckBurlapProxyFactory extends BurlapProxyFactory { private final HostnameVerifier hostnameVerifier; public NoSslCertificateCheckBurlapProxyFactory() { hostnameVerifier = new NoCheckHostnameVerifier(); } @Override protected URLConnection openConnection(final URL url) throws IOException { final URLConnection connection = super.

OpenConnection(url); if (connection instanceof HttpsURLConnection) { final HttpsURLConnection httpsURLConnection = (HttpsURLConnection) connection; httpsURLConnection. SetHostnameVerifier(hostnameVerifier); } return connection; } } NoCheckHostnameVerifier. Java: import javax.net.ssl.

HostnameVerifier; import javax.net.ssl. SSLSession; public class NoCheckHostnameVerifier implements HostnameVerifier { @Override public boolean verify(final String hostname, final SSLSession session) { return true; } } So, if I'm right you just need to change the bean class from to Configuring basic authentication should be the following (I haven't tested): References: Java SSL No Subject Alternative Matched.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions