SecureEnvironment.Create Methode

Definitie

Hiermee maakt u een beveiligde clientsessie voor rights management-bewerkingen.

Overloads

Name Description
Create(String, ContentUser)

Hiermee maakt u een beveiligde clientsessie voor een opgegeven gebruiker met een bepaald rechtenmanifest.

Create(String, AuthenticationType, UserActivationMode)

Hiermee maakt u een beveiligde clientsessie op basis van een toepassingsrechtenmanifest, AuthenticationTypeen UserActivationMode.

Voorbeelden

In het volgende voorbeeld ziet u hoe u deze methode gebruikt om een beveiligde omgeving te maken.

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

Create(String, ContentUser)

Hiermee maakt u een beveiligde clientsessie voor een opgegeven gebruiker met een bepaald rechtenmanifest.

public:
 static System::Security::RightsManagement::SecureEnvironment ^ Create(System::String ^ applicationManifest, System::Security::RightsManagement::ContentUser ^ user);
public static System.Security.RightsManagement.SecureEnvironment Create(string applicationManifest, System.Security.RightsManagement.ContentUser user);
static member Create : string * System.Security.RightsManagement.ContentUser -> System.Security.RightsManagement.SecureEnvironment
Public Shared Function Create (applicationManifest As String, user As ContentUser) As SecureEnvironment

Parameters

applicationManifest
String

Het manifest voor toepassingsrechten.

user
ContentUser

De gebruiker of gebruikersgroep voor het verlenen van toegang tot door rechten beheerde inhoud.

Retouren

Een beveiligde clientsessie voor activering, licentiebinding en andere rights management-bewerkingen.

Voorbeelden

In het volgende voorbeeld ziet u hoe u deze methode gebruikt om een beveiligde omgeving te maken.

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

Opmerkingen

Deze Create methode is bedoeld voor gebruik met gebruikers die al zijn geactiveerd, zoals opgegeven in de lijst die wordt geretourneerd door GetActivatedUsers. Gebruik de alternatieve Create methode voor gebruikers die nog niet zijn geactiveerd.

Zie ook

Van toepassing op

Create(String, AuthenticationType, UserActivationMode)

Hiermee maakt u een beveiligde clientsessie op basis van een toepassingsrechtenmanifest, AuthenticationTypeen UserActivationMode.

public:
 static System::Security::RightsManagement::SecureEnvironment ^ Create(System::String ^ applicationManifest, System::Security::RightsManagement::AuthenticationType authentication, System::Security::RightsManagement::UserActivationMode userActivationMode);
public static System.Security.RightsManagement.SecureEnvironment Create(string applicationManifest, System.Security.RightsManagement.AuthenticationType authentication, System.Security.RightsManagement.UserActivationMode userActivationMode);
static member Create : string * System.Security.RightsManagement.AuthenticationType * System.Security.RightsManagement.UserActivationMode -> System.Security.RightsManagement.SecureEnvironment
Public Shared Function Create (applicationManifest As String, authentication As AuthenticationType, userActivationMode As UserActivationMode) As SecureEnvironment

Parameters

applicationManifest
String

Het manifest voor toepassingsrechten.

authentication
AuthenticationType

De verificatiemethode.

userActivationMode
UserActivationMode

Het type certificaat van het gebruikersrechtenaccount.

Retouren

Een beveiligde clientsessie voor activering, licentiebinding en andere rights management-bewerkingen.

Voorbeelden

In het volgende voorbeeld ziet u hoe u deze methode gebruikt om een beveiligde omgeving te maken.

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

Opmerkingen

Deze Create methode is bedoeld voor nieuwe gebruikers die nog niet zijn geactiveerd.

Het activeren van een nieuwe gebruiker omvat een retourservertransactie om het gebruikerscertificaat en clientlicentiecertificaat te verkrijgen.

De alternatieve Create methode kan worden gebruikt als een gebruiker al is geactiveerd, zoals opgegeven in de lijst die wordt geretourneerd door GetActivatedUsers.

Van toepassing op