c++ - 浏览器支持 HTTP 摘要认证中的 nextnonce 指令

标签 c++ http-authentication digest-authentication

我已经完成了一个基于 C++ 的 HTTP 服务器(或改写 - 大海捞针)并遇到了 HTTP 摘要身份验证问题。

根据HTTP authentication RFCAuthentication-Info header 中使用 nextnonce 指令是实现一次性使用 nonce 机制的有效方法。我已经根据 RFC 完成了此操作,但 Chrome 和 Firefox 似乎都忽略了该指令,并使用初始随机数发出所有进一步的请求,从而触发了不必要的 401 响应。 Firefox 的示例说明:

第一个请求 - 我的服务器返回 401 并发出初始随机数 a1f778b2afc8590e4a64f414f663128b enter image description here

Firefox 成功验证并获得带有 Authentication-Info: nextnonce="0b72e74afbcab33a5aba05d4db03b801" header 的回复 enter image description here

Firefox 发出一个新请求以从返回的 html 中获取图像 - 仍然使用初始随机数 c1587dd7be6251fa715540e0d6121aa5 并因此发送回一个带有新随机数的回复和提供的随机数已过期的标志. enter image description here

与第一个图像请求相同的场景。 enter image description here

现在使用新的 nonce 验证成功。 enter image description here

第二次请求也认证成功。 enter image description here

如图片所示 - 即使我回复了 Authentication-Info: nextnonce="0b72e74afbcab33a5aba05d4db03b801" 在第一个请求成功授权后,接下来的两个请求仍然使用原始随机数提供的 nextnonce 值。有没有人有过类似的经历?我肯定做错了什么——尽管 RFC 说客户端 应该 回复提供的 nextnonce 值,因此它不是强制性的,我高度怀疑最受欢迎的浏览器不使用这种技术。

最佳答案

关于c++ - 浏览器支持 HTTP 摘要认证中的 nextnonce 指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33261626/

相关文章:

C++ 字符转 int

C++ 平台兼容性

c++ - wxWidgets 在 wxPanel 上绘制 wxGLCanvas

webkit - Webkit HTTPS身份验证

Java:如何将参数传递给 Webstart Applet?

AngularJS 和摘要式 HTTP 身份验证

java - 使用 URLConnection 的摘要认证

c++ - 删除静态指针指向的动态内存

git - 如何强制 Git(2.5+)HTTP 传输更喜欢 SPNEGO 而不是基本身份验证?

java - Spring Security 基本身份验证,通过 http 进行摘要,用于无状态 API