Bewerken

Share via


ClientCredentialsSecurityTokenManager Class

Definition

Manages security tokens for the client.

public ref class ClientCredentialsSecurityTokenManager : System::IdentityModel::Selectors::SecurityTokenManager
public class ClientCredentialsSecurityTokenManager : System.IdentityModel.Selectors.SecurityTokenManager
type ClientCredentialsSecurityTokenManager = class
    inherit SecurityTokenManager
Public Class ClientCredentialsSecurityTokenManager
Inherits SecurityTokenManager
Inheritance
ClientCredentialsSecurityTokenManager
Derived

Examples

The following code shows how you can override this class to create a custom Client Credentials Security Token Manager.

internal class MyClientCredentialsSecurityTokenManager :
    ClientCredentialsSecurityTokenManager
{
    MyClientCredentials credentials;

    public MyClientCredentialsSecurityTokenManager(MyClientCredentials credentials)
        : base(credentials)
    {
        this.credentials = credentials;
    }

    public override SecurityTokenProvider CreateSecurityTokenProvider(
        SecurityTokenRequirement tokenRequirement)
    {
        // Return your implementation of the SecurityTokenProvider, if required.
        // This implementation delegates to the base class.
        return base.CreateSecurityTokenProvider(tokenRequirement);
    }

    public override SecurityTokenAuthenticator CreateSecurityTokenAuthenticator(
        SecurityTokenRequirement tokenRequirement, out SecurityTokenResolver outOfBandTokenResolver)
    {
        // Return your implementation of the SecurityTokenAuthenticator, if required.
        // This implementation delegates to the base class.
        return base.CreateSecurityTokenAuthenticator(tokenRequirement, out outOfBandTokenResolver);
    }

    public override SecurityTokenSerializer CreateSecurityTokenSerializer(SecurityTokenVersion version)
    {
        // Return your implementation of the SecurityTokenSerializer, if required.
        // This implementation delegates to the base class.
        return base.CreateSecurityTokenSerializer(version);
    }
}

Friend Class MyClientCredentialsSecurityTokenManager
    Inherits ClientCredentialsSecurityTokenManager
    Private credentials As MyClientCredentials
    
    
    Public Sub New(ByVal credentials As MyClientCredentials) 
        MyBase.New(credentials)
        Me.credentials = credentials
    
    End Sub
    
    
    Public Overrides Function CreateSecurityTokenProvider( _
    ByVal tokenRequirement As SecurityTokenRequirement) As SecurityTokenProvider
        ' Return your implementation of the SecurityTokenProvider, if required.
        ' This implementation delegates to the base class.
        Return MyBase.CreateSecurityTokenProvider(tokenRequirement)

    End Function
    
    
    Public Overrides Function CreateSecurityTokenAuthenticator( _
    ByVal tokenRequirement As SecurityTokenRequirement, _
    ByRef outOfBandTokenResolver As SecurityTokenResolver) As SecurityTokenAuthenticator
        ' Return your implementation of the SecurityTokenAuthenticator, if required.
        ' This implementation delegates to the base class.
        Return MyBase.CreateSecurityTokenAuthenticator(tokenRequirement, outOfBandTokenResolver)

    End Function
    
    
    Public Overrides Function CreateSecurityTokenSerializer(ByVal version As SecurityTokenVersion) _
    As SecurityTokenSerializer
        ' Return your implementation of the SecurityTokenSerializer, if required.
        ' This implementation delegates to the base class.
        Return MyBase.CreateSecurityTokenSerializer(version)

    End Function
End Class

Remarks

This class handles security token serialization, security token provision and security token authentication for the client. There is one instance of this class for each client channel factory.

Constructors

ClientCredentialsSecurityTokenManager(ClientCredentials)

Initializes a new instance of the ClientCredentialsSecurityTokenManager class.

Properties

ClientCredentials

Gets the client credentials.

Methods

CreateSecurityTokenAuthenticator(SecurityTokenRequirement, SecurityTokenResolver)

Creates a security token authenticator.

CreateSecurityTokenProvider(SecurityTokenRequirement)

Creates a security token provider.

CreateSecurityTokenSerializer(SecurityTokenVersion)

Creates a security token serializer.

CreateSecurityTokenSerializer(SecurityVersion)

Creates a security token serializer.

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)
IsIssuedSecurityTokenRequirement(SecurityTokenRequirement)

Gets a value that indicates whether the specified token requirement is an issued security token requirement.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to