Specifies the authentication type to be used with the Negotiate security support provider (SSP).
[FlagsAttribute]
public enum NegotiateAuthenticationType
Specifies Kerberos as the authentication type.
Kerberos
Specifies NTLM as the authentication type.
NTLM
Specifies the Negotiate security support provider (SSP), which selects the best authentication package available (either Kerberos or NTLM).
Negotiate
The NegotiateAuthenticationType enumeration is used to specify the authentication protocol that the NegotiateSecurityContext class should attempt to use when establishing a security context.
When you specify Negotiate, the underlying operating system will attempt to use Kerberos authentication first. If Kerberos is not available or fails, it will fall back to NTLM authentication.
This enumeration is decorated with the FlagsAttribute, which means that members can be combined using the bitwise OR operator.
The following C# code shows how to specify both NTLM and Negotiate authentication types for a NegotiateSecurityContext object.
using System;
using System.Net.Security;
public class Example
{
public static void Main(string[] args)
{
// Create a NegotiateSecurityContext with NTLM and Negotiate authentication types
NegotiateAuthenticationType authTypes = NegotiateAuthenticationType.NTLM | NegotiateAuthenticationType.Negotiate;
// In a real scenario, you would use authTypes when creating a NegotiateSecurityContext
// For example:
// NegotiateSecurityContext context = new NegotiateSecurityContext(authTypes);
Console.WriteLine($"Using authentication types: {authTypes}");
// You can also check for specific types
if ((authTypes & NegotiateAuthenticationType.NTLM) == NegotiateAuthenticationType.NTLM)
{
Console.WriteLine("NTLM is enabled.");
}
if ((authTypes & NegotiateAuthenticationType.Kerberos) == NegotiateAuthenticationType.Kerberos)
{
Console.WriteLine("Kerberos is enabled.");
}
if ((authTypes & NegotiateAuthenticationType.Negotiate) == NegotiateAuthenticationType.Negotiate)
{
Console.WriteLine("Negotiate (auto-select) is enabled.");
}
}
}
| Assembly | File |
|---|---|
| System.Net.Primitives | System.Net.Primitives.dll |
Note: The specific authentication protocols supported and their behavior may depend on the underlying operating system and its configuration.