如何使用的.htaccess(和htpasswd的)身份验证时注销?如何使用、身份验证、htaccess、htpasswd

2023-09-02 09:49:28 作者:雪落蒼山遠

可能重复:    HTTP通过PHP 认证注销

Possible Duplicate: HTTP authentication logout via PHP

你好

我有一个使用在我的网站的一些功能保护的.htaccess htpasswd的。 当用户试图访问此,他们得到迅速进入细节。他们进入他们的详细资料,并得到和可以看到的东西全部等工作正常。

I have a some functionality on my website protected using .htaccess and .htpasswd. When users attempt to access this, they get prompt to enter details. They enter their details and get in and can see stuff etc. All works fine.

我的问题是如何创建这种类型的身份验证的注销功能。我知道他们可以关闭浏览器窗口,注销。但是,这并不理想。你有什么建议给我吗?

My question is how do I create a logout functionality for this type of authentication. I know that they can close the browser window to "Logout". But this is not ideal. What would you suggest to me?

感谢。

推荐答案

浏览器通常不支持这一点,看到的如何退出?

Browsers usually don't support this, see How do I log out?

由于浏览器第一次启动   实现基本身份验证,   网站管理员一直想   知道如何让用户注销。   由于浏览器缓存的用户名   和密码与认证   领域,如在此前面所描述   教程,这不是一个函数   服务器配置,但它是一个   让浏览器的问题   忘记了凭据信息,所以   下一次的资源是   请求,用户名和密码   必须再次供给。有   许多情况中,这是   合乎需要的,当使用如   浏览器在一个公共位置,并且不   希望离开登录浏览器   在,从而使下一个人可以得到   到您的银行帐户。

Since browsers first started implementing basic authentication, website administrators have wanted to know how to let the user log out. Since the browser caches the username and password with the authentication realm, as described earlier in this tutorial, this is not a function of the server configuration, but is a question of getting the browser to forget the credential information, so that the next time the resource is requested, the username and password must be supplied again. There are numerous situations in which this is desirable, such as when using a browser in a public location, and not wishing to leave the browser logged in, so that the next person can get into your bank account.

然而,虽然这也许是   最常见的问题有关   基本身份验证,迄今没有   各大浏览器厂商纷纷   看到了这一点作为一个可取的特点   投入到自己的产品。

However, although this is perhaps the most frequently asked question about basic authentication, thus far none of the major browser manufacturers have seen this as being a desirable feature to put into their products.

因此,这个问题的答案   问题是,你不能。对不起。

Consequently, the answer to this question is, you can't. Sorry.

有浏览器扩展,使您以清除站点的HTTP验证。 对于Firefox在 WebDeveloper 扩展(这是我的favourtie扩展名之一反正)提供了此功能。 这个菜单是杂项/清除私有数据/ HTTP认证

There are browser extensions that allow you to clear the HTTP authentication for a site. For Firefox the WebDeveloper extension (which is one of my favourtie extensions anyway) offers this feature. The menu for this is Miscellaneous/Clear Private Data/HTTP Authentication.