ClaimsAuthenticationManager クラス

定義

クレーム認証マネージャーの基本実装を定義します。 クレーム認証マネージャーは、実行がアプリケーション コードに到達する前に、処理ロジック (フィルター処理、検証、拡張機能) を受信プリンシパル内のクレームのコレクションに適用するための場所を、クレーム処理パイプラインに提供します。

public ref class ClaimsAuthenticationManager : System::IdentityModel::Configuration::ICustomIdentityConfiguration
public class ClaimsAuthenticationManager : System.IdentityModel.Configuration.ICustomIdentityConfiguration
type ClaimsAuthenticationManager = class
    interface ICustomIdentityConfiguration
Public Class ClaimsAuthenticationManager
Implements ICustomIdentityConfiguration
継承
ClaimsAuthenticationManager
実装

次のコードは、受信要求に対するチェックを実行せずに、受信プリンシパルにロール要求を追加する単純なクレーム認証マネージャーを示しています。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Security.Claims;

namespace MyClaimsAuthenticationManager
{
    class SimpleClaimsAuthenticatonManager : ClaimsAuthenticationManager
    {
        public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal)
        {
            if (incomingPrincipal != null && incomingPrincipal.Identity.IsAuthenticated == true)
            {
                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim(ClaimTypes.Role, "User"));
            }
            return incomingPrincipal; 
        }
    }
}

次の XML は、 要素を <claimsAuthenticationManager> 示しています。

<system.identityModel>  
  <identityConfiguration>  
    <claimsAuthenticationManager type="MyClaimsAuthenticationManager.SimpleClaimsAuthenticatonManager, MyClaimsAuthenticationManager" />  

    ...  

  </identityConfiguration>  
</system.identityModel>  

注釈

クレーム認証マネージャーは、アプリケーションの要求処理パイプラインに拡張ポイントを提供します。この機能拡張ポイントを使用すると、RP アプリケーション コードが実行される前に、 によって ClaimsPrincipal 提示された要求のセットに対して、検証、フィルター処理、変更、受信要求、または新しい要求の挿入を行うことができます。 RP アプリケーションで必要な場合は、 の ClaimsPrincipal カスタム実装を返すことさえできます。 クラスによって提供される既定の ClaimsAuthenticationManager 実装では、変更されていない の要求が ClaimsPrincipal 返されます。ただし、このクラスから派生し、 メソッドを Authenticate オーバーライドして 内の ClaimsPrincipal 要求を変更できます (または、カスタム ClaimsPrincipalを返す場合)。

カスタムクレーム認証マネージャーを作成する一般的な理由は、RP アプリケーションによってより適切に管理されている、またはによってのみ認識される情報に基づいて要求を追加、削除、または変換することです。 たとえば、ショッピング カート アプリケーションでの顧客購入の履歴は、RP アプリケーションによって管理されるデータ ベースに保持され、受信プリンシパルで見つかった名前要求の値に基づいてクレーム認証マネージャーによって返されるクレーム プリンシパルに追加される場合があります。

クラスを使用するか、claimsAuthenticationManager> 要素 (identityConfiguration 要素の子要素) を使用して<構成することで、プログラムで を使用ClaimsAuthenticationManagerIdentityConfigurationするようにアプリケーションを<構成>できます。 メソッドをオーバーライドして、 LoadCustomConfiguration カスタム マネージャーを構成できる要素のカスタム子要素の <claimsAuthenticationManager> 処理を提供できます。 の ClaimsAuthenticationManager 基本実装では、子要素は処理されません。

要求認証マネージャーを使用するようにアプリケーションを構成すると、要求パイプラインから Windows Identity Foundation (WIF) によって呼び出されるようになります。

コンストラクター

ClaimsAuthenticationManager()

ClaimsAuthenticationManager クラスの新しいインスタンスを初期化します。

メソッド

Authenticate(String, ClaimsPrincipal)

派生クラスでオーバーライドされると、RP アプリケーションの要件と一致する ClaimsPrincipal オブジェクトを返します。 既定の実装は受信 ClaimsPrincipal を変更しません。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
LoadCustomConfiguration(XmlNodeList)

派生クラスでオーバーライドされると、XML からカスタム構成を読み込みます。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象