WCFは初めてですが、過去のWSE*パラダイムに精通しています。WCFの構成可能性(読み取り:複雑さ)は非常に難しいと感じています。
.NET 4.0 WCFクライアントを使用して、WebSphere Application Server/6.1で実行される政府が提供するWebサービスを利用しようとしています。
彼らのスキームは、UsernameTokenを使用して、HTTPSトランスポート暗号化を介したSAMLアサーションを認証および交換します。このSAMLアサーションは、サービスの残りの操作に使用されます。
「ログイン」しようとすると(つまり、SAMLアサーションを取得しようとすると)、WCFが戻りSOAPを処理しようとすると、次の例外が発生します。
「'System.IdentityModel.Tokens.SamlSecurityToken'トークンタイプのトークンオーセンティケーターが見つかりません。現在のセキュリティ設定では、そのタイプのトークンを受け入れることができません。」
これが私の設定ファイルです:
<system.serviceModel>
<client>
<endpoint binding="basicHttpBinding"
bindingConfiguration="Default"
contract="ServiceProxy.Login"
name="Login" />
</client>
<bindings>
<basicHttpBinding>
<binding name="Default">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None"/>
<message clientCredentialType="UserName" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
SOAPリクエストは次のとおりです。
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<!-- Removed -->
<ActivityId CorrelationId="c9363270-1b33-4ffe-90b0-427feebcebf6" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">cadd6a3c-7b36-46eb-9130-390227effc08</ActivityId>
<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="_0">
<u:Created>2012-12-13T22:50:22.308Z</u:Created>
<u:Expires>2012-12-13T22:55:22.308Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-91607d82-da2c-4004-93b6-baf5973ba057-1">
<o:Username>
<!-- Removed-->
</o:Username>
<o:Password>
<!-- Removed-->
</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<LoginRequest xmlns="http://snipped.url/Services.xsd"></LoginRequest>
</s:Body>
</s:Envelope>
そして、これがWCFを窒息させる応答です。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<!-- Removed -->
<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:mustUnderstand="1">
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" AssertionID="id-94ef81a2eba3b246e284f72c3313e32ababe9482" IssueInstant="2012-12-13T22:50:23.930Z" Issuer="http://www.forumsys.com/sentry" MajorVersion="1" MinorVersion="1">
<saml:Conditions NotBefore="2012-12-13T22:50:23.930Z" NotOnOrAfter="2012-12-14T08:50:23.930Z"></saml:Conditions>
<saml:AuthenticationStatement AuthenticationInstant="2012-12-13T22:50:23.930Z" AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password">
<saml:Subject>
<saml:NameIdentifier>
<!-- Removed-->
</saml:NameIdentifier>
<saml:SubjectConfirmation>
<saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</saml:ConfirmationMethod>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:SubjectLocality>
<!-- Removed-->
</saml:SubjectLocality>
</saml:AuthenticationStatement>
<saml:AttributeStatement>
<saml:Subject>
<saml:NameIdentifier>
<!-- Removed-->
</saml:NameIdentifier>
<saml:SubjectConfirmation>
<saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</saml:ConfirmationMethod>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Attribute AttributeName="SMSESSION" AttributeNamespace="http://www.forumsys.com/sentry">
<saml:AttributeValue>
<!-- Removed-->
</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
<u:Timestamp xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" u:Id="_0">
<u:Created>2012-12-13T22:50:22.308Z</u:Created>
<u:Expires>2012-12-13T22:55:22.308Z</u:Expires>
</u:Timestamp>
<o:UsernameToken xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" u:Id="uuid-91607d82-da2c-4004-93b6-baf5973ba057-1">
<o:Username>
<!-- Removed-->
</o:Username>
<o:Password>
<!-- Removed-->
</o:Password>
</o:UsernameToken>
</o:Security>
</soapenv:Header>
<soapenv:Body>
<wn1:LoginResponse xmlns:wn1="http://snipped.url/Services.xsd">
<wn1:Status>session counter updated</wn1:Status>
</wn1:LoginResponse>
</soapenv:Body>
</soapenv:Envelope>
上記の応答は成功した応答であり、WSE2 / 3で実行されている以前のバージョンと一致します(他の理由で、今後は使用できません)。
WCFに上記の応答を有効であると認めさせるにはどうすればよいですか?あるいは、解析できないという事実を無視して、手動で解析できるようにするためかもしれません。
困った!
更新#1:
カスタムクライアントのクレデンシャルルートをたどり始めました。少し複雑だとしても、これは有望に思えました。
このルートに行きたいなら...
1)ここでMSの記事シリーズを参照してください:http://msdn.microsoft.com/en-us/library/ms730868 (v = vs.100).aspx
2)WCFサンプルWCF \ Extensions \ Security\SamlTokenProviderも参照してください。
3)この方法を使用したブログ投稿:http://bronumski.blogspot.com/2011/11/this-has-been-hanging-around-in-my.html
これにより、WIFなしでSAMLアサーションを使用できるようになります。
更新#2:
以下の私の答えと究極の解決策を参照してください。