SecureEnvironment 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表使用者啟用、授權系結和其他版權管理作業的安全用戶端會話。
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.RightsManagement , SecureEnvironment 僅可用於全信任申請。
屬性
| 名稱 | Description |
|---|---|
| ApplicationManifest |
在創建時ApplicationManifest獲得SecureEnvironment指定的設定。 |
| User |
取得建立時 SecureEnvironment 指定的使用者或使用者群組。 |
方法
| 名稱 | Description |
|---|---|
| Create(String, AuthenticationType, UserActivationMode) |
根據應用程式權限清單、 AuthenticationType、 UserActivationMode和 ,建立一個安全的客戶端會話。 |
| Create(String, ContentUser) |
為指定使用者建立一個擁有特定權限清單的安全用戶端會話。 |
| Dispose() |
釋放 SecureEnvironment所使用的所有資源。 |
| Dispose(Boolean) |
釋放 未管理的資源, SecureEnvironment 並可選擇性地釋放受管理資源。 |
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetActivatedUsers() |
回傳已啟用的使用者清單。 |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| IsUserActivated(ContentUser) |
顯示某位使用者是否已被啟用以存取權利管理內容。 |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| RemoveActivatedUser(ContentUser) |
移除指定使用者的授權啟用。 |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |