Sdílet prostřednictvím


SecureEnvironment.Create Metoda

Definice

Vytvoří zabezpečenou klientskou relaci pro operace správy přístupových práv.

Přetížení

Create(String, ContentUser)

Vytvoří zabezpečenou klientskou relaci pro zadaného uživatele s daným manifestem práv.

Create(String, AuthenticationType, UserActivationMode)

Vytvoří zabezpečenou klientskou relaci s manifestem AuthenticationTypepráv aplikace a UserActivationMode.

Příklady

Následující příklad ukazuje, jak pomocí této metody vytvořit zabezpečené prostředí.

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)

Vytvoří zabezpečenou klientskou relaci pro zadaného uživatele s daným manifestem práv.

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

Parametry

applicationManifest
String

Manifest práv aplikace.

user
ContentUser

Uživatel nebo skupina uživatelů pro udělení přístupu ke spravovanému obsahu práv.

Návraty

SecureEnvironment

Zabezpečená klientská relace pro aktivaci, vazbu licencí a další operace správy přístupových práv.

Příklady

Následující příklad ukazuje, jak pomocí této metody vytvořit zabezpečené prostředí.

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

Poznámky

Tato Create metoda je určena pro použití s uživateli, kteří jsou již aktivováni, například v seznamu vráceného ze GetActivatedUsersseznamu . Použijte alternativní Create metodu pro uživatele, kteří ještě nejsou aktivovaní.

Viz také

Platí pro

Create(String, AuthenticationType, UserActivationMode)

Vytvoří zabezpečenou klientskou relaci s manifestem AuthenticationTypepráv aplikace a 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

Parametry

applicationManifest
String

Manifest práv aplikace.

authentication
AuthenticationType

Metoda ověřování.

userActivationMode
UserActivationMode

Typ certifikátu účtu uživatelských práv.

Návraty

SecureEnvironment

Zabezpečená klientská relace pro aktivaci, vazbu licencí a další operace správy přístupových práv.

Příklady

Následující příklad ukazuje, jak pomocí této metody vytvořit zabezpečené prostředí.

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

Poznámky

Tato Create metoda je určená pro nové uživatele, kteří ještě nejsou aktivovaní.

Aktivace nového uživatele zahrnuje transakci serveru zaokrouhlování pro získání uživatelského certifikátu a klientského licenčního certifikátu.

Alternativní Create metodu lze použít, pokud je uživatel již aktivován, například v seznamu vráceného ze GetActivatedUsersseznamu .

Platí pro