下面的代码似乎在Firefox,IE,Safari中显示文字“HELLO WORLD”,但在Chrome中却没有。
<Files wp-login.php>
AuthType basic
AuthName "HELLO WORLD"
AuthBasicProvider file
AuthUserFile /home/.htpasswd
Require valid-user
</Files>
ErrorDocument 401 "Authentication required"
如何确保AuthName适用于所有浏览器?
答案 0 :(得分:4)
AuthName
指令在相应的标题中设置realm
参数,如:
WWW-Authenticate: Basic realm="HELLO WORLD"
我从2015年10月发现了一张Chromium票据,用于报告与HTTP身份验证相关的中间人攻击:Issue 544244 - HTTP basic auth credentials prompt should make the origin stand out more。在讨论期间,有人指出,域中的文本不可信,可用于网络钓鱼攻击,诱骗用户向第三方泄露密码。我不是安全专家,但据我所知,代理可以注入标题 - 通常也会出现问题。
显然,由于这一点,该身份已从身份验证对话框中删除,并且更改最终移植到Chrome。您可以查看Do not show untrustworthy strings in the basic auth dialog代码审核以获取更多详细信息。