You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Federico Grillini (JIRA)" <ji...@apache.org> on 2018/06/20 15:23:00 UTC

[jira] [Created] (SOLR-12503) SolrJ deleteById doesn't work when authentication is active.

Federico Grillini created SOLR-12503:
----------------------------------------

             Summary: SolrJ deleteById doesn't work when authentication is active.
                 Key: SOLR-12503
                 URL: https://issues.apache.org/jira/browse/SOLR-12503
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: Authentication
    Affects Versions: 7.3.1, 7.2.1, 5.5.5
            Reporter: Federico Grillini


When solr authentication is active the following code fails:

{code:java}
String id = "xxx"; // same as List<String> ids = ...

UpdateRequest upReq = new UpdateRequest();

upReq.setBasicAuthCredentials("user", "pwd");

upReq.deleteById(id).process(solrClient);
{code}

The error is (using *solrj 5.5.5*):

{quote}
org.apache.solr.client.solrj.impl.CloudSolrClient$RouteException: Error from server at http://xxx_shard1_replica_n1: Expected mime type application/xml but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 require authentication</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /solr/XXX_shard1_replica_n1/update. Reason:
<pre>    require authentication</pre></p>
</body>
</html>

	org.apache.solr.client.solrj.impl.CloudSolrClient.directUpdate(CloudSolrClient.java:653)
	org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1002)
	org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:891)
	org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:827)
	org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149)
	org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:166)
{quote}

The bug is in the method 

{{Map<String, Req> org.apache.solr.client.solrj.request.UpdateRequest.getRoutes(DocRouter router, DocCollection col, Map<String, List<String>> urlMap, ModifiableSolrParams params, String idField)}}

At line 299 a new request is created without the credentials of the main request.

Also solrj *7.3.1* is affected by the bug.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org