2012-01-24 37 views
1

我有一個獨立的JackRabbit存儲庫。 它通過RMI使用某些憑證(寫入訪問)進行填充。 通過HTTP啓用讀取訪問權限(默認情況下)啓用任何憑據。跳過Jackrabbit登錄提示

其中一個用例是在JSP頁面上生成URL存儲庫項目(文件)的鏈接,以便用戶可以單擊它們以在瀏覽器中進行瀏覽或下載。鏈接生成,但點擊它們後,我們得到一個403錯誤。如果該鏈接被複制粘貼到另一個瀏覽器選項卡,它會要求輸入登錄名/密碼並顯示(或下載)該文件。

我對傳遞一些(可能爲空)登錄/密碼的URL,這樣的想法:

http://user:[email protected]:port/blahblah 

但它不是由RFC允許HTTP(雖然它的工作原理有時,不總是這樣,那不適合我)

問題是,如何刪除登錄/密碼提示HTTP訪問?這似乎是多餘的,因爲任何憑據都允許讀訪問。它可以在repository.xml,security.xml或其他地方配置嗎?

回答

2

您可以在Jackrabbit Web應用程序內的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> 

啓用此參數應該解決您的問題。

+0

感謝您的意見。實際上,這在獨立的Jackrabbit jar中沒有被註釋掉。無論如何... 我已經設置了所有描述的值(空,guestcredentials,1:1,匿名:匿名,...)的參數值,它仍然不斷要求登錄/密碼。看起來像這個參數說明了如果沒有指定登錄名/密碼時要使用什麼,但不禁止詢問它。 – manuna

+1

@manuna我知道這對你來說已經太遲了,但爲了別人的利益:我也被這個問題所困惑 - 結果是有兩個servlet接受這個參數,而默認聲明的參數是' JCRWebdavServer'(JcrRemotingServlet)servlet,但是您想要在'Webdav'(SimpleWebdavServlet)servlet下聲明該參數。 –