2011-03-18 26 views
3

編輯: 我認爲唯一需要理解的是使用username token profile簽署消息。任何關於如何實施的指針/線索/信息都會很棒。我打了與Visual Studio .NET 2003與WSE 2和用戶名令牌信息樣品做這個是默認 - 所以我的回退是使用,但更喜歡在Linux上運行,因爲這是我們擁有的服務器。加上沒有單一的WSE端口。我得到的印象是,這是不常用/其棄用......我需要發送此消息的SOAP/WS-Security/WS-Addressing/etc的哪些位

我必須跟一個Web服務,並已獲得下面的示例。我想譯成英語......或至少明白其中要看着傳達給它,我需要的WS安全規範的位。

我使用其他WS調用的Ruby/Savon,但它似乎只支持基本的WSSE,用戶名/密碼。

我可以看到這條消息有一個簽名 - 但它是通過外部文件/證書/代碼簽署還是我有足夠的細節在我的代碼中做相同的簽名。

我沒有看到任何X509或Cipher條目似乎暗示它沒有用這樣的證書(在我的天真的理解),所以什麼是用來產生簽名 - 也許只是一個簡單的哈希散列?

這也似乎使用某種消化/消息的檢查,當我嘗試調整樣本和重新發送它,它的反彈是無效的 - 儘管我猜這可能與簽名問題...

我不認爲莎翁支持這一點,所以我想我需要切換到JRuby和使用Java WS庫,或許RampartAxis2也許Spring security位。任何提示/ reccomendation /好教程?我看到this from IBM,但想我需要一些更高級別的,所以我可以把握「大局」

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 

    <soap:Header> 
    <wsa:Action wsu:Id="Id-6762c167-412b-4bf8-8839-518e9bc25da5"> 
    http://host/path/func</wsa:Action> 
    <wsa:MessageID wsu:Id="Id-00bb0af8-232d-43a8-adbb-39f230599c56"> 
    uuid:2005639d-39b8-4df6-bf41-e18741c45291</wsa:MessageID> 
    <wsa:ReplyTo wsu:Id="Id-c53a1dbe-244f-46a9-b656-883f4b06dcfe"> 
     <wsa:Address> 
     http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address> 
    </wsa:ReplyTo> 
    <wsa:To wsu:Id="Id-017877f6-e5a3-43ae-aa2b-4886adb7060c"> 
    http://host/path/func.asmx</wsa:To> 
    <wsse:Security soap:mustUnderstand="1"> 
     <wsu:Timestamp wsu:Id="Timestamp-1a38d0f9-077f-4e95-991b-fa899a171920"> 

     <wsu:Created>2011-03-14T15:00:09Z</wsu:Created> 
     <wsu:Expires>2011-03-14T15:05:09Z</wsu:Expires> 
     </wsu:Timestamp> 
     <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
     wsu:Id="SecurityToken-42ae32d2-f6ff-431e-9369-7696b44965e3"> 
     <wsse:Username>crypteduser</wsse:Username> 
     <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"> 
     cryptedpass</wsse:Password> 
     <wsse:Nonce>fLSoqLm9kuOumxy39JRHaw==</wsse:Nonce> 
     <wsu:Created>2011-03-14T15:00:09Z</wsu:Created> 
     </wsse:UsernameToken> 
     <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> 
     <SignedInfo> 
      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" 
      xmlns:ds="http://www.w3.org/2000/09/xmldsig#" /> 
      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1" /> 
      <Reference URI="#Id-6762c167-412b-4bf8-8839-518e9bc25da5"> 

      <Transforms> 
       <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
      </Transforms> 
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
      <DigestValue>SAYl5o1kh33HteOe0L7G6KIKqWg=</DigestValue> 
      </Reference> 
      <Reference URI="#Id-00bb0af8-232d-43a8-adbb-39f230599c56"> 

      <Transforms> 
       <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
      </Transforms> 
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
      <DigestValue>//LMuFkNC1FO1/9A9W7l6o75Y2M=</DigestValue> 
      </Reference> 
      <Reference URI="#Id-c53a1dbe-244f-46a9-b656-883f4b06dcfe"> 

      <Transforms> 
       <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
      </Transforms> 
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
      <DigestValue>9pgN7bU48UKi1UTnpOCikOnp2G0=</DigestValue> 
      </Reference> 
      <Reference URI="#Id-017877f6-e5a3-43ae-aa2b-4886adb7060c"> 

      <Transforms> 
       <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
      </Transforms> 
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
      <DigestValue>lWZNjtSHfVtiZeOFZAosV868Uos=</DigestValue> 
      </Reference> 
      <Reference URI="#Timestamp-1a38d0f9-077f-4e95-991b-fa899a171920"> 

      <Transforms> 
       <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
      </Transforms> 
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
      <DigestValue>H3nYPY6kfIWEIWQhpwaz8VKeQIM=</DigestValue> 
      </Reference> 
      <Reference URI="#Id-f95dfea2-3af8-4e95-8e60-141858db9532"> 

      <Transforms> 
       <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
      </Transforms> 
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
      <DigestValue>uRTu+Hzxw+zdaTYgW0z+j35diIQ=</DigestValue> 
      </Reference> 
     </SignedInfo> 
     <SignatureValue> 
     Hdn2wxWhmr450pefMuc41o6GgOA=</SignatureValue> 
     <KeyInfo> 
      <wsse:SecurityTokenReference> 
      <wsse:Reference URI="#SecurityToken-42ae32d2-f6ff-431e-9369-7696b44965e3" 
      ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken" /> 
      </wsse:SecurityTokenReference> 
     </KeyInfo> 
     </Signature> 
    </wsse:Security> 
    </soap:Header> 
    <soap:Body wsu:Id="Id-f95dfea2-3af8-4e95-8e60-141858db9532"> 
    <func xmlns="http://host/path/"> 
     <xml_in>yucky xml inside xml...</xml_in> 
    </func> 
    </soap:Body> 
