You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sky <sk...@hotmail.com> on 2011/09/02 09:19:13 UTC

How to use solrJ: Self-signed cert SSL + basic auth.

I have solr 1.4.1 set up with following additions:
1. Basic authentication
2. SSL using self signed certificate

How do I use solrj to connect to this server?
Thanks!
- sky

RE: How to use solrJ: Self-signed cert SSL + basic auth.

Posted by Sky USC <sk...@hotmail.com>.
Think I got it.. it looks  something like following - however cant figure out where to get "EasySSLProtocolSocketFactory" from Maven from a known source: 

            URL
solrUrl = new URL(uri);

            if
(solrUrl.getProtocol().equals("https") && isSSLSelfSigned)

            {

                  ProtocolSocketFactory
socketFactory = new EasySSLProtocolSocketFactory();

                  Protocol
https = new Protocol("https", socketFactory, 443);

                  Protocol.registerProtocol("https", https);

            }

            server = new
CommonsHttpSolrServer(solrUrl);

            if (isBasicAuth)

            {

                 ((CommonsHttpSolrServer)
server).getHttpClient().getParams().setAuthenticationPreemptive(true);

                  Credentials
defaultcreds = new UsernamePasswordCredentials(solrUName, solrPwd);

                  ((CommonsHttpSolrServer)
server).getHttpClient().getState().setCredentials(new
AuthScope(solrUrl.getHost(), 443, AuthScope.ANY_REALM),
defaultcreds);

            }


 > From: skyusc@hotmail.com
> To: solr-user@lucene.apache.org
> Subject: How to use solrJ: Self-signed cert SSL + basic auth.
> Date: Fri, 2 Sep 2011 00:19:13 -0700
> 
> I have solr 1.4.1 set up with following additions:
> 1. Basic authentication
> 2. SSL using self signed certificate
> 
> How do I use solrj to connect to this server?
> Thanks!
> - sky
 		 	   		  

How to use solrJ: Self-signed cert SSL + basic auth.

Posted by Sky USC <sk...@hotmail.com>.







I have solr 1.4.1 set up with following additions:
1. Basic authentication
2. SSL using self signed certificate
 
How do I use solrj to connect to this server? I think the solution might reside in using HttpClient - but I cant figure out how. Any help will be appreciated.
Thanks!
- sky