什么是Tomcat的基本身份验证的用户名/密码?

什么是Tomcat的基本身份验证的用户名/密码?

问题描述:

我已经挖了有关如何设置tomcat的认证,是的,它确实有一个弹出窗口,这让我输入用户名/密码的引导互联网,但似乎我的用户名/密码错误。
我加分我的tomcat-user.xml这里:

I've digged the internet for the guide about how to set tomcat authentication,and yes,it really has a pop-up window,which allows me to input username/password,but it seems that my username/password is wrong. I add fraction of my tomcat-user.xml here:

enter code here
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->

和这里的web.xml的部分:

and fraction of web.xml here:

enter code here
<auth-constraint>
  <role-name>tomcat</role-name>
  <role-name>both</role-name>
  <role-name>role1</role-name>
</auth-constraint>

所有这些雄猫/ tomcat的,既有/ tomcat的,基于role1 /雄猫不起作用。
有什么问题?

All these "tomcat/tomcat,both/tomcat,role1/tomcat" don't work. What's problem?

路军

更新后的文件应该是这样的。

The file after update should look like this

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
-->
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
</tomcat-users>

重新启动Tomcat和使用管理/管理员

Restart tomcat and use admin/admin