I am trying to use Solr Security on Solr 5.0 Cloud. Following process I
have used :-

 1. Modifying web.xml :-

<security-constraint><web-resource-collection>
   <web-resource-name>AdminAllowedQueries</web-resource-name>
   <url-pattern>/admin/*</url-pattern>
 </web-resource-collection>
 <auth-constraint>
   <role-name>admin</role-name>
 </auth-constraint>  </security-constraint>
<login-config>
 <auth-method>BASIC</auth-method>
 <realm-name>Solr Realm</realm-name></login-config>

 <security-role>
 <description>Admin</description>
 <role-name>admin</role-name>   </security-role>


   1.

   Changes in jetty.xml :-

   <Call name="addBean"> <Arg> <New
   class="org.eclipse.jetty.security.HashLoginService"> <Set name="name">Solr
   Realm</Set> <Set name="config"><SystemProperty name="jetty.home"
   default="."/>/etc/realm.properties</Set> <Set
   name="refreshInterval">0</Set> </New> </Arg> </Call>
   2.

   Creating realm.properties:- solradmin: solradmin,admin
   3.

   Set SOLR OPTS in solr.in.sh:-

   SOLR_OPTS="$SOLR_OPTS
   -DinternalAuthCredentialsBasicAuthUsername=solradmin" SOLR_OPTS="$SOLR_OPTS
   -DinternalAuthCredentialsBasicAuthPassword=solradmin"

I am getting Unauthorized error while creating collection using following
command:-

curl -i -X GET \
   -H "Authorization:Basic c29scmFkbWluOnNvbHJhZG1pbg==" \
 
'http://localhost:8080/solr/admin/collections?action=CREATE&name=test&collection.configName=testconf&numShards=1'

Kindly help or suggest the best to get this done.

Thanx in advance.


Regards,


Swaraj Kumar
Senior Software Engineer I
MakeMyTrip.com
✆ +91-9811774497

Reply via email to