ServiceCredentials ServiceCredentials ServiceCredentials ServiceCredentials Class

Definition

Configures a service credential. Use this class to specify the credential for the service such as an X.509 certificate. Also, use this class to specify the authentication model for various client credentials such as user name and password validation.

public ref class ServiceCredentials : System::ServiceModel::Security::SecurityCredentialsManager, System::ServiceModel::Description::IServiceBehavior
public class ServiceCredentials : System.ServiceModel.Security.SecurityCredentialsManager, System.ServiceModel.Description.IServiceBehavior
type ServiceCredentials = class
    inherit SecurityCredentialsManager
    interface IServiceBehavior
Public Class ServiceCredentials
Inherits SecurityCredentialsManager
Implements IServiceBehavior
Inheritance
Implements

Examples

The following code shows how to override this class to implement custom service credentials.

public class MyServiceCredentials : ServiceCredentials
{
    X509Certificate2 additionalCertificate;

    public MyServiceCredentials()
    {
    }

    protected MyServiceCredentials(MyServiceCredentials other)
        : base(other)
    {
        this.additionalCertificate = other.additionalCertificate;
    }

    public X509Certificate2 AdditionalCertificate
    {
        get
        {
            return this.additionalCertificate;
        }
        set
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            this.additionalCertificate = value;
        }
    }

    public override SecurityTokenManager CreateSecurityTokenManager()
    {
        return base.CreateSecurityTokenManager();
    }

    protected override ServiceCredentials CloneCore()
    {
        return new MyServiceCredentials(this);
    }
}
Public Class MyServiceCredentials
    Inherits ServiceCredentials
    Private additionalCertificateValue As X509Certificate2

    Public Sub New() 
    
    End Sub

    Protected Sub New(ByVal other As MyServiceCredentials) 
        MyBase.New(other)
        Me.additionalCertificate = other.additionalCertificate
    End Sub
    
    
    Public Property AdditionalCertificate() As X509Certificate2 
        Get
            Return Me.additionalCertificateValue
        End Get
        Set
            If value Is Nothing Then
                Throw New ArgumentNullException("value")
            End If
            Me.additionalCertificateValue = value
        End Set
    End Property

    Public Overrides Function CreateSecurityTokenManager() As SecurityTokenManager 
        Return MyBase.CreateSecurityTokenManager()
    
    End Function
    
    
    Protected Overrides Function CloneCore() As ServiceCredentials 
        Return New MyServiceCredentials(Me)
    
    End Function
End Class

Remarks

This class is used as a parameter in the BuildChannelListenerCore method, by methods of the ServiceCredentialsSecurityTokenManager, and is returned by the ServiceHostBase.Credentials property.

Constructors

ServiceCredentials() ServiceCredentials() ServiceCredentials() ServiceCredentials()

Initializes a new instance of the ServiceCredentials class.

ServiceCredentials(ServiceCredentials) ServiceCredentials(ServiceCredentials) ServiceCredentials(ServiceCredentials) ServiceCredentials(ServiceCredentials)

Initializes a new instance of ServiceCredentials from the specified ServiceCredentials.

Properties

ClientCertificate ClientCertificate ClientCertificate ClientCertificate

Gets the current client certificate authentication and provisioning settings for this service.

ExceptionMapper ExceptionMapper ExceptionMapper ExceptionMapper

Gets or sets the exception mapper associated with the service credentials.

IdentityConfiguration IdentityConfiguration IdentityConfiguration IdentityConfiguration

Gets or sets the identity configuration for the service.

IssuedTokenAuthentication IssuedTokenAuthentication IssuedTokenAuthentication IssuedTokenAuthentication

Gets the current issued token (for example, SAML) authentication settings for this service.

Peer Peer Peer Peer

Gets the current credential authentication and provisioning settings to be used by peer transport endpoints configured on the service.

SecureConversationAuthentication SecureConversationAuthentication SecureConversationAuthentication SecureConversationAuthentication

Gets the current settings to be used by a secure conversation.

ServiceCertificate ServiceCertificate ServiceCertificate ServiceCertificate

Gets the current certificate associated with this service.

UseIdentityConfiguration UseIdentityConfiguration UseIdentityConfiguration UseIdentityConfiguration

Gets or sets whether the service credential uses identity configuration.

UserNameAuthentication UserNameAuthentication UserNameAuthentication UserNameAuthentication

Gets the current user name/password authentication settings for this service.

WindowsAuthentication WindowsAuthentication WindowsAuthentication WindowsAuthentication

Gets the current Windows authentication settings for this service.

Methods

Clone() Clone() Clone() Clone()

Creates a copy of the current instance.

CloneCore() CloneCore() CloneCore() CloneCore()

Copies the essential members of the current instance.

CreateSecurityTokenManager() CreateSecurityTokenManager() CreateSecurityTokenManager() CreateSecurityTokenManager()

Creates a token manager for this service.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IServiceBehavior.AddBindingParameters(ServiceDescription, ServiceHostBase, Collection<ServiceEndpoint>, BindingParameterCollection) IServiceBehavior.AddBindingParameters(ServiceDescription, ServiceHostBase, Collection<ServiceEndpoint>, BindingParameterCollection) IServiceBehavior.AddBindingParameters(ServiceDescription, ServiceHostBase, Collection<ServiceEndpoint>, BindingParameterCollection) IServiceBehavior.AddBindingParameters(ServiceDescription, ServiceHostBase, Collection<ServiceEndpoint>, BindingParameterCollection)

Adds this instance to a binding parameter collection. This is an infrastructure method and not intended to be called directly.

IServiceBehavior.ApplyDispatchBehavior(ServiceDescription, ServiceHostBase) IServiceBehavior.ApplyDispatchBehavior(ServiceDescription, ServiceHostBase) IServiceBehavior.ApplyDispatchBehavior(ServiceDescription, ServiceHostBase) IServiceBehavior.ApplyDispatchBehavior(ServiceDescription, ServiceHostBase)

Apply the dispatch behavior. This is an infrastructure method and not intended to be called directly.

IServiceBehavior.Validate(ServiceDescription, ServiceHostBase) IServiceBehavior.Validate(ServiceDescription, ServiceHostBase) IServiceBehavior.Validate(ServiceDescription, ServiceHostBase) IServiceBehavior.Validate(ServiceDescription, ServiceHostBase)

Validates a service description. This is an infrastructure method and not intended to be called directly.

Applies to