2012-11-06 49 views
0

所以對於我目前工作的項目,之前走的是露天的開發過程中,我們創造,我們從我們的工作流程的過程中調用自定義的JSP頁面位於:C:\Alfresco\tomcat\webapps\share\custom。目前任何人都可以訪問這個jsp頁面。但是,當我們將位置移動到C:\Alfresco\tomcat\webapps\alfresco\jsp\custom時,總是需要登錄才能訪問該頁面,這對我來說似乎很陌生。然而,這裏的問題是我們不希望允許用戶訪問Share和Explorer,因此我們不打算在這裏配置SSO。我們希望僅允許組「經理」的人員或組「經理」中當前登錄的用戶訪問此頁面,而它位於共享方。我們已經嘗試添加以下到如何驗證添加到JSP頁面上露天分享

C:\Alfresco\tomcat\webapps\share\WEB-INF\web.xml文件:

<security-constraint> 
     <web-resource-collection> 
      <web-resource-name>All</web-resource-name> 
      <url-pattern>/custom /*</url-pattern> 
      <http-method>GET</http-method> 
      <http-method>POST</http-method> 
     </web-resource-collection> 
     <auth-constraint> 
      <role-name>Manager</role-name> 
     </auth-constraint> 
    </security-constraint> 

但這並沒有工作。有沒有人有關於我們如何獲得所需認證的建議?

謝謝分享

回答

2

認證是由衝浪框架控制,特別是它被設置在頁面級別。

JSP頁面site-index.jsp提供了一個基於JSP的頁面示例,該頁面處理經過身份驗證的用戶供您複製,但您還必須將其連接到框架中。

要做到這一點,你需要創建一個類似於以下

<?xml version='1.0' encoding='UTF-8'?> 
<page> 
    <title>My page</title> 
    <description>What the page is for</description> 
    <template-instance>my-page</template-instance> 
    <authentication>user</authentication> 
</page> 

頁面定義添加該文件WEB-INF/classes/alfresco/site-data/pages/site-index.xml下。

您會看到該頁面引用了模板實例my-page,該模板實例必須在WEB-INF/classes/alfresco/site-data/template-instances下的第二個XML文件中聲明,例如,

<?xml version='1.0' encoding='UTF-8'?> 
<template-instance> 
    <template-type>my-page</template-type> 
</template-instance> 

模板實例的XML文件(不.xml後綴)的名稱必須與頁面的<template-instance>屬性指定的名稱相匹配。

最後創建模板類型的文件my-page.xmlWEB-INF/classes/alfresco/site-data/template-types,例如下(此名稱必須與模板實例文件<template-type>屬性相匹配)

<?xml version="1.0" encoding="UTF-8"?> 
<template-type> 
     <title>Site index landing page template type</title> 
     <description>Site index landing page JSP Template Type</description> 

     <!-- Define the rendering processors for this template type --> 
     <processor mode="view"> 
       <id>jsp</id> 
       <jsp-path>/my-page.jsp</jsp-path> 
     </processor> 

</template-type> 

文件my-page.jsp將包含您的JSP代碼。正如我提到的核心文件site-index.jsp爲例。

當你擁有了這一切工作,你應該在一個AMP文件打包您的定製。您可以使用Ant或Maven根據您的偏好進行此操作。