其他分享
首页 > 其他分享> > solr添加权限认证

solr添加权限认证

作者:互联网

1、\server\etc路径下新建role.properties文件,内容如下(用户名:密码, 权限

 

 

 

2、\server\context路径下solr-jetty-context.xml文件,新增get节点

<Get name="securityHandler">

         <Set name="loginService">

                 <New class="org.eclipse.jetty.security.HashLoginService">

                         <Set name="name">TestRealm</Set>  <!-- 这仅仅是一个名字而已-->

                        <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/role.properties</Set>

                 </New>

         </Set>

  </Get>

 

 

 

3、\server\solr-webapp\webapp\WEB-INF路径下web.xml文件,添加security-constraint节点

<security-constraint>

<web-resource-collection>

  <web-resource-name>Solr</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>verify-name</realm-name>   

</login-config>

 

 

 

4、重启solr

 

 

 

 

TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
  TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back

标签:xml,权限,TRANSLATE,server,location,认证,document,solr
来源: https://www.cnblogs.com/zwbsoft/p/16058251.html