mscorlib(4.0.0.0) API with additions
System.Security.SecurityManager Class Reference

Provides the main access point for classes interacting with the security system. This class cannot be inherited. More...

Static Public Member Functions

static bool IsGranted (IPermission perm)
 Determines whether a permission is granted to the caller. More...
 
static PermissionSet GetStandardSandbox (Evidence evidence)
 Gets a permission set that is safe to grant to an application that has the provided evidence. More...
 
static void GetZoneAndOrigin (out ArrayList zone, out ArrayList origin)
 Gets the granted zone identity and URL identity permission sets for the current assembly. More...
 
static PolicyLevel LoadPolicyLevelFromFile (string path, PolicyLevelType type)
 Loads a T:System.Security.Policy.PolicyLevel from the specified file. More...
 
static PolicyLevel LoadPolicyLevelFromString (string str, PolicyLevelType type)
 Loads a T:System.Security.Policy.PolicyLevel from the specified string. More...
 
static void SavePolicyLevel (PolicyLevel level)
 Saves a modified security policy level loaded with M:System.Security.SecurityManager.LoadPolicyLevelFromFile(System.String,System.Security.PolicyLevelType). More...
 
static PermissionSet ResolvePolicy (Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)
 Determines what permissions to grant to code based on the specified evidence and requests. More...
 
static PermissionSet ResolvePolicy (Evidence evidence)
 Determines what permissions to grant to code based on the specified evidence. More...
 
static PermissionSet ResolvePolicy (Evidence[] evidences)
 Determines what permissions to grant to code based on the specified evidence. More...
 
static bool CurrentThreadRequiresSecurityContextCapture ()
 Determines whether the current thread requires a security context capture if its security state has to be re-created at a later point in time. More...
 
static PermissionSet ResolveSystemPolicy (Evidence evidence)
 Determines which permissions to grant to code based on the specified evidence, excluding the policy for the T:System.AppDomain level. More...
 
static IEnumerator ResolvePolicyGroups (Evidence evidence)
 Gets a collection of code groups matching the specified evidence. More...
 
static IEnumerator PolicyHierarchy ()
 Provides an enumerator to access the security policy hierarchy by levels, such as computer policy and user policy. More...
 
static void SavePolicy ()
 Saves the modified security policy state. More...
 

Properties

static bool CheckExecutionRights [get, set]
 Gets or sets a value indicating whether code must have F:System.Security.Permissions.SecurityPermissionFlag.Execution in order to execute. More...
 
static bool SecurityEnabled [get, set]
 Gets or sets a value indicating whether security is enabled. More...
 

Detailed Description

Provides the main access point for classes interacting with the security system. This class cannot be inherited.

Definition at line 15 of file SecurityManager.cs.

Member Function Documentation

◆ CurrentThreadRequiresSecurityContextCapture()

static bool System.Security.SecurityManager.CurrentThreadRequiresSecurityContextCapture ( )
static

Determines whether the current thread requires a security context capture if its security state has to be re-created at a later point in time.

Returns
false if the stack contains no partially trusted application domains, no partially trusted assemblies, and no currently active M:System.Security.CodeAccessPermission.PermitOnly or M:System.Security.CodeAccessPermission.Deny modifiers; true if the common language runtime cannot guarantee that the stack contains none of these.

Definition at line 368 of file SecurityManager.cs.

◆ GetStandardSandbox()

static PermissionSet System.Security.SecurityManager.GetStandardSandbox ( Evidence  evidence)
static

Gets a permission set that is safe to grant to an application that has the provided evidence.

Parameters
evidenceThe host evidence to match to a permission set.
Returns
A permission set that can be used as a grant set for the application that has the provided evidence.
Exceptions
T:System.ArgumentNullExceptionevidence is null.

Definition at line 132 of file SecurityManager.cs.

◆ GetZoneAndOrigin()

static void System.Security.SecurityManager.GetZoneAndOrigin ( out ArrayList  zone,
out ArrayList  origin 
)
static

Gets the granted zone identity and URL identity permission sets for the current assembly.

Parameters
zoneAn output parameter that contains an T:System.Collections.ArrayList of granted P:System.Security.Permissions.ZoneIdentityPermissionAttribute.Zone objects.
originAn output parameter that contains an T:System.Collections.ArrayList of granted T:System.Security.Permissions.UrlIdentityPermission objects.
Exceptions
T:System.Security.SecurityExceptionThe request for T:System.Security.Permissions.StrongNameIdentityPermission failed.

Definition at line 181 of file SecurityManager.cs.

◆ IsGranted()

static bool System.Security.SecurityManager.IsGranted ( IPermission  perm)
static

Determines whether a permission is granted to the caller.

Parameters
permThe permission to test against the grant of the caller.
Returns
true if the permissions granted to the caller include the permission perm ; otherwise, false.

Definition at line 106 of file SecurityManager.cs.

◆ LoadPolicyLevelFromFile()

static PolicyLevel System.Security.SecurityManager.LoadPolicyLevelFromFile ( string  path,
PolicyLevelType  type 
)
static

Loads a T:System.Security.Policy.PolicyLevel from the specified file.

