Share via


FedUtil を使用した WCF 証明書利用者サービスから STS への信頼の確立

Windows® Identity Foundation (WIF) には、FedUtil.exe が用意されています。 これは、証明書利用者 (RP) アプリケーションからセキュリティ トークン サービス (STS) に対して信頼を確立するのに役立ちます。 これには次の機能があります。

  • 既存の運用 STS を RP アプリケーションの信頼された発行者として登録する。

  • ローカル STS を提供して、要求に対応するアプリケーションの開発を支援する。

  • 既存のアプリケーションを要求に対応させる。

  • RP アプリケーションのフェデレーション メタデータを更新する。

  • RP アプリケーションのフェデレーション メタデータの自動更新をスケジュールする。

以降のセクションでは、FedUtil を使用してこれらの各タスクを実行する方法について説明します。 これらのタスクは、RP アプリケーションの web.config ファイルに手動で FedUtil と同じ変更を加えることでも実行できます。

FedUtil を使用して WCF RP から STS に対して信頼を確立するのは、ASP.NET RP から STS に対して信頼を確立するのとは、構成するサービス エンドポイントを指定し、暗号化を有効にする必要があるという点で異なります。

注意

FedUtil によって構成ファイルが変更されるため、アプリケーションの既存のセキュリティ構成が変更されることがあります。 必要のない既存のセクションは削除されずにコメント アウトされますが、FedUtil の実行後に構成ファイルを開いて、アプリケーションが依存しているすべてのセキュリティ構成がコメント アウトされていないことを確認してください。 また、FedUtil では既存の構成ファイルのバックアップも行われます。

1. ローカル STS の作成

ここでは、要求に対応する WCF サービスと共に使用するローカル STS を作成します。 これを行うには、Visual Studio 内から FedUtil を実行する必要があります。 この方法は、非運用 STS を使用して WCF アプリケーションをテストする場合に役立ちます。 運用 STS の使用に切り替える方法については、後で説明します。

注意

FedUtil が正常に機能するには、Visual Studio を管理者特権モードで実行する必要があります。

Visual Studio で、[ファイル] メニューを開き、[新規作成]、[Web サイト] の順に選択します。 要求に対応する WCF サービスを選択します。

次に、ソリューション エクスプローラーでプロジェクトを右クリックし、[STS 参照の追加] を選択します。

392cd2c5-5098-44c7-9738-f43e40da090f

この操作により、FedUtil ツールが実行されます。 FedUtil のダイアログが開き、[フェデレーション ユーティリティ ウィザードの開始] ページが表示されます。

35d73636-c363-47cf-a67f-16b3ca195d40

このページでは、2 つのフィールドへの入力が必要です。

  1. [アプリケーション構成の場所]: WCF サービスの web.config ファイルへのパスを指定します。 Visual Studio の外部から FedUtil を実行した場合、または Visual Studio でプロジェクトを開いていない状態で [ツール] メニューから FedUtil を実行した場合は、このフィールドは空の状態で表示されます。 Visual Studio でプロジェクトを右クリックして FedUtil を実行した場合、このフィールドにはそのプロジェクトの web.config ファイルへのパスが既に入力されています。 web.config ファイルが既に存在していて、既定の状態 (つまり、Visual Studio で生成されたままの状態) であることが必要です。 同一の web.config ファイルに対して FedUtil を複数回実行しても、web.config ファイルに追加する内容が上書きされるだけです。

  2. [アプリケーション URI]: WCF サービスの URI を指定します。 これは、.svc ファイルです。 Visual Studio の外部から FedUtil を実行した場合、または Visual Studio でプロジェクトを開いていない状態で [ツール] メニューから FedUtil を実行した場合は、このフィールドは空の状態で表示されます。 Visual Studio でプロジェクトを右クリックして FedUtil を実行した場合、このフィールドにはそのプロジェクトに対応する 2 つの URI が既に入力されています。その一方は localhost を使用し、もう一方はコンピューターの完全修飾ドメイン名を使用します (使用できる場合)。 この URI は、要求に対応するアプリケーションの構成時に領域の値として使用されます。 また、1 つ目の対象ユーザー URI としても使用されます。 対象ユーザー URI を追加するには、手動で指定する必要があります。 URI がセキュリティで保護されていない場合 (つまり "https://" で始まる URI でない場合)、[次へ] をクリックすると警告が表示されます。

情報を入力したら、[次へ] をクリックします。 [アプリケーション情報] ページが表示されます。

c869d84f-313b-436c-800c-48570365b607

