WEB开发网
开发学院软件开发Java Java Web 服务: WS-Trust 和 WS-SecureConversati... 阅读

Java Web 服务: WS-Trust 和 WS-SecureConversation

 2010-07-16 00:00:00 来源:WEB开发网   
核心提示: 在 清单 3 中,外面的策略指定了使用对称加密(<sp:SymmetricBinding>)来加密正在交换中的消息的主体(<sp:EncryptedParts> 设置,Java Web 服务: WS-Trust 和 WS-SecureConversation(7),临近清

在 清单 3 中,外面的策略指定了使用对称加密(<sp:SymmetricBinding>)来加密正在交换中的消息的主体(<sp:EncryptedParts> 设置,临近清单底部)。在对称加密策略内,<sp:ProtectionToken> 以及嵌套的 <sp:SecureConversationToken> 元素表明该 WS-SecureConversation 将被用来执行对称加密。

当 STS 被访问时应用的策略是由嵌套在 <sp:SecureConversationToken> 内的 <sp:BootstrapPolicy>(如加粗部分所示)定义的。这个策略只指定了消息主体以及地址头的签名使用 X.509 证书,与本系列前期文章中使用的签名类型相同。

请注意,客户机与 STS 之间交换的消息在策略使用时,并未加密。这就使得我们更容易了解所发生的事情,但是对于实际使用,您可能想要使用 TLS/SSL 传输加密或者 WS-Security 加密来保护这次交换。

消息交换

清单 4 显示了消息 1 和 2 的头部 — 分别为对 STS 的请求以及对客户机的响应。(在 清单 1 和 清单 2 中,您已经看到过这些消息的主体。)

清单 4. STS 请求和响应的头部

 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
 <soap:Header> 
 
  <Action xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-32320445" 
   >http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT</Action> 
  <MessageID xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-2673180" 
   >urn:uuid:24ce01d5-3c17-4df6-ad89-2fc0720152cd</MessageID> 
  <To xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-5132526" 
   >http://localhost:8800/cxf-seismicsc-signencr/</To> 
  ... 
  <wsse:Security xmlns:wsse="...wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"> 
   <wsse:BinarySecurityToken xmlns:wsse="...wssecurity-secext-1.0.xsd" 
    xmlns:wsu="...wssecurity-utility-1.0.xsd" 
    EncodingType="...soap-message-security-1.0#Base64Binary" 
    ValueType="...x509-token-profile-1.0#X509v3" 
    wsu:Id="CertId-CF15C330C32618BF4912736604028486" 
    >MIICo...8/0n33w==</wsse:BinarySecurityToken> 
   <wsu:Timestamp xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-7"> 
    <wsu:Created>2010-05-12T10:33:22.831Z</wsu:Created> 
    <wsu:Expires>2010-05-12T10:38:22.831Z</wsu:Expires> 
   </wsu:Timestamp> 
   <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-8"> 
    <ds:SignedInfo> 
     ... 
     <ds:Reference URI="#Id-7059772"> 
      ... 
     </ds:Reference> 
     ... 
     <ds:Reference URI="#Timestamp-7"> 
      ... 
     </ds:Reference> 
    </ds:SignedInfo> 
    <ds:SignatureValue>TYIbt...V0dd8=</ds:SignatureValue> 
    <ds:KeyInfo Id="KeyId-CF15C330C32618BF4912736604028487"> 
     <wsse:SecurityTokenReference xmlns:wsse="...wssecurity-secext-1.0.xsd" 
      xmlns:wsu="...wssecurity-utility-1.0.xsd" 
      wsu:Id="STRId-CF15C330C32618BF4912736604028488"> 
      <wsse:Reference xmlns:wsse="...wssecurity-secext-1.0.xsd" 
      URI="#CertId-CF15C330C32618BF4912736604028486" 
      ValueType="...x509-token-profile-1.0#X509v3"/> 
     </wsse:SecurityTokenReference> 
    </ds:KeyInfo> 
   </ds:Signature> 
  </wsse:Security> 
 </soap:Header> 
 <soap:Body xmlns:wsu="..." wsu:Id="Id-7059772"> 
  ... 
 </soap:Body> 
</soap:Envelope> 
 
soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
 <soap:Header> 
  <Action xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-33522601" 
   >http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT</Action> 
  <MessageID xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-9229531" 
   >urn:uuid:d9d1b9b2-a864-446b-ab81-3176f868046e</MessageID> 
  <To xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-25551189" 
   >http://www.w3.org/2005/08/addressing/anonymous</To> 
  <RelatesTo xmlns="http://www.w3.org/2005/08/addressing" 
   xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-32148925" 
   >urn:uuid:24ce01d5-3c17-4df6-ad89-2fc0720152cd</RelatesTo> 
  <wsse:Security xmlns:wsse="...wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"> 
   <wsu:Timestamp xmlns:wsu= 
    "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssecurity-utility-1.0.xsd" 
    wsu:Id="Timestamp-7"> 
    <wsu:Created>2010-05-12T10:33:22.913Z</wsu:Created> 
    <wsu:Expires>2010-05-12T10:38:22.913Z</wsu:Expires> 
   </wsu:Timestamp> 
   <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-8"> 
    <ds:SignedInfo> 
     ... 
     <ds:Reference URI="#Id-4824957"> 
      ... 
     </ds:Reference> 
     ... 
     <ds:Reference URI="#Timestamp-7"> 
      ... 
     </ds:Reference> 
    </ds:SignedInfo> 
    <ds:SignatureValue>tr1tx...GY4wk=</ds:SignatureValue> 
    <ds:KeyInfo Id="KeyId-A167EB2B526E0894DA127366040291811"> 
     <wsse:SecurityTokenReference xmlns:wsse="...wssecurity-secext-1.0.xsd" 
      xmlns:wsu="...wssecurity-utility-1.0.xsd" 
      wsu:Id="STRId-A167EB2B526E0894DA127366040291812"> 
      <wsse:KeyIdentifier EncodingType="...soap-message-security-1.0#Base64Binary" 
      ValueType="...soap-message-security-1.1#ThumbprintSHA1" 
      >uYn3PK2wXheN2lLZr4n2mJjoWE0=</wsse:KeyIdentifier> 
     </wsse:SecurityTokenReference> 
    </ds:KeyInfo> 
   </ds:Signature> 
  </wsse:Security> 
 </soap:Header> 
 <soap:Body xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-4824957"> 
  ... 
 </soap:Body> 
</soap:Envelope> 

上一页  2 3 4 5 6 7 8  下一页

Tags:Java Web 服务

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接