Http Digest 身份验证,处理不同的浏览器字符集
我尝试在基于 php(apache 模块)的网站中使用 Http 身份验证摘要方案。一般来说,它工作得很好,但是当涉及到根据我的用户数据库验证用户名/哈希时,我遇到了问题。 当然,我不想将用户的密码存储在我的数据库中,所以我倾向于将 A1 哈希值(即 md5($username . ':' . $realm . ':' . $password))存储在我的数据库中数据库。 这也是浏览器创建要发回的哈希值的方式。
问题:
我无法检测浏览器是否在 ISO-8859-1 后备(如 firefox、IE)或 UTF-8(Opera)或其他格式中执行此操作。我选择以 UTF-8 进行计算并存储此 md5 哈希值。这会导致 Firefox 和 IE 浏览器无法进行身份验证。
你如何解决这个问题?
只是不使用这个身份验证方案吗?或者为每个字符集存储一个 md5 哈希值?
强迫用户使用 Opera?
(A1 条款请参阅 http://php.net/manual/en /features.http-auth.php 示例。) (对于摘要访问身份验证,请阅读相应的维基百科条目)
I tried to use the Http Authentication Digest Scheme with my php (apache module) based website. In general it works fine, but when it comes to verification of the username / hash against my user database i run into a problem.
Of course i do not want to store the user´s password in my database, so i tend to store the A1 hashvalue (which is md5($username . ':' . $realm . ':' . $password)) in my db.
This is just how the browser does it too to create the hashes to send back.
The Problem:
I am not able to detect if the browser does this in ISO-8859-1 fallback (like firefox, IE) or UTF-8 (Opera) or whatever. I have chosen to do the calculation in UTF-8 and store this md5 hash. Which leads to non-authentication in Firefox and IE browsers.
How do you solve this problem?
Just do not use this auth-scheme? Or Store a md5 Hash for each charset?
Force users to Opera?
(Terms of A1 refer to the http://php.net/manual/en/features.http-auth.php example.)
(for digest access authentication read the according wikipedia entry)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的问题的原因是 FireFox 中的一个错误。
只是为了回答并关闭这个。
关联:
https://bugzilla.mozilla.org/show_bug.cgi?id=546330
The reason for my problem was a bug in FireFox.
Just to answer and close this.
Link:
https://bugzilla.mozilla.org/show_bug.cgi?id=546330