kafka-connect-solr icon indicating copy to clipboard operation
kafka-connect-solr copied to clipboard

Basic Authentication is missing in the first request

Open r00tvvm opened this issue 4 years ago • 2 comments

We're running Solr 8.4.1 with basic authentication enabled for all type of requests and paths. Next running Kafka Connect with kafka-connect-solr plugin installed and default solrj library replaced with solr-solrj-8.4.1.jar. Kafka-connect-solr plugin (HttpSolrSinkConnector) has been configured with solr.username, solr.password

{
  "name": "solr-sink-stage",
  "config": {
    "connector.class": "com.github.jcustenborder.kafka.connect.solr.HttpSolrSinkConnector",
    "solr.url": "https://test-solr:8983/solr/collection-test-kafkaconnect1",
    "tasks.max": "1",
    "topics": "topic1",
    "name": "solr-sink-stage",
    "solr.username": "user",
    "solr.password": "password"
  },
  "tasks": [
    {
      "connector": "solr-sink-stage",
      "task": 0
    }
  ],
  "type": "sink"
}

But the very simple test showing the first request is coming without Basic Authentication headers

/ # nc -lp 8983
POST /solr/collection-test-kafkaconnect1/update?wt=javabin&version=2 HTTP/1.1
User-Agent: Solr[org.apache.solr.client.solrj.impl.HttpSolrClient] 1.0
Content-Type: application/javabin
Transfer-Encoding: chunked
Host: test-solr:8983
Connection: Keep-Alive

Content

Expecting this commit to work but it seems not. https://github.com/jcustenborder/kafka-connect-solr/commit/036fe18f0d231e030a07d27c3268fa2af8d6226e

Is it possible to force kafka-connect-solr to do Preemptive Basic Authentication and add authentication headers to all requests including the first one?

r00tvvm avatar Feb 25 '20 23:02 r00tvvm