SecureEnvironment.Create Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Tworzy bezpieczną sesję klienta na potrzeby operacji zarządzania prawami.
Przeciążenia
Create(String, ContentUser) |
Tworzy bezpieczną sesję klienta dla określonego użytkownika z danym manifestem praw. |
Create(String, AuthenticationType, UserActivationMode) |
Tworzy bezpieczną sesję klienta przy użyciu manifestu praw aplikacji, AuthenticationTypei UserActivationMode. |
Przykłady
W poniższym przykładzie pokazano, jak za pomocą tej metody utworzyć bezpieczne środowisko.
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)
Tworzy bezpieczną sesję klienta dla określonego użytkownika z danym manifestem praw.
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 praw aplikacji.
- user
- ContentUser
Użytkownik lub grupa użytkowników w celu udzielenia dostępu do zawartości zarządzanej prawami.
Zwraca
Bezpieczna sesja klienta na potrzeby aktywacji, powiązania licencji i innych operacji zarządzania prawami.
Przykłady
W poniższym przykładzie pokazano, jak za pomocą tej metody utworzyć bezpieczne środowisko.
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
Uwagi
Ta Create metoda jest przeznaczona do użycia z użytkownikami, którzy są już aktywowani, na przykład podane na liście zwróconej z .GetActivatedUsers Użyj alternatywnej Create metody dla użytkowników, którzy nie są jeszcze aktywowani.
Zobacz też
Dotyczy
Create(String, AuthenticationType, UserActivationMode)
Tworzy bezpieczną sesję klienta przy użyciu manifestu praw aplikacji, AuthenticationTypei 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 praw aplikacji.
- authentication
- AuthenticationType
Metoda uwierzytelniania.
- userActivationMode
- UserActivationMode
Typ certyfikatu konta praw użytkownika.
Zwraca
Bezpieczna sesja klienta na potrzeby aktywacji, powiązania licencji i innych operacji zarządzania prawami.
Przykłady
W poniższym przykładzie pokazano, jak za pomocą tej metody utworzyć bezpieczne środowisko.
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
Uwagi
Ta Create metoda jest przeznaczona dla nowych użytkowników, którzy nie są jeszcze aktywowani.
Aktywowanie nowego użytkownika obejmuje transakcję serwera dwukierunkowego w celu uzyskania certyfikatu użytkownika i certyfikatu licencji klienta.
Alternatywną Create metodę można użyć, jeśli użytkownik jest już aktywowany, na przykład podany na liście zwróconej z GetActivatedUsers.