Saturday, 10 September 2016

How to place http authentication in SOLR?

Tested with SOLR version is 4.4
Place the following code in example\etc\webdefault.xml file under <web-app>
<web-resource-name>Solr authenticated application</web-resource-name>

<realm-name>Test Realm</realm-name>

Brief description of above parameters:
url-pattern refers to the url for which this authentication required, since, mentioned as "/*", authentication would be required for any url. Once after authentication happens, application won't ask the authentication until browser session gets destroyed.
role-name refers to the role that access exists. Similarly, we can place separate access for each functionality like search, update, delete etc
realm-name refers to the name used to display while asking for authentication, this should match with the name under set parameters of example\etc\jetty.xml file as follows:

Place the following code under <configure>
<Call name="addBean">
<New class="">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/</Set>
<Set name="refreshInterval">0</Set>
Now, create / update the file in etc folder with authentication details as follows:
<username>: <password>, <role>
Eg: user: pwd, admin
So, we can give multiple users with multiple roles and provide access on role basis.

For more information, please refer
If needed to configure realm for TOMCAT, please use UserDatabaseRealm as explained in

No comments:

Post a Comment

Your comment is so valuable as it would help me in my growth of knowledge.