構成するサービスの名前とエンドポイントのコントラクトの名前を選択し、[次へ] をクリックします。 サービスに複数のエンドポイントがあり、特定のエンドポイントに対してのみ要求を構成する場合は、対象のエンドポイントを選択します。

[Security Token Service] ページで、[現在のソリューション内に新しい STS プロジェクトを作成する] を選択します。

99a1a9de-cdf0-4a4a-96cb-ed23e64dade5

Visual Studio の外部から FedUtil を実行した場合、または Visual Studio でプロジェクトを開いていない状態で [ツール] メニューから FedUtil を実行した場合は、[現在のソリューション内に新しい STS プロジェクトを作成する] を使用できません。

[次へ] をクリックします。 [概要] ページが表示されます。

b8770d17-c106-4567-9eec-a82dff94c093

[概要] ページには、[アプリケーション情報] ダイアログに入力した情報、選択したサービスとエンドポイント、新しい STS を作成するように選択したという情報、アプリケーションからの要求、および FedUtil によってアプリケーションの構成に加えられる変更内容が表示されます。

[完了] をクリックします。

web.config ファイルを開くと、FedUtil によって変更されていることを確認できます。

  • <configuration>/<configSections> 要素には、IdentityModel 構成セクションへの参照が含まれています。

    <section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    
  • 次のアプリケーション設定が追加されます。

    <appSettings> <add key="FederationMetadataLocation" value="C:\inetpub\wwwroot\ClaimsAwareService1_STS\FederationMetadata\2007-06\FederationMetadata.xml" /> </appSettings>
    
  • すべてのユーザーに、フェデレーション メタデータへのアクセス権が付与されます。

    <location path="FederationMetadata"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
    
  • <system.Web>/<assemblies> 要素には、Microsoft.IdentityModel.dll アセンブリへの参照が含まれています。

    <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    
  • <system.serviceModel> 要素では、FedUtil で選択したサービスに新しいエンドポイントが含まれていることを確認できます。

    <services> <service name="Service" behaviorConfiguration="ServiceBehavior"> <endpoint address="https://localhost:54280/ClaimsAwareService1/Service.svc" binding="ws2007FederationHttpBinding" contract="ClaimsAwareService1.IService" bindingConfiguration="ClaimsAwareService1.IService_ws2007FederationHttpBinding" /> <!-- Service Endpoints --> <!--Commented out by FedUtil--> <!--<endpoint address="" binding="wsHttpBinding" contract="ClaimsAwareService1.IService"><identity><dns value="localhost" /></identity></endpoint>--> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services>
    
  • <system.ServiceModel>/<behaviors>/<serviceBehavior>/<behavior> 要素には、FedUtil で選択したサービスを参照する <federatedServiceHostConfiguration /> 要素が含まれています。 これによって、サービスが要求に対応するように構成されます。

    <behaviors> <serviceBehaviors> <behavior name="ClaimsAwareService1.ServiceBehavior" > <!-- Behavior extension to make the service claims aware --> <federatedServiceHostConfiguration name="ClaimsAwareService1.Service" /> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata  httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors>
    
  • <system.ServiceModel>/<behaviors>/<serviceBehavior>/<behavior> 要素には、ローカル コンピューター上にあるテスト証明書を参照する <serviceCredentials> 要素も含まれています。

    <serviceCredentials> <!--Certificate added by FedUtil.  Subject='CN=DefaultApplicationCertificate', Issuer='CN=DefaultApplicationCertificate'.--> <serviceCertificate findValue="48BF03FCEDA703DE09E0F1F0CEFED60BB92B3DD8" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" /> </serviceCredentials>
    
  • <system.serviceModel> 要素には、WCF サービスが必要とする要求を一覧表示する <bindings> 要素が含まれています。

    <bindings> <ws2007FederationHttpBinding> <binding name="ClaimsAwareService1.IService_ws2007FederationHttpBinding"> <security mode="Message"> <message> <issuerMetadata address="https://localhost:54908/ClaimsAwareService1_STS/Service.svc/mex" /> <claimTypeRequirements> <!--Following are the claims offered by STS 'https://localhost:54908/ClaimsAwareService1_STS/Service.svc'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.--> <add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isOptional="true" /> <add claimType="https://schemas.microsoft.com/ws/2008/06/identity/claims/role" isOptional="true" /> </claimTypeRequirements> </message> </security> </binding> </ws2007FederationHttpBinding> </bindings>
    
  • 最後に、<configuration> 要素には、信頼できるトークン プロバイダーとしてローカル STS を指定する Microsoft.IdentityModel の構成セクションが含まれています。

    <microsoft.identityModel> <service name="ClaimsAwareService1.Service"> <audienceUris> <add value="https://localhost:54904/ClaimsAwareService1/Service.svc" /> </audienceUris> <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <trustedIssuers> <add thumbprint="0E2A9EB75F1AFC321790407FA4B130E0E4E223E2" name="CN=STSTestCert" /> </trustedIssuers> </issuerNameRegistry> </service> </microsoft.identityModel>
    

    STS が発行するトークンに署名するときに使用する証明書を指定する、<issuerNameRegistry>/<trustedIssuers> 要素が追加されます。 STS は既定の証明書を使用して、生成するトークンに署名します。 この証明書の名前は "STSTestCert" で、STS で使用するために証明書ストアに自動的に追加されます。 証明書ファイルは STS プロジェクト内にあります。 ファイルのパスワードは "STSTest" です。 これは、運用時には使用しないでください。 既定の証明書を任意の他の証明書に変更することができます。 IIS プロセスのユーザーがその証明書の秘密キーにアクセスできることを確認してください。 また、IssuerNameRegistry の派生型を作成して、信頼できる発行者の証明書の検証もプログラムで実行します。

