Aracılığıyla paylaş


ContentUser(String, AuthenticationType) Oluşturucu

Tanım

ContentUser sınıfının yeni bir örneğini başlatır.

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)

Parametreler

name
String

Kullanıcı veya grup adı.

authenticationType
AuthenticationType

Kimlik doğrulaması yöntemi.

Örnekler

Aşağıdaki örnekte, güvenli bir ortam oluşturmak için bu oluşturucunun nasıl kullanılacağı gösterilmektedir.

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

Açıklamalar

Kullanıcı veya grup name genellikle tek bir e-posta adresi (örneğin johndoe@contoso.com) veya bir e-posta dağıtım listesi (örneğin marketing@contoso.com) biçimindedir.

Şunlara uygulanır