Securing Solr – Setup Basic Authentication

Solr support Basic authentication for users with the use of the BasicAuthPlugin.An authorization plugin is also available to configure Solr with permissions to perform various activities in the system.

In this article we will discuss step by step process of how to enable basic authenticaion.

Step 1:Enable properties in solr.in.cmd for windows and solr.in.sh for linux

Add the following line to the solr.in.sh or solr.in.cmd file. This example tells the bin/solr command line to to use “basic” as the type of authentication, and to pass credentials with the user-name “solr” and password “SolrRocks”:

set SOLR_AUTH_TYPE=basic
set SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks"

Step 2: Create security.json file

To use Basic authentication, you must first create a security.json file.

For Basic authentication, the security.json file must have an authentication part which defines the class being used for authentication.
Usernames and passwords (as a sha256(password+salt) hash) could be added when the file is created, or can be added later with the Basic authentication API

JavaDeveloperZone is the group of innovative software developers. We are expert in Java JEE and BigData application development. Our contributions will help Java developers and make development journey easy. Feel free to ask any question and suggestion. Always have space for improvement !
We are also providing software application development as service. Contact us