</soap:Envelope> 

非常感謝提前任何提示/指針,你可以給。

的問候, 克里斯

編輯

似乎與此類似的問題...這確實使用X509證書,因此,也許它需要的。 目前閱讀wikipedia entry這一點。

EDIT2

看起來似乎這樣的 - 希望基於用戶名選項... http://msdn.microsoft.com/en-us/library/ms824647.aspx

EDIT3

我想我有大部分sorted now - 優秀更主要的是用戶名摘要」 ING。如何做到這一點 - 哪裏簽名值來自...

EDIT4

思考我的最好的辦法是在.NET中編寫客戶端,要麼會給我足夠的線索,以直接做在Ruby,或者我可以用更簡單的版本來包裝它 - 至少在短期內......

+1

歡迎來到一個痛苦的世界;讓OSS SOAP實現與MS良好地配合並不像應該那樣容易。檢查WSO2,他們支持這種Java/MS SOAP互操作... – maerics 2011-04-18 22:09:55

+0

想到我可能必須這樣 - 但這似乎相當安靜太/不支持:( – 2011-04-18 22:14:20

+0

你有沒有試過簡單地使用「添加服務引用「指向WSDL?發生了什麼? – 2011-04-21 16:06:54

回答

1

這不是一個完整的答案,但只是我注意到的一些事情。

的的wsse:SecurityTokenReference指本文件(在隱蔽排序的皁方式):http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0.pdf

我將讀取通過:3.2令牌參考

此外,父節提到了這一點式:

Password_Digest = Base64 (SHA-1 (nonce + created + password)) 

也許嘗試這樣的簽名?

Password_Digest = Base64 (SHA-1 (nonce + created + UsernameToken)) 
+0

謝謝,儘管我認爲這涉及到密碼文本本身的消化--Savon現在處理這個問題,我正在使用用戶名/密碼位來消化更廣泛的消息的部分內容,就像您使用證書一樣。 – 2011-04-19 06:17:27

相關問題