Language

SecurityToken.Id プロパティ

定義

セキュリティ トークンの一意識別子を取得します。

public:
 abstract property System::String ^ Id { System::String ^ get(); };
public abstract string Id { get; }
member this.Id : string
Public MustOverride ReadOnly Property Id As String

プロパティ値

セキュリティ トークンの一意識別子。

例

SecurityTokenトピックで使用されるコード例は、Custom Token サンプルから取得します。 このサンプルでは、Simple Web Tokens (SWT) の処理を有効にするカスタム クラスを提供します。 これには、 SimpleWebToken クラスと SimpleWebTokenHandler クラスの実装と、SWT トークンをサポートする他のクラスが含まれます。 WIF で使用できるこのサンプルとその他のサンプルの詳細と、それらをダウンロードする場所については、 WIF コード サンプル インデックスを参照してください。 次のコードは、 Id プロパティのオーバーライドを示しています。

/// <summary>
/// Defines the set of constants for the Simple Web Token.
/// </summary>
public static class SimpleWebTokenConstants
{
    public const string Audience = "Audience";
    public const string ExpiresOn = "ExpiresOn";
    public const string Id = "Id";
    public const string Issuer = "Issuer";
    public const string Signature = "HMACSHA256";
    public const string ValidFrom = "ValidFrom";
    public const string ValueTypeUri = "http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0";     
}
public static DateTime SwtBaseTime = new DateTime( 1970, 1, 1, 0, 0, 0, 0 ); // per SWT psec

NameValueCollection _properties;
/// <summary>
/// Gets the Id of the token.
/// </summary>
/// <value>The Id of the token.</value>
public override string Id
{
    get 
    {
        return _properties[SimpleWebTokenConstants.Id];
    }
}

注釈

通常、セキュリティ トークンを XML にシリアル化する場合、セキュリティ トークンの Id 属性は、 Id プロパティの値に設定されます。

注意 (実装者)

Id プロパティをオーバーライドする必要があります。

適用対象