Enables the user to configure client and service credentials as well as service credential authentication settings for use on the client side of communication.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Thetype exposes the following members.
|ClientCertificate||Gets an object that you can use to provide the X.509 certificate that the client uses to authenticate to the service.|
|HttpDigest||Gets the current HTTP Digest credential.|
|IssuedToken||Use this property to specify the endpoint address and binding to use when contacting your local Security Token Service. This information is used when a service requires authentication using an issued token, but the policy of the service (represented as a binding on the client) does not explicitly specify how and where to obtain the issued token.|
|Peer||Controls the credentials that a peer node uses to authenticate itself to other nodes in the mesh, as well as authentication settings that a peer node uses to authenticate other peer nodes.|
|SecurityTokenHandlerCollectionManager||Gets or sets the security token handler for the client credential.|
|ServiceCertificate||Gets an object used to specify a service's X.509 certificate.|
|SupportInteractive||Gets or sets a value that indicates whether the system is allowed to interactively prompt the user for credentials when necessary. For example, setting it to false might be desired in middle-tier scenarios.|
|UseIdentityConfiguration||Gets or sets whether the client credentials uses identity configuration.|
|UserName||Gets a credential object that you can use to set the user name and password that the client uses to authenticate itself to the service.|
|Windows||Gets an object used to control the Windows credential that the client uses to authenticate itself to the service.|
|ApplyClientBehavior||Applies the specified client behavior to the endpoint.|
|Clone||Creates a new copy of this instance.|
|CloneCore||Creates a new copy of this instance.|
|CreateSecurityTokenManager||Creates a security token manager for this instance. This method is rarely called explicitly; it is primarily used in extensibility scenarios and is called by the system itself. (Overrides SecurityCredentialsManager.CreateSecurityTokenManager.)|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetInfoCardSecurityToken||Generates and returns a security token using the CardSpace system and the specified policy chain and token serializer.|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
A object is added to the Behaviors collection. The ClientCredentials property is a Façade (a well-known design pattern) over an entry in that collection. Many properties in this class return objects that consist mainly of properties. These objects can be used for configuration: once you get the object, you can use it to set properties by calling its members.
The following code sample shows how to override this class and implement your own custom client credentials that includes a custom security token manager.
It is important to note that the CreateSecurityTokenManager method is overridden to create a custom security token manager. The security token manager, derived from ClientCredentialsSecurityTokenManager. must return a custom security token provider, derived from [System.IdentityModel.Selectors.SecurityTokenProvider], to create the actual security token. If you do not follow this pattern for creating security tokens, your application will be at risk for security attacks, specifically elevation of privileges. This coding pattern ensures that the correct credentials are used when channel factories are cached.
Public Class MyClientCredentials Inherits ClientCredentials Private creditCardNumberValue As String Public Sub New() End Sub 'New ' Perform client credentials initialization. Protected Sub New(ByVal other As MyClientCredentials) MyBase.New(other) ' Clone fields defined in this class. Me.creditCardNumberValue = other.creditCardNumberValue End Sub Public Property CreditCardNumber() As String Get Return Me.creditCardNumberValue End Get Set If value Is Nothing Then Throw New ArgumentNullException("value") End If Me.creditCardNumberValue = value End Set End Property Public Overrides Function CreateSecurityTokenManager() As SecurityTokenManager ' Return your implementation of the SecurityTokenManager. Return New MyClientCredentialsSecurityTokenManager(Me) End Function Protected Overrides Function CloneCore() As ClientCredentials ' Implement the cloning functionality. Return New MyClientCredentials(Me) End Function End Class
.NET FrameworkSupported in: 4.5, 4, 3.5, 3.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
.NET for Windows Phone appsSupported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.