http - 跳过 Jackrabbit 登录提示

标签 http authentication jackrabbit

我有一个独立的 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/

相关文章:

c - 在 libwget 中启用 cookie 会导致段错误

java - EntityUtils.toString(entity) 抛出 OutOfMemory 错误

c# - 使用基于声明的身份验证使用 SharePoint 2010 对同一 AD 进行身份验证时区分 Windows Auth 和 Forms Auth 用户

java - Apache Oak - XML 导入失败,异常不是有效的 JCR 名称异常

multithreading - Jackrabbit 和并发修改

java - JCR-SQL2 查询通配符搜索不起作用。

c# - 如何使用 HTTP 在 C# 中控制设备的嵌入式控制软件?

ios - 在 iOS 应用程序的整个 Web View 中保留登录凭据(快速)

authentication - 如何在azure移动服务中链接不同的身份验证提供商

http - 当我使用浏览器冲浪时需要一个方便的工具来捕获 HTTP 响应