我有一个独立的JackRabbit存储库。 它通过RMI使用一些凭据(写访问)填充。 对任何凭据启用HTTP读取访问权限(默认情况下)。
其中一个用例是生成JSP页面上存储库项(文件)的URL链接,以便用户可以单击它们在浏览器中查看或下载。生成链接,但点击它们后会收到403错误。如果该链接被复制粘贴到另一个浏览器选项卡,它会要求登录/密码并显示(或下载)该文件。
我知道将一些(可能是空的)登录/密码传递给URL,如下所示:
http://user:password@host:port/blahblah
但是RFC不允许使用HTTP(虽然它有时会起作用,但并非总是如此,并且不适合我)
问题是,如何删除HTTP访问的登录/密码提示?这似乎是多余的,因为任何凭证都允许读访问。它可以在repository.xml,security.xml或其他地方配置吗?
答案 0 :(得分:2)
您可以在Jackrabbit webapp内的WEB-INF/web.xml
部署描述符中进行配置。 SimpleWebdavServlet的<servlet>
配置条目包含默认注释掉的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>
启用此参数可以解决您的问题。