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
屬性
實作

範例

下列範例示範如何使用SecureEnvironment類別The 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)

建立獲得應用程式權限資訊清單的安全用戶端工作階段,AuthenticationTypeUserActivationModeCreates 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 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。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 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
RemoveActivatedUser(ContentUser)

為指定的使用者移除授權啟用。Removes the license activation for a specified user.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於