如何确保 AuthName 在所有浏览器中都有效?
How can I make sure AuthName works in all browsers?
下面的代码似乎可以在 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 在所有浏览器中都有效?
AuthName
指令在相应的 header 中设置 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。在讨论中有人指出,realm 中的文本不可信任,可用于网络钓鱼攻击,以诱骗用户泄露 third-parties 的密码。我不是安全专家,但我知道代理可以注入 headers——而且通常会注入——这就是问题所在。
显然,由于这个原因,领域已从身份验证对话中删除,更改最终移植到 Chrome。您可以查看 Do not show untrustworthy strings in the basic auth dialog 代码审查以获取更多详细信息。
下面的代码似乎可以在 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 在所有浏览器中都有效?
AuthName
指令在相应的 header 中设置 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。在讨论中有人指出,realm 中的文本不可信任,可用于网络钓鱼攻击,以诱骗用户泄露 third-parties 的密码。我不是安全专家,但我知道代理可以注入 headers——而且通常会注入——这就是问题所在。
显然,由于这个原因,领域已从身份验证对话中删除,更改最终移植到 Chrome。您可以查看 Do not show untrustworthy strings in the basic auth dialog 代码审查以获取更多详细信息。