さらに、ソリューション エクスプローラーでは、FedUtil によって、ソリューションに新しいプロジェクトが追加されていることを確認できます。 このプロジェクトはローカル STS です。 また、フェデレーション メタデータ ドキュメントが証明書利用者アプリケーションとローカル STS の両方に追加されています。

09caaebd-80f7-4904-ad9a-846cff4ab403

2. 既存の運用 STS の登録

ここでは、要求に対応する WCF サービスに、運用 STS を暗号化と組み合わせて使用します。 ASP.NET 証明書利用者アプリケーションとは異なり、WCF サービスでは暗号化を使用する必要があります。

Visual Studio で、[ファイル] メニューを開き、[新規作成]、[Web サイト] の順に選択します。 WCF サービスを選択します。 ソリューション エクスプローラーでプロジェクトを右クリックし、[STS 参照の追加] を選択します。 この操作により、FedUtil ツールが実行されます。 [フェデレーション ユーティリティ ウィザードの開始] ページに表示された [アプリケーション構成の場所] と [アプリケーション URI] が正しいことを確認し、[次へ] をクリックします。

[アプリケーション情報] ページで、構成するサービスの名前とエンドポイントのコントラクトの名前を選択し、[次へ] をクリックします。

[Security Token Service] ページの [既存の STS を使う] をクリックします。

796877b1-af1b-465a-a6ff-0ea20726d834

運用 STS のフェデレーション メタデータ エンドポイントの場所を指定する必要があります。 [場所のテスト] をクリックすると、場所が正しいかどうかを確認できます。 このボタンをクリックすると、指定されたエンドポイントに対する要求が実行され、既定の Web ブラウザーにその応答が表示されます。 STS を指定したら、[次へ] をクリックします。

ローカルの証明書ストアで信頼されていない証明書を使用する STS を指定すると、"ID1025: 証明書チェーンは処理されましたが、信頼プロバイダーによって信頼されていないルート証明書で強制終了されました。" という警告メッセージが表示されます。 そのまま続行する場合は [はい] をクリックします。 続行しない場合は [いいえ] をクリックし、別の STS を選択します。

別の [アプリケーション情報] ページが表示されます。ここで、[暗号化しない] または [暗号化を有効にする] を選択するよう求められます。

5cf3d371-369d-45a7-811a-93621415baaf

注意

WCF サービスに対して FedUtil を実行する場合は、暗号化を有効にする必要があります。 そうしないと、エラー メッセージが表示されます。

[暗号化を有効にする] をクリックします。 次に、サービスが STS との通信を暗号化するために使用する証明書を選択する必要があります。

既定の証明書を使用すると、暗号化するトークンの証明書がローカル STS によって既に作成されている場合は、同じ証明書が暗号化解除のために再び使用されます。 運用 STS ではローカル STS で使用されたものと同じ証明書を使用する可能性が低いため、運用 STS の登録の場合、これはあまり一般的な操作ではありません。 運用ソリューションでは、このオプションを使用しないでください。 サービス証明書が既にある場合は、同じ証明書を使用できます。

既存の証明書を選択する場合、FedUtil によってローカルの証明書ストア内にある証明書が表示されます。 証明書に、秘密キーとサブジェクト名が設定されている必要があります。

ここでは、既定の証明書を使用することも、既存の証明書を選択することもできます。 どちらかを選択したら [次へ] をクリックします。

[提供される要求] ページが表示されます。

4adec48c-5d53-4fc8-9917-21df43488fb9

