SecureEnvironment SecureEnvironment SecureEnvironment SecureEnvironment Class

Definition

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
Inheritance
SecureEnvironmentSecureEnvironmentSecureEnvironmentSecureEnvironment
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 ApplicationManifest ApplicationManifest ApplicationManifest

Gets the ApplicationManifest specified when the SecureEnvironment was created.

User User User User

Gets the user or user-group specified when the SecureEnvironment was created.

Methods

Create(String, AuthenticationType, UserActivationMode) Create(String, AuthenticationType, UserActivationMode) Create(String, AuthenticationType, UserActivationMode) Create(String, AuthenticationType, UserActivationMode)

Creates a secure client session given an application rights manifest, AuthenticationType, and UserActivationMode.

Create(String, ContentUser) Create(String, ContentUser) Create(String, ContentUser) Create(String, ContentUser)

Creates a secure client session for a specified user with a given rights manifest.

Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the SecureEnvironment.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the SecureEnvironment and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetActivatedUsers() GetActivatedUsers() GetActivatedUsers() GetActivatedUsers()

Returns a list of the activated users.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsUserActivated(ContentUser) IsUserActivated(ContentUser) IsUserActivated(ContentUser) IsUserActivated(ContentUser)

Indicates whether a given user has been activated for accessing rights managed content.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveActivatedUser(ContentUser) RemoveActivatedUser(ContentUser) RemoveActivatedUser(ContentUser) RemoveActivatedUser(ContentUser)

Removes the license activation for a specified user.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to