Namespace: System.Net.Security
Assembly: System.Net.Primitives
Summary
Represents a token for authenticating a service. This class is typically used in conjunction with Windows Communication Foundation (WCF) for service authentication.
Syntax
public sealed class AuthenticateServiceToken
Remarks
The AuthenticateServiceToken
class provides a way to securely represent and transmit authentication credentials for a service. It is often employed in scenarios where a client needs to authenticate itself to a server, and the server subsequently uses this token to identify and authorize the client's access.
This class is part of the .NET Framework's networking and security capabilities, enabling robust authentication mechanisms for distributed applications.
Examples
While a direct instantiation and usage example is complex due to its integration within WCF, conceptually, a client might obtain an AuthenticateServiceToken
from a security context or token provider and then pass it to a WCF service operation for authentication.
Consider a scenario where a security token service issues a token:
// This is a simplified conceptual example. // Actual implementation would involve WCF and security token services. // Imagine obtaining a token from a security context // TokenService tokenService = new TokenService(); // AuthenticateServiceToken auth_token = tokenService.GetAuthTokenForService("MySecureService"); // Then this token would be used in WCF message headers or bindings. // Example (conceptual): // ServiceClient client = new ServiceClient(); // client.ClientCredentials.ServicePrincipalName = new X509Certificate2("server.cer"); // client.ClientCredentials.AllowMultiDomain = true; // client.ClientCredentials.UseIdentityExtension = true; // client.ClientCredentials.SetServiceAuthentication(auth_token); // Hypothetical method // client.DoSomethingSecure();
Requirements
Platform | Minimum version |
---|---|
.NET | 5.0 |
.NET Core | 2.0 |
.NET Framework | 4.0 |
Mono | 5.18 |
Xamarin.iOS | 10.14 |
Xamarin.Mac | 6.16 |
Xamarin.Android | 8.1 |
Public Constructors
-
AuthenticateServiceToken(IntPtr, AssemblyLoadContext)
Initializes a new instance of the
AuthenticateServiceToken
class. -
AuthenticateServiceToken(string)
Initializes a new instance of the
AuthenticateServiceToken
class with the specified token string.
Public Properties
-
Token
Gets the authentication token string.
Public Methods
-
Dispose()
Releases the resources used by the
AuthenticateServiceToken
object. -
Dispose(bool)
Releases the unmanaged resources used by the
AuthenticateServiceToken
and optionally releases the managed resources.