Cet article a fait l’objet d’une traduction automatique. Pour afficher l’article en anglais, activez la case d’option Anglais. Vous pouvez également afficher le texte anglais dans une fenêtre contextuelle en faisant glisser le pointeur de la souris sur le texte traduit.
Traduction
Anglais

UserNamePasswordServiceCredential.CacheLogonTokens propriété

 

Date de publication : novembre 2016

Obtient ou définit une valeur qui indique si les jetons d'ouverture de session sont mis en cache.

Espace de noms:   System.ServiceModel.Security
Assembly:  System.ServiceModel (dans System.ServiceModel.dll)

public bool CacheLogonTokens { get; set; }

Valeur de propriété

Type: System.Boolean

true si les jetons d'ouverture de session sont mis en cache ; sinon, false. La valeur par défaut est false.

By default, indigo2 security asks the Windows security subsystem to create a logon token for every incoming user name/password security token if the user name is being mapped to a Windows account. This behavior can be changed by setting the P:System.ServiceModel.Security.UserNamePasswordServiceCredential.UserNamePasswordValidationMode property.

For F:System.ServiceModel.Security.UserNamePasswordValidationMode.Windows mode, the service uses Win32's LogonUser function for user name/password authentication. If the P:System.ServiceModel.Security.UserNamePasswordServiceCredential.CacheLogonTokens is set to true, the resulting Windows token is cached and reused for the same user name/password pair. The cache is valid for P:System.ServiceModel.Security.UserNamePasswordServiceCredential.CachedLogonTokenLifetime. The maximum number of caches is limited to P:System.ServiceModel.Security.UserNamePasswordServiceCredential.MaxCachedLogonTokens.

The following example gets the value of this property.

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Create a binding that uses a username/password credential.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

// Add an endpoint.
sh.AddServiceEndpoint(typeof(ICalculator), b, "UserNamePasswordCalculator");

// Get a reference to the UserNamePasswordServiceCredential object.
UserNamePasswordServiceCredential unpCredential = 
    sh.Credentials.UserNameAuthentication;
// Print out values.
Console.WriteLine("IncludeWindowsGroup: {0}", 
    unpCredential.IncludeWindowsGroups);
Console.WriteLine("UserNamePasswordValidationMode: {0}",
    unpCredential.UserNamePasswordValidationMode);
Console.WriteLine("CachedLogonTokenLifetime.Minutes: {0}",
    unpCredential.CachedLogonTokenLifetime.Minutes );
Console.WriteLine("CacheLogonTokens: {0}",
    unpCredential.CacheLogonTokens );
Console.WriteLine("MaxCachedLogonTokens: {0}",
    unpCredential.MaxCachedLogonTokens );

Console.ReadLine();

.NET Framework
Disponible depuis 3.0
Retour au début
Afficher: