2009-09-08 52 views
2

以下是在Microsoft Service Trace Viewer中记录的消息。我相信它代表一个无参数方法的单个调用,该方法在WCF服务(带有WsHttpBinding)上具有整数返回值。我正在使用消息级别的安全性(使用用户名凭证)并创建了一个开发服务器证书以使其发挥作用。我对标题中的开销量感到困惑。有没有人见过这个?我甚至不确定我是否在看正确的事情。我打算在每次调用时都使用它,并且我希望在同一服务的后续方法调用中,开销会减少,但似乎并非如此。使用邮件安全性时的WS-Security开销

我试图通过SSL创建一个Login()方法,而不是对用户进行身份验证,并返回一个将被传递以验证后续请求的GUID,并且每个GUID都有一个过期策略。直觉上我认为这可能是一个坏主意但我是一名安全人员,所以我不确定。

任何建议表示赞赏。

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> 
<s:Header> 
<a:Action s:mustUnderstand="1" u:Id="_2" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">http://tempuri.org/IWsAppointmentService/GetTest</a:Action> 
<a:MessageID u:Id="_3" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:d83df40a-979b-440c-9292-7a5a84a64ecd</a:MessageID> 
<a:ReplyTo u:Id="_4" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing"> 
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> 
</a:ReplyTo> 
<a:To s:mustUnderstand="1" u:Id="_5" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">http://localhost:8731/service/ws</a:To> 
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
<u:Timestamp u:Id="uuid-169b0950-217e-48af-9057-ea832e0c7e19-14" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<u:Created>2009-09-08T14:08:36.224Z</u:Created> 
<u:Expires>2009-09-08T14:13:36.224Z</u:Expires> 
</u:Timestamp> 
<c:SecurityContextToken u:Id="uuid-95cdaf11-3974-4cc0-93a8-a3d2191bbef4-5" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<c:Identifier>urn:uuid:3b6a325b-a4e1-478a-92a7-108dd3f94adb</c:Identifier> 
</c:SecurityContextToken> 
<c:DerivedKeyToken u:Id="uuid-169b0950-217e-48af-9057-ea832e0c7e19-9" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<o:SecurityTokenReference> 
<o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-95cdaf11-3974-4cc0-93a8-a3d2191bbef4-5"></o:Reference> 
</o:SecurityTokenReference> 
<c:Offset>0</c:Offset> 
<c:Length>24</c:Length> 
<c:Nonce> 
<!-- Removed--> 
</c:Nonce> 
</c:DerivedKeyToken> 
<c:DerivedKeyToken u:Id="uuid-169b0950-217e-48af-9057-ea832e0c7e19-10" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<o:SecurityTokenReference> 
<o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-95cdaf11-3974-4cc0-93a8-a3d2191bbef4-5"></o:Reference> 
</o:SecurityTokenReference> 
<c:Nonce> 
<!-- Removed--> 
</c:Nonce> 
</c:DerivedKeyToken> 
<e:ReferenceList xmlns:e="http://www.w3.org/2001/04/xmlenc#"> 
<e:DataReference URI="#_1"></e:DataReference> 
<e:DataReference URI="#_6"></e:DataReference> 
</e:ReferenceList> 
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> 
<SignedInfo> 
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod> 
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"></SignatureMethod> 
<Reference URI="#_0"> 
<Transforms> 
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform> 
</Transforms> 
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> 
<DigestValue>NnVRkY+ZVgWd4qfBs3jtjxAf9m4=</DigestValue> 
</Reference> 
<Reference URI="#_2"> 
<Transforms> 
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform> 
</Transforms> 
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> 
<DigestValue>+DXYZ0w5aRfe1m+owuJXfYnT4TU=</DigestValue> 
</Reference> 
<Reference URI="#_3"> 
<Transforms> 
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform> 
</Transforms> 
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> 
<DigestValue>OCiMrL9/sZLY3qMANeBgpmmPTHQ=</DigestValue> 
</Reference> 
<Reference URI="#_4"> 
<Transforms> 
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform> 
</Transforms> 
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> 
<DigestValue>l6mMmQ2LE9VFtjaA6Qc4GKBXURw=</DigestValue> 
</Reference> 
<Reference URI="#_5"> 
<Transforms> 
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform> 
</Transforms> 
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> 
<DigestValue>gwaCnZv9JZtGrNhF6q8l2qIptMU=</DigestValue> 
</Reference> 
<Reference URI="#uuid-169b0950-217e-48af-9057-ea832e0c7e19-14"> 
<Transforms> 
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform> 
</Transforms> 
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> 
<DigestValue>i6m9Hb2aKQPRshhSqEpESJJASQg=</DigestValue> 
</Reference> 
</SignedInfo> 
<SignatureValue>lo3sUvYlRiCCfag3kesKx9LFpHU=</SignatureValue> 
<KeyInfo> 
<o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
<o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#uuid-169b0950-217e-48af-9057-ea832e0c7e19-9"></o:Reference> 
</o:SecurityTokenReference> 
</KeyInfo> 
</Signature> 
</o:Security> 
</s:Header> 
<s:Body u:Id="_0" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<GetTest xmlns="http://tempuri.org/"></GetTest> 
</s:Body> 
</s:Envelope> 

回答

4

没有人声称使用wsHttpBinding是一个好主意! ;-)

wsHttpBinding实现了这些WS- *标准的全部 - 而且它们并不便宜!

通常,如果你在企业防火墙后面,我推荐使用netTcp。大多数情况下,当你面对面向公共服务的互联网时,使用basicHttpBinding或webHttpBinding(REST)会更好。

你可以调整的wsHttpBinding,当然 - 关闭会话,关闭安全功能等

但最终,你必须要问自己:是创建这样一个登录方案的努力,管理一生这些“会话GUID”,以及所有这些可能出错的各种方式(GUID到期很快,GUID被欺骗等)真的值得吗?是的,当然 - 信息大小只有几kb - 但是真的是很重要吗?真的吗?

不要在错误的地方进行优化 - 使用当今的技术,许多这种“直觉感知优化”确实不值得麻烦和开发工作,以便在每次调用时“优化”几kb可能会大大高于来回传输几个kb的任何性能损失。

想一想吧!

Marc

+0

thanks marc_s,much appreciate – 2009-09-09 08:15:10