UserNamePasswordValidationMode Énumération
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Répertorie les méthodes de validation en mode nom d'utilisateur/mot de passe.
public enum class UserNamePasswordValidationMode
public enum UserNamePasswordValidationMode
type UserNamePasswordValidationMode =
Public Enum UserNamePasswordValidationMode
- Héritage
Nom | Valeur | Description |
---|---|---|
Custom | 2 | Authentification personnalisée basée sur un UserNamePasswordValidator personnalisé configuré. |
MembershipProvider | 1 | Permet une validation de mot de passe basée sur un MembershipProvider configuré. |
Windows | 0 | Les noms d'utilisateur sont mappés aux utilisateurs Windows. |
Cet exemple montre comment définir cette propriété.
// Host the service within this EXE console application.
public static void Main()
{
// Create a ServiceHost for the CalculatorService type and provide the base address.
using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService)))
{
serviceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new MyUserNamePasswordValidator();
// Open the ServiceHostBase to create listeners and start listening for messages.
serviceHost.Open();
// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("The service is running in the following account: {0}", WindowsIdentity.GetCurrent().Name);
Console.WriteLine("Press <ENTER> to terminate service.");
Console.WriteLine();
Console.ReadLine();
}
}
Cette énumération est référencée par UserNameServiceElement, ServiceCredentialsSecurityTokenManager et UserNamePasswordServiceCredential.
Produit | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Commentaires sur .NET
.NET est un projet open source. Sélectionnez un lien pour fournir des commentaires :