我需要帮助配置GF3.1.2,我已经做了以下修改,如果我遗漏了什么重要的东西,请告诉我,因为修改后它无法工作。我的ID是[email protected]。
我找不到任何特定的线程或答案在论坛上,如果任何链接是有将是有帮助的.如果你有任何文件,这请转发。
请做必要的
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>
域名.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>
在您的web.xml中,登录-配置部分不完整。
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>certificate</realm-name>
</login-config>
realm-name内容必须与domain.xml中的auth-realm元素的name属性相匹配,在你的例子中是 "证书"
[更新]
此外,CA证书必须导入服务器的truststore中。
${com.sun.aas.instanceRoot}/config/cacerts.jks
事实上,我在glassfish 3.1.2上试了一下,在以下条件下可以工作。
1.我必须使用相同的jks类型的密钥(信任)存储,并放在相同的位置。为了与其他证书格式对话,你必须将它们转换为jks格式可以处理的格式。
2.在glassfish-web.xml中,你应该有这样的映射。
<security-role-mapping>
<role-name>manager</role-name>
<group-name>authorized</group-name>
</security-role-mapping>
3.在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中,你必须有与domain.xml文件相匹配的境界名。
当任何人第一次尝试时,都需要时间来理解,用简单的话来说,客户端和服务器的信任存储都应该信任对方的证书,首先最好使用自签名证书来交换服务器和客户端的证书,可以使用下面的文章来帮助,其中有简化的步骤,按照文章,你可以使用你自己的方法证书,任何你想要的。
http:/www.slideshare.netkrizsanscdjws-5-study-notes-3085287
SCDJWS 5或现今所知的Oracle Certified Professional,Java EE 5 Web Services DeveloperStudy Notesby Ivan A KrizsanVersion: 2012年2月23日
设置
Client Authentication: true
在 http-listener-2
.