Hey,

The other alternative would be to implement a HttpClientConfigurer which
can perform preemptive basic authentication (just the same way SolrRequest
is sending the credentials). The code is available in the branch_6x here,

https://github.com/apache/lucene-solr/blob/1bfa057d5c9d89b116031baa7493ee422b4cbabb/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthConfigurer.java

For the 6.3.x installation, you can copy this code and include it as a
custom jar on the client side. As part of the client initialization, just
configure this implementation of client configurer. Here is a sample code
snippet you can use as a reference.

https://github.com/apache/lucene-solr/blob/a986368fd0670840177a8c19fb15dcd1f0e69797/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java#L111-L123

Let me know if you have any questions.

Thanks
Hrishikesh


On Thu, Feb 16, 2017 at 6:39 AM, Bryan Bende <bbe...@gmail.com> wrote:

> Hello,
>
> The QueryRequest was just an example, it will work with any request
> that extends SolrRequest.
>
> How are you indexing your documents?
>
> I am going to assume you are doing something like this:
>
> SolrClient client = ...
> client.add(solrInputDocument);
>
> Behind the scenes this will do something like the following:
>
> UpdateRequest req = new UpdateRequest();
> req.add(doc);
> req.setCommitWithin(commitWithinMs);
> req.process(client, collection);
>
> So you can do that your self and first set the basic auth credentials
> on the UpdateRequest which extends SolrRequest.
>
> Thanks,
>
> Bryan
>
> On Thu, Feb 16, 2017 at 5:45 AM, vrindavda <vrinda...@gmail.com> wrote:
> > Hi Bryan,
> >
> > Thanks for your quick response.
> >
> > I am trying to ingest data into SolrCloud,  Hence I will not have any
> solr
> > query. Will it be right approach to use QueryRequest to index data ? Do I
> > need to put any dummy solrQuery instead ?
> >
> >
> >
> > --
> > View this message in context: http://lucene.472066.n3.
> nabble.com/Solr6-3-0-SolrJ-API-for-Basic-Authentication-
> tp4320238p4320675.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to