ServiceCredentials Class

 

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.

Namespace:   System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

System.Object
  System.ServiceModel.Security.SecurityCredentialsManager
    System.ServiceModel.Description.ServiceCredentials

public class ServiceCredentials : SecurityCredentialsManager, 
	IServiceBehavior

NameDescription
System_CAPS_pubmethodServiceCredentials()

Initializes a new instance of the ServiceCredentials class.

System_CAPS_protmethodServiceCredentials(ServiceCredentials)

Initializes a new instance of ServiceCredentials from the specified ServiceCredentials.

NameDescription
System_CAPS_pubpropertyClientCertificate

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

System_CAPS_pubpropertyExceptionMapper

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

System_CAPS_pubpropertyIdentityConfiguration

Gets or sets the identity configuration for the service.

System_CAPS_pubpropertyIssuedTokenAuthentication

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

System_CAPS_pubpropertyPeer

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

System_CAPS_pubpropertySecureConversationAuthentication

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

System_CAPS_pubpropertyServiceCertificate

Gets the current certificate associated with this service.

System_CAPS_pubpropertyUseIdentityConfiguration

Gets or sets whether the service credential uses identity configuration.

System_CAPS_pubpropertyUserNameAuthentication

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

System_CAPS_pubpropertyWindowsAuthentication

Gets the current Windows authentication settings for this service.

NameDescription
System_CAPS_pubmethodClone()

Creates a copy of the current instance.

System_CAPS_protmethodCloneCore()

Copies the essential members of the current instance.

System_CAPS_pubmethodCreateSecurityTokenManager()

Creates a token manager for this service.(Overrides SecurityCredentialsManager.CreateSecurityTokenManager().)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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

This API supports the product infrastructure and is not intended to be used directly from your code. Adds this instance to a binding parameter collection. This is an infrastructure method and not intended to be called directly.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceBehavior.ApplyDispatchBehavior(ServiceDescription, ServiceHostBase)

This API supports the product infrastructure and is not intended to be used directly from your code. Apply the dispatch behavior. This is an infrastructure method and not intended to be called directly.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceBehavior.Validate(ServiceDescription, ServiceHostBase)

This API supports the product infrastructure and is not intended to be used directly from your code. Validates a service description. This is an infrastructure method and not intended to be called directly.

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

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);
    }
}

.NET Framework
Available since 3.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: