如何配置tomcat-users.xml来保护tomcat中的页面?

如何配置tomcat-users.xml来保护tomcat中的页面?,第1张

如何配置tomcat-users.xml来保护tomcat中的页面?

可能回答晚了,但是无论如何您都在web.xml中缺少角色,也不必提及领域,因此您的web.xml应该如下所示

<security-constraint>   <web-resource-collection>      <web-resource-name>Admin</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>      <!-- Please note following line .. its commented -->      <!-- <realm-name>Admin</realm-name> --> </login-config> <!-- Following section was missing --> <security-role>     <role-name>admin</role-name></security-role>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5000531.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-14
下一篇2022-11-14

发表评论

登录后才能评论

评论列表(0条)

    保存