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

 

 

 

 

posted @   zwbsoft  阅读(472)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示