WEB开发网
开发学院软件开发Java Java Web 服务: Metro 服务下的 WS-Security 阅读

Java Web 服务: Metro 服务下的 WS-Security

 2010-02-02 00:00:00 来源:WEB开发网   
核心提示: 清单 6. 签名/加密 WSDL<?xmlversion="1.0"encoding="UTF-8"?><wsdl:definitionstargetNamespace="http://ws.sosnoski.com/libra

清单 6. 签名/加密 WSDL

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions targetNamespace="http://ws.sosnoski.com/library/wsdl" 
  xmlns:wns="http://ws.sosnoski.com/library/wsdl" 
  xmlns:tns="http://ws.sosnoski.com/library/types" 
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"> 
 <wsdl:types> 
  ... 
 </wsdl:types> 
 
 <wsdl:message name="getBookRequest"> 
  <wsdl:part element="wns:getBook" name="parameters"/> 
 </wsdl:message> 
 ... 
 
 <wsdl:portType name="Library"> 
  <wsdl:operation name="getBook"> 
   <wsdl:input message="wns:getBookRequest" name="getBookRequest"/> 
   <wsdl:output message="wns:getBookResponse" name="getBookResponse"/> 
  </wsdl:operation> 
  ... 
 </wsdl:portType> 
 
 <wsdl:binding name="LibrarySoapBinding" type="wns:Library"> 
  
  <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
    URI="#SignEncr"/> 
 
  <wsdlsoap:binding style="document" 
    transport="http://schemas.xmlsoap.org/soap/http"/> 
  <wsdl:operation name="getBook"> 
   <wsdlsoap:operation soapAction="urn:getBook"/> 
   <wsdl:input name="getBookRequest"> 
    <wsdlsoap:body use="literal"/> 
   </wsdl:input> 
   <wsdl:output name="getBookResponse"> 
    <wsdlsoap:body use="literal"/> 
   </wsdl:output> 
  </wsdl:operation> 
  ... 
 </wsdl:binding> 
 
 <wsdl:service name="MetroLibrary"> 
  <wsdl:port binding="wns:LibrarySoapBinding" name="library"> 
   <wsdlsoap:address location="http://localhost:8080/metro-library-username"/> 
  </wsdl:port> 
 </wsdl:service> 
  
 <!-- Policy for first signing and then encrypting all messages, with the certificate 
  included in the message from client to server but only a thumbprint on messages from 
  the server to the client. --> 
 <wsp:Policy wsu:Id="SignEncr" xmlns:wsu= 
   "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> 
  <wsp:ExactlyOne> 
   <wsp:All> 
    <sp:AsymmetricBinding 
      xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> 
     <wsp:Policy> 
      <sp:InitiatorToken> 
       <wsp:Policy> 
        <sp:X509Token sp:IncludeToken=".../IncludeToken/AlwaysToRecipient"> 
         <!-- Added this policy component so Metro would work with the same 
          certificates (and key stores) used in the Axis2/Rampart example. --> 
         <wsp:Policy> 
          <sp:RequireThumbprintReference/> 
         </wsp:Policy> 
        </sp:X509Token> 
       </wsp:Policy> 
      </sp:InitiatorToken> 
      <sp:RecipientToken> 
       <wsp:Policy> 
        <sp:X509Token sp:IncludeToken=".../IncludeToken/Never"> 
         <wsp:Policy> 
          <sp:RequireThumbprintReference/> 
         </wsp:Policy> 
        </sp:X509Token> 
       </wsp:Policy> 
      </sp:RecipientToken> 
      <sp:AlgorithmSuite> 
       <wsp:Policy> 
        <sp:TripleDesRsa15/> 
       </wsp:Policy> 
      </sp:AlgorithmSuite> 
      <sp:Layout> 
       <wsp:Policy> 
        <sp:Strict/> 
       </wsp:Policy> 
      </sp:Layout> 
      <sp:IncludeTimestamp/> 
      <sp:OnlySignEntireHeadersAndBody/> 
     </wsp:Policy> 
    </sp:AsymmetricBinding> 
    <sp:SignedParts 
      xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> 
     <sp:Body/> 
    </sp:SignedParts> 
    <sp:EncryptedParts 
      xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> 
     <sp:Body/> 
    </sp:EncryptedParts> 
   </wsp:All> 
  </wsp:ExactlyOne> 
 </wsp:Policy> 
 
</wsdl:definitions>

上一页  3 4 5 6 7 8 9 10  下一页

Tags:Java Web 服务

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