【发布时间】:2016-12-04 01:12:56
【问题描述】:
我在 Chrome 51.0.2704.63 中使用 Postman 4.4.1。我已经用 Tomcat6 建立了一个 web 项目,web.xml 如下:
<web-app>
<display-name>Archetype Created Web Application</display-name>
<security-constraint>
<web-resource-collection>
<web-resource-name>
My App
</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>DIGEST</auth-method> <!-- DIGEST here -->
<realm-name>My Realm</realm-name>
</login-config>
</web-app>
当我使用本地浏览器访问http://localhost:8080/simple-web/ 时,会弹出一个窗口让我输入用户名和密码。填充后,效果很好。
当我使用Postman时,我在授权页面中输入用户名和密码,然后选择Digest Auth的类型。它总是向我显示401 Unauthrized。
我可以看到标题:
Cache-Control →no-cache
Content-Length →954
Content-Type →text/html;charset=utf-8
Date →Fri, 29 Jul 2016 10:26:20 GMT
Expires →Thu, 01 Jan 1970 08:00:00 CST
Pragma →No-cache
Server →Apache-Coyote/1.1
WWW-Authenticate →Digest realm="My Realm", qop="auth", nonce="dcb71e7d6766f85c3f233b7b74e42423", opaque="4894d1ece1380278a451585e9b548e21"
谁能知道原因以及如何解决?
【问题讨论】:
标签: postman http-status-code-401 digest