Parameters
pathThe physical file path to a file containing the security policy information.
typeOne of the enumeration values that specifies the type of the policy level to be loaded.
Returns
The loaded policy level.
Exceptions
T:System.ArgumentNullExceptionThe path parameter is null.
T:System.ArgumentExceptionThe file indicated by the path parameter does not exist.
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.-or- The code that calls this method does not have F:System.Security.Permissions.FileIOPermissionAccess.Read.-or- The code that calls this method does not have F:System.Security.Permissions.FileIOPermissionAccess.Write.-or- The code that calls this method does not have F:System.Security.Permissions.FileIOPermissionAccess.PathDiscovery.
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

Definition at line 198 of file SecurityManager.cs.

◆ LoadPolicyLevelFromString()

static PolicyLevel System.Security.SecurityManager.LoadPolicyLevelFromString ( string  str,
PolicyLevelType  type 
)
static

Loads a T:System.Security.Policy.PolicyLevel from the specified string.

Parameters
strThe XML representation of a security policy level in the same form in which it appears in a configuration file.
typeOne of the enumeration values that specifies the type of the policy level to be loaded.
Returns
The loaded policy level.
Exceptions
T:System.ArgumentNullExceptionThe str parameter is null.
T:System.ArgumentExceptionThe str parameter is not valid.
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.

Definition at line 236 of file SecurityManager.cs.

◆ PolicyHierarchy()

static IEnumerator System.Security.SecurityManager.PolicyHierarchy ( )
static

Provides an enumerator to access the security policy hierarchy by levels, such as computer policy and user policy.

Returns
An enumerator for T:System.Security.Policy.PolicyLevel objects that compose the security policy hierarchy.
Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.

Definition at line 413 of file SecurityManager.cs.

◆ ResolvePolicy() [1/3]

static PermissionSet System.Security.SecurityManager.ResolvePolicy ( Evidence  evidence,
PermissionSet  reqdPset,
PermissionSet  optPset,
PermissionSet  denyPset,
out PermissionSet  denied 
)
static

Determines what permissions to grant to code based on the specified evidence and requests.

Parameters
evidenceThe evidence set used to evaluate policy.
reqdPsetThe required permissions the code needs to run.
optPsetThe optional permissions that will be used if granted, but aren't required for the code to run.
denyPsetThe denied permissions that must never be granted to the code even if policy otherwise permits it.
deniedAn output parameter that contains the set of permissions not granted.
Returns
The set of permissions that would be granted by the security system.
Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.
T:System.Security.Policy.PolicyExceptionPolicy fails to grant the minimum required permissions specified by the reqdPset parameter.

Definition at line 305 of file SecurityManager.cs.

◆ ResolvePolicy() [2/3]

static PermissionSet System.Security.SecurityManager.ResolvePolicy ( Evidence  evidence)
static

Determines what permissions to grant to code based on the specified evidence.

Parameters
evidenceThe evidence set used to evaluate policy.
Returns
The set of permissions that can be granted by the security system.
Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

Definition at line 320 of file SecurityManager.cs.

◆ ResolvePolicy() [3/3]

static PermissionSet System.Security.SecurityManager.ResolvePolicy ( Evidence []  evidences)
static

Determines what permissions to grant to code based on the specified evidence.

Parameters
evidencesAn array of evidence objects used to evaluate policy.
Returns
The set of permissions that is appropriate for all of the provided evidence.
Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

Definition at line 338 of file SecurityManager.cs.

◆ ResolvePolicyGroups()

static IEnumerator System.Security.SecurityManager.ResolvePolicyGroups ( Evidence  evidence)
static

Gets a collection of code groups matching the specified evidence.

Parameters
evidenceThe evidence set against which the policy is evaluated.
Returns
An enumeration of the set of code groups matching the evidence.
Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

Definition at line 398 of file SecurityManager.cs.

◆ ResolveSystemPolicy()

static PermissionSet System.Security.SecurityManager.ResolveSystemPolicy ( Evidence  evidence)
static

Determines which permissions to grant to code based on the specified evidence, excluding the policy for the T:System.AppDomain level.

Parameters
evidenceThe evidence set used to evaluate policy.
Returns
The set of permissions that can be granted by the security system.
Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

Definition at line 379 of file SecurityManager.cs.

◆ SavePolicy()

static void System.Security.SecurityManager.SavePolicy ( )
static

Saves the modified security policy state.

Exceptions
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.

Definition at line 428 of file SecurityManager.cs.

◆ SavePolicyLevel()

static void System.Security.SecurityManager.SavePolicyLevel ( PolicyLevel  level)
static

Saves a modified security policy level loaded with M:System.Security.SecurityManager.LoadPolicyLevelFromFile(System.String,System.Security.PolicyLevelType).

Parameters
levelThe policy level object to be saved.
Exceptions
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.
T:System.NotSupportedExceptionThis method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

Definition at line 285 of file SecurityManager.cs.

Property Documentation

◆ CheckExecutionRights

bool System.Security.SecurityManager.CheckExecutionRights
staticgetset

Gets or sets a value indicating whether code must have F:System.Security.Permissions.SecurityPermissionFlag.Execution in order to execute.

Returns
true if code must have F:System.Security.Permissions.SecurityPermissionFlag.Execution in order to execute; otherwise, false.
Exceptions
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.

Definition at line 73 of file SecurityManager.cs.

◆ SecurityEnabled

bool System.Security.SecurityManager.SecurityEnabled
staticgetset

Gets or sets a value indicating whether security is enabled.

Returns
true if security is enabled; otherwise, false.
Exceptions
T:System.Security.SecurityExceptionThe code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy.

Definition at line 89 of file SecurityManager.cs.


The documentation for this class was generated from the following file: