.NET4.5に含まれているWIFフレームワークを使用してSTSを作成しています。私はこのSTSを(今のところ)WSTrustServiceHost
クラスを使用してセルフホストしています。それをするために、私は次のことをしています:
var conf = new SecurityTokenServiceConfiguration("isser name here", true)
{
DisableWsdl = true,
SecurityTokenService = typeof(MyTokenService),
};
var ct = new WSTrustServiceContract(conf);
var host = new WSTrustServiceHost(ct);
host.Open();
// ...
ご覧のとおり、コンストラクターtrue
のloadConfig
パラメーターを渡しています。これは、ドキュメントに記載されています。SecurityTokenServiceConfiguration
構成ファイルから設定をロードする場合はtrue 。それ以外の場合はfalse。
構成ファイルにidentityConfiguration
要素がありますが、ロードされていないようです。構成ファイルに変更を加えることができます。変更することができますがsecurityTokenHandlers
、それらの変更は構築されたに反映されませんSecurityTokenServiceConfiguration
。
app.configファイルには、次のものがあります。
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="sts_behavior">
<serviceCredentials useIdentityConfiguration="true" identityConfiguration="the_issuer_id">
<serviceCertificate findValue="7A5D7EB05EC741E45BF4EDA7E574F58DC31EF290" x509FindType="FindByThumbprint" storeName="My" storeLocation="LocalMachine" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<ws2007HttpBinding>
<binding name="sts_binding">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</ws2007HttpBinding>
</bindings>
<services>
<service name="System.ServiceModel.Security.WSTrustServiceContract" behaviorConfiguration="sts_behavior">
<endpoint address="http://my-machine:54512/tokens" binding="ws2007HttpBinding" contract="System.ServiceModel.Security.IWSTrust13SyncContract" bindingConfiguration="sts_binding" />
</service>
</services>
</system.serviceModel>
ご覧のとおり、この要素は構成ファイルに存在する<serviceCredentials>
要素を参照しており、<identityConfiguration>
この名前をその要素と一致しないように変更すると<identityConfiguration>
、サービスホストを開いたときにエラーがスローされます。ただし、セキュリティトークンハンドラーを使用できるため、この<identityConfiguration>
要素はまだ使用されていません。また、リクエストが着信したときにトークンハンドラーが引き続き使用されます。<clear/>
最小限のプログラム構成でカスタムSTSを構成し、セルフホストするにはどうすればよいですか?