我有一个独立的 JackRabbit 存储库。 它是通过 RMI 使用一些凭据(写访问)填充的。 通过 HTTP 读取访问任何凭据(默认情况下)。
其中一个用例是在 JSP 页面上生成指向存储库项目(文件)的 URL 链接,以便用户可以单击它们在浏览器中查看或下载。链接已生成,但单击它们后我们会收到 403 错误。如果将该链接复制粘贴到另一个浏览器选项卡,它会要求输入登录名/密码并显示(或下载)该文件。
我想到了将一些(可能为空的)登录名/密码传递给 URL,如下所示:
http://user:password@host:port/blahblah
但 RFC 不允许它用于 HTTP(尽管它有时有效,但并非总是有效,这不适合我)
问题是,如何去除 HTTP 访问的登录/密码提示?这似乎是多余的,因为任何凭据都允许读取访问。可以配置在repository.xml、security.xml或者其他地方吗?
最佳答案
您可以在 WEB-INF/web.xml
中配置它Jackrabbit 网络应用程序中的部署描述符。 <servlet>
SimpleWebdavServlet 的配置条目包含 missing-auth-mapping
默认被注释掉的选项:
<init-param>
<param-name>missing-auth-mapping</param-name>
<param-value>anonymous:anonymous</param-value>
<description>
Defines how a missing authorization header should be handled.
1) If this init-param is missing, a 401 response is generated.
This is suitable for clients (eg. webdav clients) for which
sending a proper authorization header is not possible if the
server never sent a 401.
2) If this init-param is present with an empty value,
null-credentials are returned, thus forcing an null login
on the repository.
3) If this init-param is present with the value 'guestcredentials'
java.jcr.GuestCredentials are used to login to the repository.
4) If this init-param has a 'user:password' value, the respective
simple credentials are generated.
</description>
</init-param>
启用此参数应该可以解决您的问题。
关于http - 跳过 Jackrabbit 登录提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8991381/