On 5/31/2018 8:03 AM, Dimitris Kardarakos wrote:
> Following the feedback in the "Index protected zip" thread, I am
> trying to add documents to the index using SolrJ API.
>
> The server is in SolrCloud mode with BasicAuthPlugin for authentication.
>
> I have not managed to figure out how to pass username/password to my
> client.

There are two ways to approach this.

One approach is to build a custom HttpClient object that uses
credentials by default, and then use that custom HttpClient object to
build your CloudSolrClient.  Exactly how to correctly build the
HttpClient object will depend on exactly which HttpClient version you've
included into your program.  If you go with SolrJ dependency defaults,
then the HttpClient version will depend on the SolrJ version.

The other approach is the method described in the documentation, where
credentials are added to each request object:

https://lucene.apache.org/solr/guide/6_6/basic-authentication-plugin.html#BasicAuthenticationPlugin-UsingBasicAuthwithSolrJ

There are several different kinds of request objects.  A few examples:
UpdateRequest, QueryRequest, CollectionAdminRequest.

Thanks,
Shawn

Reply via email to