且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

http基本身份验证“注销”

更新时间:2022-06-25 20:40:32

更新:此解决方案不具备似乎在许多浏览器中都可以工作了。 Kaitsu的评论:

Update: This solution does not seem to work anymore in many browsers. Kaitsu's comment:


这种发送虚假凭证以使浏览器忘记正确的经过身份验证的凭据的解决方案在Chrome(16)和IE中无效(9)。适用于Firefox(9)。

This solution of sending false credentials to make browser forget the correct authenticated credentials doesn't work in Chrome (16) and IE (9). Works in Firefox (9).






实际上你可以通过发送false来实现变通方法服务凭证。这可以在浏览器中通过发送另一个(不存在的?)用户名而无需密码。浏览器丢失了有关经过身份验证的凭据的信息。


Actually you can implement a workaround by sending false credentials to the service. This works in Browsers by sending another (non-existent?) Username without a password. The Browser loses the information about the authenticated credentials.

示例:


https://www.example.com/ =>使用基本身份验证登录
为user1

https://www.example.com/ => Log in with basic auth as "user1"

现在打开

https://foobar@www.example.com/

您已被注销。 ;)

问候

Ps:但请用所有需要测试在您依赖给定信息之前浏览器。

P.s.: But please test this with all needed Browsers before you rely on the given information.