2011-03-18 40 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