SecureEnvironment 類別

定義

表示使用者啟動、授權繫結程序及其他權限管理作業的安全用戶端工作階段。

public ref class SecureEnvironment : IDisposable
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable
public class SecureEnvironment : IDisposable
[<System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)>]
type SecureEnvironment = class
    interface IDisposable
type SecureEnvironment = class
    interface IDisposable
Public Class SecureEnvironment
Implements IDisposable
繼承
SecureEnvironment
屬性
實作

範例

下列範例顯示 類別的使用 SecureEnvironment

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.RightsManagementSecureEnvironment 只能在完全信任應用程式中使用。

屬性

ApplicationManifest

取得建立 ApplicationManifest 時指定的 SecureEnvironment

User

取得建立 SecureEnvironment 時指定的使用者或使用者群組。

方法

Create(String, AuthenticationType, UserActivationMode)

建立獲得應用程式權限資訊清單的安全用戶端工作階段,AuthenticationTypeUserActivationMode

Create(String, ContentUser)

以指定權限資訊清單為指定的使用者建立安全用戶端工作階段。

Dispose()

釋放 SecureEnvironment 所使用的所有資源。

Dispose(Boolean)

釋放 SecureEnvironment 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetActivatedUsers()

傳回已啟動使用者的清單。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsUserActivated(ContentUser)

表示是否已啟用指定使用者存取權限管理內容。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
RemoveActivatedUser(ContentUser)

為指定的使用者移除授權啟用。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於