Rediger

Del via


SecurityTokenParameters Class

Definition

Specifies an abstract class that when implemented represents security token parameters.

public ref class SecurityTokenParameters abstract
public abstract class SecurityTokenParameters
type SecurityTokenParameters = class
Public MustInherit Class SecurityTokenParameters
Inheritance
SecurityTokenParameters
Derived

Examples

The following code shows a custom override of this class called 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

Remarks

Security token parameters provide information about the tokens (for example, token type, issuer, and so on) required by the security binding element.

The security token parameter classes derived from this one are a collection of token properties and methods, and are used in creating different kinds of security binding elements and tokens. Not all of the properties are relevant to all derived classes. For example, the ReferenceStyle has no relevance in an issued token (SAML token) case.

Constructors

SecurityTokenParameters()

Initializes a new instance of the SecurityTokenParameters class.

SecurityTokenParameters(SecurityTokenParameters)

Initializes a new instance of the SecurityTokenParameters class from another instance.

Properties

HasAsymmetricKey

When overridden in a derived class, gets a value that indicates whether the token has an asymmetric key.

InclusionMode

Gets or sets the token inclusion requirements.

ReferenceStyle

Gets or sets the token reference style.

RequireDerivedKeys

Gets or sets a value that indicates whether keys can be derived from the original proof keys.

SupportsClientAuthentication

When overridden in a derived class, gets a value that indicates whether the token supports client authentication.

SupportsClientWindowsIdentity

When overridden in a derived class, gets a value that indicates whether the token supports a Windows identity for authentication.

SupportsServerAuthentication

When overridden in a derived class, gets a value that indicates whether the token supports server authentication.

Methods

Clone()

Clones another instance of this instance of the class.

CloneCore()

Clones another instance of this instance of the class.

CreateKeyIdentifierClause(SecurityToken, SecurityTokenReferenceStyle)

Creates a key identifier clause for a token.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeSecurityTokenRequirement(SecurityTokenRequirement)

When overridden in a derived class, initializes a security token requirement.

MatchesKeyIdentifierClause(SecurityToken, SecurityKeyIdentifierClause, SecurityTokenReferenceStyle)

Indicates whether a token matches a key identifier clause.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Displays a text representation of this instance of the class.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to