Adding Basic authentication params to HttpSolrClient using invariantParams
<p>I am trying to write a SOLR client using SolrJ HttpSolrClient.
I have to use Basic Authentication.</p>

<p>The documentation for SolrJ HttpSolrClient says that there is:</p>

<pre><code>protected ModifiableSolrParams invariantParams
</code></pre>

<p>and the description is:</p>

<p>Parameters that are added to every request regardless. This may be a place to add something like an authentication token.</p>

<p>Can someone who has used this before please tell me how to use the invariantParams for basic auth?</p>

<pre><code>public class MySolrClient extends HttpSolrClient{

    private String hostUrl;

    private String userName;

    private String password;

    public CloudForgeProcurementSolrClient(final String hostUrl, final String userName, final String password) {
        super(hostUrl);
        this.hostUrl = hostUrl;
        this.userName = userName;
        this.password = password;
        if (invariantParams == null) {
            invariantParams = new ModifiableSolrParams();
        }
        //        invariantParams.add(arg0, arg1);
    }
}
</code></pre>

<p>What should be arg0 and arg1 be in my case.
Thanks in advance!</p>