ここには、STS によって提供される要求の一覧が示されます。 FedUtil は STS からメタデータをダウンロードし、解析して、この一覧を取得します。 既定では、FedUtil は、要求に対応する WCF サービスで名前要求と役割要求のみが必要となるように構成します。 これ以外の要求を必要とするサービスの構成方法については、「How to Configure Your Application to Require Additional Claims (追加の要求を必要とするアプリケーションの構成方法)」を参照してください。 サービスで必要な要求が STS で提供されていない場合は、STS 管理者に連絡して同意を得る必要があります。

[次へ] をクリックします。 [概要] ページが表示されます。

e85e0f45-133f-4aff-b916-0509e25718b0

[概要] ページには、[アプリケーション情報] ダイアログに入力した情報、選択したサービスとエンドポイント、既存の STS を使用するように選択したという情報、暗号化を有効にしたかどうか、アプリケーションからの要求、および FedUtil によってアプリケーションの構成に加えられる変更内容が表示されます。

テスト証明書を選択した場合は、アプリケーション情報に "選択されたアプリケーション証明書: サブジェクトの名前が 'CN=DefaultApplicationCertificate' の新しい証明書が個人ストアおよび信頼されている人の証明書ストアに追加されます (この証明書が存在していない場合)。" という文章が含まれています。 既存の証明書を選択した場合は、その証明書の拇印が表示されます。

また、[概要] ページには、[このアプリケーションのメタデータの更新を毎日実行するようにスケジュールする] というチェック ボックスもあります。 このチェック ボックスをオンにすると、FedUtil によって、アプリケーションのメタデータを毎日真夜中に更新するタスクがスケジュールされます。 詳細については「FedUtil を使用する信頼管理の実行方法」を参照してください。

[完了] をクリックします。

web.config ファイルを開くと、FedUtil によって変更されていることを確認できます。

  • <configuration>/<configSections> 要素には、IdentityModel 構成セクションへの参照が含まれています。

    <section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    
  • 次のアプリケーション設定が追加されます。 "specified STS" は FedUtil で指定した STS を表します。

    <appSettings> <add key="FederationMetadataLocation" value="<specified STS>" /> </appSettings>
    
  • すべてのユーザーに、フェデレーション メタデータへのアクセス権が付与されます。

    <location path="FederationMetadata"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
    
  • <system.Web>/<assemblies> 要素には、Microsoft.IdentityModel.dll アセンブリへの参照が含まれています。

    <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    
  • <system.serviceModel> 要素では、FedUtil で選択したサービスに、WS-Federation HTTP バインディングを使用する新しいエンドポイントが含まれていることを確認できます。

    <services> <service name="Service" behaviorConfiguration="ServiceBehavior"> <endpoint address="https://localhost:54280/ClaimsAwareService2/Service.svc" binding="ws2007FederationHttpBinding" contract="ClaimsAwareService2.IService" bindingConfiguration="ClaimsAwareService2.IService_ws2007FederationHttpBinding" /> <!-- Service Endpoints --> <!--Commented out by FedUtil--> <!--<endpoint address="" binding="wsHttpBinding" contract="ClaimsAwareService2.IService"><identity><dns value="localhost" /></identity></endpoint>--> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services>
    
  • <system.ServiceModel>/<behaviors>/<serviceBehavior>/<behavior> 要素には、FedUtil で選択したサービスを参照する <federatedServiceHostConfiguration /> 要素が含まれています。 これによって、サービスが要求に対応するように構成されます。

    <behaviors> <serviceBehaviors> <behavior name="ClaimsAwareService2.ServiceBehavior" > <!-- Behavior extension to make the service claims aware --> <federatedServiceHostConfiguration name="ClaimsAwareService2.Service" /> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata  httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors>
    
  • <system.ServiceModel>/<behaviors>/<serviceBehavior>/<behavior> 要素には、ローカル コンピューター上にあるテスト証明書を参照する <serviceCredentials> 要素も含まれています。 これは FedUtil で指定した証明書です。

    <serviceCredentials> <!--Certificate added by FedUtil.  Subject='CN=DefaultApplicationCertificate', Issuer='CN=DefaultApplicationCertificate'.--> <serviceCertificate findValue="48BF03FCEDA703DE09E0F1F0CEFED60BB92B3DD8" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" /> </serviceCredentials>
    
  • <system.serviceModel> 要素には、WCF サービスが必要とする要求を一覧表示する <bindings> 要素が含まれています。 "specified STS" は FedUtil で指定した STS を表します。

    <bindings> <ws2007FederationHttpBinding> <binding name="ClaimsAwareService2.IService_ws2007FederationHttpBinding"> <security mode="Message"> <message> <issuerMetadata address="https://<specified STS>/Trust/Mex" /> <claimTypeRequirements> <!--Following are the claims offered by STS '<specified STS>'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.--> <add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isOptional="true" /> <add claimType="https://schemas.microsoft.com/ws/2008/06/identity/claims/role" isOptional="true" /> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/CommonName" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/EmailAddress" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/Group" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/UPN" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/webpage" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/title" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/picture" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/manager" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/department" isOptional="true" />--> </claimTypeRequirements> </message> </security> </binding> </ws2007FederationHttpBinding> </bindings>
    

    name 要求と role 要求以外のすべての要求はコメント アウトされています。 これ以外の要求を必要とするサービスの構成方法については、「How to Configure Your Application to Require Additional Claims (追加の要求を必要とするアプリケーションの構成方法)」を参照してください。

  • 最後に、<configuration> 要素には、信頼できるトークン プロバイダーとして運用 STS を指定する Microsoft.IdentityModel の構成セクションが含まれています。

    <microsoft.identityModel> <service name="ClaimsAwareService2.Service"> <audienceUris> <add value="https://localhost:54966/ClaimsAwareService2/Service.svc" /> </audienceUris> <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <trustedIssuers> <add thumbprint="5C8885A8E3D29D6BF6C9365E00B1BEA5EB284D1E" name="CN=<specified STS>, OU=US-Federated Identity, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" /> </trustedIssuers> </issuerNameRegistry> </service> </microsoft.identityModel>
    

