Share via


SecurityToken.SecurityKeys 屬性

定義

取得與安全性權杖相關聯的密碼編譯金鑰。

public:
 abstract property System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Tokens::SecurityKey ^> ^ SecurityKeys { System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Tokens::SecurityKey ^> ^ get(); };
public abstract System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Tokens.SecurityKey> SecurityKeys { get; }
member this.SecurityKeys : System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Tokens.SecurityKey>
Public MustOverride ReadOnly Property SecurityKeys As ReadOnlyCollection(Of SecurityKey)

屬性值

型別為 ReadOnlyCollection<T>SecurityKey,其中包含與安全性權杖相關聯之金鑰的集合。

範例

主題中使用的 SecurityToken 程式代碼範例取自 Custom Token 範例。 此範例提供自定義類別,可讓您處理簡單 Web 令牌 (SWT) 。 它包含類別和SimpleWebTokenHandler類別的實作SimpleWebToken,以及支援 SWT 令牌的其他類別。 如需此範例和其他可供 WIF 使用之範例以及下載位置的相關信息,請參閱 WIF 程式代碼範例索引。 下列程式代碼顯示 屬性的 SecurityKeys 覆寫。

/// <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 keys associated with this token.
/// </summary>
/// <value>The keys associated with this token.</value>
public override ReadOnlyCollection<SecurityKey> SecurityKeys
{
    get 
    { 
        return new ReadOnlyCollection<SecurityKey>( new List<SecurityKey>() ); 
    }
}

備註

SecurityKeys使用 屬性來設定此安全性令牌的密碼編譯金鑰,以保護令牌或 SOAP 訊息。 金鑰可用於數位簽署或加密令牌或 SOAP 訊息。

給實施者的注意事項

您必須覆寫 SecurityKeys 屬性。

適用於