Partage via


ContentUser(String, AuthenticationType) Constructeur

Définition

Initialise une nouvelle instance de la classe ContentUser.

public:
 ContentUser(System::String ^ name, System::Security::RightsManagement::AuthenticationType authenticationType);
public ContentUser (string name, System.Security.RightsManagement.AuthenticationType authenticationType);
new System.Security.RightsManagement.ContentUser : string * System.Security.RightsManagement.AuthenticationType -> System.Security.RightsManagement.ContentUser
Public Sub New (name As String, authenticationType As AuthenticationType)

Paramètres

name
String

Nom de l'utilisateur ou du groupe.

authenticationType
AuthenticationType

Méthode d'authentification.

Exemples

L’exemple suivant montre comment utiliser ce constructeur pour créer un environnement sécurisé.

string applicationManifest = "<manifest></manifest>";
if (File.Exists("rpc.xml"))
{
    StreamReader manifestReader = File.OpenText("rpc.xml");
    applicationManifest = manifestReader.ReadToEnd();
}

if (_secureEnv == null)
{
    if (SecureEnvironment.IsUserActivated(new ContentUser(
                _currentUserId, AuthenticationType.Windows)))
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest, new ContentUser(
                _currentUserId, AuthenticationType.Windows));
    }
    else
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest,
            AuthenticationType.Windows,
            UserActivationMode.Permanent);
    }
}
Dim applicationManifest As String = "<manifest></manifest>"
If File.Exists("rpc.xml") Then
    Dim manifestReader As StreamReader = File.OpenText("rpc.xml")
    applicationManifest = manifestReader.ReadToEnd()
End If

If _secureEnv Is Nothing Then
    If SecureEnvironment.IsUserActivated(New ContentUser(_currentUserId, AuthenticationType.Windows)) Then
        _secureEnv = SecureEnvironment.Create(applicationManifest, New ContentUser(_currentUserId, AuthenticationType.Windows))
    Else
        _secureEnv = SecureEnvironment.Create(applicationManifest, AuthenticationType.Windows, UserActivationMode.Permanent)
    End If
End If

Remarques

L’utilisateur ou le groupe name se présente souvent sous la forme d’une adresse e-mail individuelle (telle que johndoe@contoso.com) ou d’une liste de distribution de courrier électronique (telle que marketing@contoso.com).

S’applique à