FedUtil を繰り返し実行して、ローカル STS から運用 STS への切り替えと運用 STS からローカル STS への切り替えを行うことができます。 FedUtil を実行するたびに、以前に作成された構成が上書きされます。 ただし、FedUtil を使用して、ローカル STS または運用 STS を使用している状態から STS を使用しない状態に切り替えることはできません。

また、FedUtil を実行してローカル STS を作成し、その後に運用 STS へ切り替えると、構成ファイルの <issuerNameRegistry> 要素に 2 つの信頼できる発行者が設定されます。 一方がローカル STS、もう一方が運用 STS です。 アプリケーションを展開する準備が整ったら、発行者名レジストリからローカル STS を削除する必要があります。

3. フェデレーション メタデータの更新

既定では、FedUtil を使用して運用 STS を指定すると、FedUtil はアプリケーションで名前要求と役割要求のみが必要となるように構成します。 これは、アプリケーションの web.config ファイルの <claimTypeRequirements> 要素を見ることで確認できます。

<bindings> <ws2007FederationHttpBinding> <binding name="ClaimsAwareService2.IService_ws2007FederationHttpBinding"> <security mode="Message"> <message> <issuerMetadata address="https://<specified STS>/Trust/Mex" /> <claimTypeRequirements> <!--Following are the claims offered by STS 'http://<specified STS>/Trust'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.--> <add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isOptional="true" /> <add claimType="https://schemas.microsoft.com/ws/2008/06/identity/claims/role" isOptional="true" /> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/CommonName" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/EmailAddress" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/Group" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/claims/UPN" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/webpage" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/title" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/picture" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/manager" isOptional="true" />--> <!--<add claimType="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/department" isOptional="true" />--> </claimTypeRequirements> </message> </security> </binding> </ws2007FederationHttpBinding> </bindings>

たとえば、上のコード スニペットでは emailaddress 要求がコメント アウトされています。 アプリケーションで必要となる要求を追加して構成するには、必要な要求のコメントを解除します。 次に、ソリューション エクスプローラーでアプリケーション プロジェクトを右クリックし、[フェデレーション メタデータの更新] を選択します。

2890e94f-b760-419e-8399-2b974260d18a

FedUtil によってアプリケーションのフェデレーション メタデータが更新され、必要な要求の一覧に変更が反映されます。 後でアプリケーションの FederationMetadata.xml ファイルを開き、必要な要求の一覧が更新されていることを確認します。 このとき、アプリケーションの web.config ファイルでコメントを解除した要求が追加されているはずです。 FedUtil では、アプリケーションの web.config ファイルのバックアップ コピーを作成することもできます。

<fed:ClaimTypesRequested> <auth:ClaimType Uri="https://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" Optional="True" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706" /> <auth:ClaimType Uri="https://schemas.microsoft.com/ws/2008/06/identity/claims/role" Optional="True" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706" /> ... </fed:ClaimTypesRequested>

また、カスタム要求の種類をアプリケーションの web.config ファイルに追加することもできます。 この場合は、新しい要求の種類が発行されるようにアプリケーションに対応する STS ポリシーを更新するよう、STS 管理者に求める必要があります。