所以你需要做三件事
第一..
在Tomcat中设置安全领域(我假设是的服务器
Server →Apache-Coyote/1.1)。您可以在Realm Configuration
HOW-TO上阅读有关创建领域的更多信息。
最容易配置的领域是UserDatabaseRealm,但绝不建议在生产环境中使用。只是为了让您起步并在开发中运行。您所需要做的就是转到中的
tomcat-users.xml文件
${TOMCAT_HOME}/conf。然后只需编辑文件,它应该看起来像<tomcat-users> <user username="Murugesan" password="secret" roles="admin" /> <user username="peeskillet" password="superSecret" roles="user" /></tomcat-users>
第二..
您仍然需要对web.xml进行一些配置。你需要做几件事
声明允许使用该应用程序的角色。您可以将其放在下面
</security-contraint>
<security-role><role-name>user</role-name>



