SecureEnvironment Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
- Inheritance
-
SecureEnvironment
- Attributes
- Implements
Examples
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
Remarks
As with other System.Security.RightsManagement types, SecureEnvironment is only usable in full trust applications.
Properties
ApplicationManifest |
Gets the ApplicationManifest specified when the SecureEnvironment was created. |
User |
Gets the user or user-group specified when the SecureEnvironment was created. |
Methods
Create(String, AuthenticationType, UserActivationMode) |
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() |
Releases all resources used by the SecureEnvironment. |
Dispose(Boolean) |
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. (Inherited from Object) |
GetActivatedUsers() |
Returns a list of the activated users. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
IsUserActivated(ContentUser) |
Indicates whether a given user has been activated for accessing rights managed content. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
RemoveActivatedUser(ContentUser) |
Removes the license activation for a specified user. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |