solr基于tomcat增加主界面登录权限

tomcat-user.xml增加下面标签(用户名,密码,角色)
<
user username="admin" password="new-password" roles="admin"/>

在D:apache-tomcat-6.0.37-windows-x64apache-tomcat-6.0.37webappssolrWEB-INFweb.xml增加

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Restrict access to Solr admin</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>DELETE</http-method>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
        <http-method>PUT</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>default</realm-name>
</login-config>

重启服务器即可

参考http://www.cnblogs.com/wudi521/p/5570577.html

原文地址:https://www.cnblogs.com/hihtml5/p/5781385.html