基本身份验证不露面受限资源第二次弹出认证 [英] BASIC authentication does not show up the authentication popup for the constrained resource second time

查看:100
本文介绍了基本身份验证不露面受限资源第二次弹出认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想基本身份验证机制。当我尝试访问受限资源的第二次输入用户名和密码,弹出不上来。

I am trying the BASIC authentication mechanism. When i try to access the constrained resource second time the popup for username and password does not come up.

以下是我的tomcat-users.xml中定义的角色和用户

Following are the roles and users defined in my tomcat-users.xml

<role rolename="Admin"/>  
<role rolename="Member"/>
<role rolename="Guest"/>    
<user username="Annie" password="admin" roles="Admin, Member, Guest"/>    
<user username="Diane" password="coder" roles="Member, Guest"/>    
<user username="Ted" password="newbie" roles="Guest"/>    

以下是项在我的web.xml中定义

Following are the entries defined in my web.xml

<web-app>

<display-name>SecurityApp</display-name>    

<servlet>
<servlet-name>BeerAppServlet</servlet-name>    
<servlet-class>com.example.servlets.BeerAppServlet</servlet-class>    
</servlet>    
<servlet-mapping>    
<servlet-name>BeerAppServlet</servlet-name>   
<url-pattern>/Beer/AddRecipe</url-pattern>   
</servlet-mapping>    

<security-role> <role-name>Admin</role-name> </security-role>    
<security-role> <role-name>Member</role-name> </security-role>    
<security-role> <role-name>Guest</role-name> </security-role>   

<security-constraint>
 <web-resource-collection>
  <web-resource-name>Update</web-resource-name>
  <url-pattern>/Beer/AddRecipe/*</url-pattern>
 </web-resource-collection>

<auth-constraint>
 <role-name>Admin</role-name>
 <role-name>Member</role-name>
</auth-constraint>

</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>

</web-app>

我的web应用程序的名字是SecurityApp。
当我进入我的程序如下第一次
的http://本地主机:8083 / SecurityApp /啤酒/鸭precipe 我得到弹出用于输入用户名和密码,我输入以下凭据用户名=黛安密码= $ C $铬。在输入上面的凭证后,认证成功。

My webapp name is SecurityApp. For the first time when i access my app as follows http://localhost:8083/SecurityApp/Beer/AppRecipe i get the popup for entering the user name and password and i enter the following credentials username=Diane password=coder. After entering the above credentials the authentication is success.

有关当我键入此URL的第二次的http://本地主机:8083 / SecurityApp /啤酒/鸭precipe
我不得到用户名和密码的验证弹出。为什么会这样。任何人都可以请解释

For the second time when i type this url http://localhost:8083/SecurityApp/Beer/AppRecipe. I dont get the authentication popup for username and password. Why is it so. can anyone please explain

推荐答案

由于浏览器缓存你的页面和认证领域的凭据(用户名,密码),并自动下一次您访问的页面发送。这是怎样的认证基础工作。如果你关闭浏览器(所有实例),它会要求提供凭据再次,除非它被配置为永久地储存它们。您可以检查这个的相关的问题。

Because the browser caches your credentials (username, password) for the page and authentication realm and automatically sends them the next time you visit the page. This is how BASIC authentication works. If you close (all instances of) the browser, it will ask for credentials again, unless it is configured to store them permanently. You can check this related question.

这篇关于基本身份验证不露面受限资源第二次弹出认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