[ 
https://issues.apache.org/jira/browse/CONNECTORS-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13598871#comment-13598871
 ] 

Maciej Lizewski commented on CONNECTORS-661:
--------------------------------------------

I think this is called 'preemtive auth' (sending auth tokens without explicit 
server request for authentication). if I am right - this is code that worked 
for me when connecting to 'redmine':

  DefaultHttpClient cl = new DefaultHttpClient();
  Credentials credentials = new UsernamePasswordCredentials(redmineLogin, 
redminePassword);
  cl.addRequestInterceptor(new PreemptiveAuth(credentials), 0);


  static class PreemptiveAuth implements HttpRequestInterceptor {
    private Credentials credentials;

    public PreemptiveAuth(Credentials creds) {
      this.credentials = creds;
    }

    public void process(final HttpRequest request, final HttpContext context) 
throws HttpException, IOException {
      request.addHeader(BasicScheme.authenticate(credentials, "US-ASCII", 
false));
    }
  }


what it does is appending authentication header to every request using 
HttpRequestInterceptor.
                
> Solr Connector cannot index documents when Solr is protected by authentication
> ------------------------------------------------------------------------------
>
>                 Key: CONNECTORS-661
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-661
>             Project: ManifoldCF
>          Issue Type: Bug
>          Components: Lucene/SOLR connector
>    Affects Versions: ManifoldCF 1.1.1
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>            Priority: Critical
>             Fix For: ManifoldCF 1.2
>
>
> The Solr connector cannot deal with Solr servers that are protected by 
> authentication.  The reason is that HttpClient forces a retry based on the 
> WWW-authenticate header that is returned, but the HttpEntity is not 
> resettable and thus the retry fails for that reason.
> This is a regression, because the Solr connector used to properly support 
> basic auth, and now no longer does.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to