SecurityTokenParameters 類別

定義

指定 abstract 類別,可在實作之後表示安全性權杖參數。

public ref class SecurityTokenParameters abstract
public abstract class SecurityTokenParameters
type SecurityTokenParameters = class
Public MustInherit Class SecurityTokenParameters
繼承
SecurityTokenParameters
衍生

範例

下列程式碼顯示這個類別的自訂覆寫,稱為 CreditCardTokenParameters

public class CreditCardTokenParameters : SecurityTokenParameters
{
    public CreditCardTokenParameters()
    {
    }

    protected CreditCardTokenParameters(CreditCardTokenParameters other)
        : base(other)
    {
    }

    protected override SecurityTokenParameters CloneCore()
    {
        return new CreditCardTokenParameters(this);
    }

    protected override void InitializeSecurityTokenRequirement(SecurityTokenRequirement requirement)
    {
        requirement.TokenType = Constants.CreditCardTokenType;
        return;
    }

    // A credit card token has no cryptography, no windows identity, and supports only client authentication.
    protected override bool HasAsymmetricKey
    {
        get { return false; }
    }

    protected override bool SupportsClientAuthentication
    {
        get { return true; }
    }

    protected override bool SupportsClientWindowsIdentity
    {
        get { return false; }
    }

    protected override bool SupportsServerAuthentication
    {
        get { return false; }
    }

    protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
    {
        if (referenceStyle == SecurityTokenReferenceStyle.Internal)
        {
            return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();
        }
        else
        {
            throw new NotSupportedException("External references are not supported for credit card tokens");
        }
    }
}
Public Class CreditCardTokenParameters
    Inherits SecurityTokenParameters

    Public Sub New()
    End Sub

    Protected Sub New(ByVal other As CreditCardTokenParameters)
        MyBase.New(other)
    End Sub

    Protected Overrides Function CloneCore() As SecurityTokenParameters
        Return New CreditCardTokenParameters(Me)
    End Function

    Protected Overrides Sub InitializeSecurityTokenRequirement(ByVal requirement As SecurityTokenRequirement)
        requirement.TokenType = Constants.CreditCardTokenType
        Return
    End Sub

    ' A credit card token has no cryptography, no windows identity, and supports only client authentication.
    Protected Overrides ReadOnly Property HasAsymmetricKey() As Boolean
        Get
            Return False
        End Get
    End Property

    Protected Overrides ReadOnly Property SupportsClientAuthentication() As Boolean
        Get
            Return True
        End Get
    End Property

    Protected Overrides ReadOnly Property SupportsClientWindowsIdentity() As Boolean
        Get
            Return False
        End Get
    End Property

    Protected Overrides ReadOnly Property SupportsServerAuthentication() As Boolean
        Get
            Return False
        End Get
    End Property

    Protected Overrides Function CreateKeyIdentifierClause(ByVal token As SecurityToken, _
                                                           ByVal referenceStyle As SecurityTokenReferenceStyle) As SecurityKeyIdentifierClause
        If referenceStyle = SecurityTokenReferenceStyle.Internal Then
            Return token.CreateKeyIdentifierClause(Of LocalIdKeyIdentifierClause)()
        Else
            Throw New NotSupportedException("External references are not supported for credit card tokens")
        End If
    End Function

End Class

備註

安全性權杖參數會提供安全性繫結項目所需要的權杖的相關資訊,例如,權杖型別、簽發者等。

衍生自這個類別的安全性權杖參數類別是權杖屬性及方法的集合,而且會用於建立各種不同的安全性繫結項目和權杖。 並非所有的屬性都和衍生類別有關。 例如,在核發的權杖 (SAML 權杖) 案例中,ReferenceStyle 就沒有任何關聯。

建構函式

SecurityTokenParameters()

初始化 SecurityTokenParameters 類別的新執行個體。

SecurityTokenParameters(SecurityTokenParameters)

從其他執行個體初始化 SecurityTokenParameters 類別的新執行個體。

屬性

HasAsymmetricKey

在衍生類別中覆寫時取得值,這個值表示權杖是否具有非對稱金鑰。

InclusionMode

取得或設定權杖包含需求。

ReferenceStyle

取得或設定權杖參考樣式。

RequireDerivedKeys

取得或設定值,這個值表示是否可以從原始的證明金鑰衍生金鑰。

SupportsClientAuthentication

在衍生類別中覆寫時取得值,這個值表示權杖是否支援用戶端驗證。

SupportsClientWindowsIdentity

在衍生類別中覆寫時取得值,這個值表示瀏覽器權杖是否支援使用 Windows 身分識別進行驗證。

SupportsServerAuthentication

在衍生類別中覆寫時取得值,這個值表示權杖是否支援伺服器驗證。

方法

Clone()

複製這個類別之執行個體的另一個執行個體。

CloneCore()

複製這個類別之執行個體的另一個執行個體。

CreateKeyIdentifierClause(SecurityToken, SecurityTokenReferenceStyle)

建立權杖的金鑰識別碼子句。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
InitializeSecurityTokenRequirement(SecurityTokenRequirement)

在衍生類別中覆寫時,初始化安全性權杖需求。

MatchesKeyIdentifierClause(SecurityToken, SecurityKeyIdentifierClause, SecurityTokenReferenceStyle)

指出權杖是否與金鑰識別項子句相符。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

顯示這個類別執行個體的文字表示。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於