繁体   English   中英

是否可以从SOAP Web服务保存客户端证书?

[英]Is it possible to save the client certificate from a SOAP Web service?

我一直在尝试使用GlassFish作为Web服务器和SOAP UI来基于数字证书实施身份验证和授权,以测试我的应用程序的功能,但是作为身份验证过程的一部分,我需要保存所有消息信息(包括找到的别名)中的日志来自使用Web服务和消息内容的客户端的glassfish的cacerts文件中。

实际上有可能从应用程序层执行此操作吗? 我曾尝试在服务器端使用消息和逻辑处理程序,但看不到与数字证书有关的任何内容,我唯一的线索是SOAP UI从客户端获得服务器证书。

经过一些研究并且对此失败了,我最终将证书详细信息添加到Web描述符上的项目中,并从中获取用户名,之后找到该用户名的别名,最后在TrustStore中搜索别名以获取公钥。 。

首先,我们需要在web.xml文件中添加身份验证的详细信息:

<!-- Security constraint for resource only accessible to role -->
<security-constraint>
  <display-name>WebServiceSecurity</display-name>

  <web-resource-collection>
    <web-resource-name>Authorized users only</web-resource-name>
    <url-pattern>/ExampleWSService</url-pattern>
    <http-method>POST</http-method>
  </web-resource-collection>

  <auth-constraint>
    <role-name>user</role-name>
  </auth-constraint>

</security-constraint>  

<!-- BASIC authorization -->
<login-config>
  <auth-method>CLIENT-CERT</auth-method>
</login-config>

<!-- Definition of role -->
<security-role>
  <role-name>user</role-name>
</security-role>

在sun-web.xml上,我们添加了角色映射和来自客户端的详细信息,可以使用公钥进行检索。

<sun-web-app>
  <security-role-mapping>
    <role-name>user</role-name>
      <!-- <group-name>wsusers</group-name> -->
     <principal-name>CN=Name, OU=Department, O=Organization, L=City, ST=State, C=nl</principal-name>
  </security-role-mapping>
  <security-role-mapping>
    <role-name>user</role-name>
    <group-name>wsusers</group-name>
  </security-role-mapping>
</sun-web-app>

基于本教程: http : //javaeenotes.blogspot.com/2010/10/securing-jax-ws-web-services.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM