【发布时间】:2011-12-11 18:26:07
【问题描述】:
谁能解释http://user:pass@host.com 身份验证的工作原理?浏览器是否发送带有user:pass 的Authorization 标头是base-64 编码的?
我在 Chrome 开发者工具中打开了 Net 控制台,当我发出 http://user:pass@stackoverflow.com 之类的请求时,我没有看到添加了 Authorization 标头。
如果我在 URL 前使用user:pass@,我真的很好奇浏览器如何发送密码。
【问题讨论】:
-
只是授权头。我不知道 Chrome 是如何做到的,但使用 Firefox 时,它会检查网站是否要求进行身份验证(在请求中),如果不是,则警告您
You are about to log in to the site "stackoverflow.com" with the username "user", but the website does not require authentication. This may be an attempt to trick you. Is "stackoverflow.com" the site you want to visit?然后它要么 [是] 切断auth details 或 [No] 中止请求。因此,除非您有一个方便的授权站点,否则您不会看到标题。
标签: http web http-authentication