陋室铭
永远也不要停下学习的脚步(大道至简至易)

添加此功能主要是为了增加solr服务器的安全性,不能随便让人访问。

 

1.      tomcatF:\Tomcat 6.0.26_solr\conf\tomcat-users.xml添加用户角色并指定访问的用户名密码

  1. <role rolename="solr"/>
  2. <user username="admin" password="admin" roles="solr"/>

 

 

2. 在F:\Tomcat6.0.26_solr\webapps\solr\WEB-INF\web.xm中添加用户访问权限设置

  1. <security-constraint>
  2. <web-resource-collection>
  3. <web-resource-name>Solr Lockdown</web-resource-name>
  4. <url-pattern>/</url-pattern>
  5. <http-method>GET</http-method>
  6. <http-method>POST</http-method>
  7. </web-resource-collection>
  8. <auth-constraint>
  9. <description>This applies only to the "tomcat" security role</description>
  10. <role-name>solr</role-name>
  11. <role-name>admin</role-name>
  12. </auth-constraint>
  13. <user-data-constraint>
  14. <transport-guarantee>NONE</transport-guarantee>
  15. </user-data-constraint>
  16. </security-constraint>
  17.  
  18. <login-config>
  19. <auth-method>BASIC</auth-method>
  20. <realm-name>Solr</realm-name>
  21. </login-config>



 

 

如果弹出此框并且能正常登录,说明已经配置成功

 

posted on 2018-08-07 15:29  宏宇  阅读(313)  评论(0编辑  收藏  举报