SecureEnvironment 类

定义

表示一个用于用户激活、许可证绑定和其他权限管理操作的安全客户端会话。Represents a secure client session for user activation, license binding, and other rights management operations.

public ref class SecureEnvironment : IDisposable
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable
type SecureEnvironment = class
    interface IDisposable
Public Class SecureEnvironment
Implements IDisposable
继承
SecureEnvironment
属性
实现

示例

下面的示例演示如何使用SecureEnvironmentThe following example shows use of the SecureEnvironment class

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

注解

与其他System.Security.RightsManagement类型一样, SecureEnvironment只能在完全信任的应用程序中使用。As with other System.Security.RightsManagement types, SecureEnvironment is only usable in full trust applications.

属性

ApplicationManifest

获取创建 ApplicationManifest 时指定的 SecureEnvironmentGets the ApplicationManifest specified when the SecureEnvironment was created.

User

获取创建 SecureEnvironment 时指定的用户或用户组。Gets the user or user-group specified when the SecureEnvironment was created.

方法

Create(String, AuthenticationType, UserActivationMode)

创建给定了应用程序权限清单 AuthenticationTypeUserActivationMode 的安全客户端会话。Creates a secure client session given an application rights manifest, AuthenticationType, and UserActivationMode.

Create(String, ContentUser)

使用给定权限清单为指定用户创建安全客户端会话。Creates a secure client session for a specified user with a given rights manifest.

Dispose()

释放由 SecureEnvironment 使用的所有资源。Releases all resources used by the SecureEnvironment.

Dispose(Boolean)

释放由 SecureEnvironment 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the SecureEnvironment and optionally releases the managed resources.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetActivatedUsers()

返回激活用户的列表。Returns a list of the activated users.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
IsUserActivated(ContentUser)

表示是否已激活访问权限管理内容的给定用户。Indicates whether a given user has been activated for accessing rights managed content.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
RemoveActivatedUser(ContentUser)

删除指定用户的许可证激活。Removes the license activation for a specified user.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于