2012-04-20 54 views
2

我需要幫助配置GF3.1.2我做了以下更改,請讓我知道如果我失去了重要的東西,因爲改變後它不工作。 我的ID是[email protected]Glassfish 3.1.2配置客戶端證書相互認證

我找不到任何特定的線程或在論壇上的答案,如果有任何鏈接是有幫助的。 如果您有任何文件請轉發。

請做要緊

的web.xml

<login-config> 
    <auth-method>CLIENT-CERT</auth-method> 
</login-config> 
<security-constraint> 
    <web-resource-collection> 
    <web-resource-name>Entire Application</web-resource-name> 
    <url-pattern>/faces/*</url-pattern> 
    <http-method>POST</http-method> 
    </web-resource-collection> 
    <auth-constraint> 
    <description/> 
    <role-name>authorized</role-name> 
    </auth-constraint> 
    <user-data-constraint> 
    <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 
<security-role> 
    <description/> 
    <role-name>authorized</role-name> 
</security-role> 

sun-web.xml中

<security-role-mapping> 
    <role-name>authorized</role-name> 
    <principal-name>admin</principal-name> 
    <group-name>authorized</group-name> 
</security-role-mapping> 

domain.xml中

<security-service> 
    <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm"> 
    <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property> 
    <property name="jaas-context" value="fileRealm"></property> 
    </auth-realm> 
    <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file"> 
    <property name="file" value="${com.sun.aas.instanceRoot}/config/keyfile"></property> 
    <property name="jaas-context" value="fileRealm"></property> 
    </auth-realm> 
    <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"> 
    <property name="assign-groups" value="authorized"></property> 
    </auth-realm> 
+0

請更具體地說明「不工作」。你在建什麼樣的應用程序?你確定客戶端工作正常嗎? – TPete 2012-04-23 09:22:48

+0

具體來說,我的博客並不是要求客戶端證書,我想用客戶端證書來驗證用戶,我已經在glassfish服務器上做了特定的更改。 – user1347618 2012-04-23 17:12:34

+0

所以當我在瀏覽器中打網址時,它應該要求客戶端證書?我對嗎。 – user1347618 2012-04-23 17:48:22

回答

1

登錄,配置sectio n是在你的web.xml不完全

<login-config> 
    <auth-method>CLIENT-CERT</auth-method> 
    <realm-name>certificate</realm-name> 
</login-config> 

境界名稱內容必須在domain.xml中的auth-realm元素,而你的情況是「證書」的名稱屬性匹配

[更新]

此外,CA證書必須在服務器的信任

${com.sun.aas.instanceRoot}/config/cacerts.jks 
+0

服務器的密鑰庫包含服務器證書,而不是客戶端證書。 – TPete 2012-04-23 09:17:40

+0

權,只有CA證書必須在cacerts中 – PA314159 2012-04-23 10:51:56

+0

進口嗨特異於客戶端證書身份驗證domain.xml中改變我的應用程序不要求客戶端證書的瀏覽器來驗證用戶登錄後,應該要求客戶端證書,我有在login-config中添加領域名稱,我怎麼會知道我的客戶端證書是通過GF3.1.2所需要的,如果你想配置文件,請讓我知道。如何與你分享。 – user1347618 2012-04-23 17:11:06

0

當有人試圖這樣第一次需要時間讓他們明白,withing進口簡單的話來說,客戶端和服務器信任庫都應該相互信任其他證書,首先最好使用自簽名證書交換證書到服務器和客戶端,可以使用下面的文章獲得簡化步驟的幫助。遵循文章,然後你可以使用你自己的方法證書,這是你想要的。

http://www.slideshare.net/krizsan/scdjws-5-study-notes-3085287

SCDJWS 5 或現在知道的 Oracle認證專家, Java EE 5個的Web服務開發 學習筆記 通過 伊萬Krizsan 版本:2012年2月23日

0

其實我嘗試glassfish 3.1.2,它在以下條件下工作:

1.我必須使用sa我鍵入(信任)jks類型的存儲和在相同的位置。爲了與其他證書格式進行交流,您必須將它們轉換爲可以處理的格式jks格式。

2.in一個GlassFish的-web.xml中,你應該有一個這樣的映射

<security-role-mapping> 
     <role-name>manager</role-name> 
    <group-name>authorized</group-name> 
    </security-role-mapping> 

3.in一個domain.xml文件,你應該有以下內容:

<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"> 
       <property name="assign-groups" value="authorized"></property> 
      </auth-realm> 

注意: web.xml你必須有領域名稱匹配域。xml文件

+0

<登錄-配置> CLIENT-CERT 證書 2013-06-16 16:24:49

+0

感謝khurshed抽空回答這個問題。 – user1347618 2013-06-17 16:49:04

0

我有同樣的問題。

設置「客戶身份驗證:真」,在「HTTP偵聽器2」。