Provides the main access point for classes interacting with the security system. This class cannot be inherited.
More...
|
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...
|
|
|
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...
|
|
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.
◆ 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()
Gets a permission set that is safe to grant to an application that has the provided evidence.
- Parameters
-
evidence | The 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.ArgumentNullException | evidence 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
-
zone | An output parameter that contains an T:System.Collections.ArrayList of granted P:System.Security.Permissions.ZoneIdentityPermissionAttribute.Zone objects. |
origin | An output parameter that contains an T:System.Collections.ArrayList of granted T:System.Security.Permissions.UrlIdentityPermission objects. |
- Exceptions
-
T:System.Security.SecurityException | The 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
-
perm | The 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()
Loads a T:System.Security.Policy.PolicyLevel from the specified file.
- Parameters
-
path | The physical file path to a file containing the security policy information. |
type | One of the enumeration values that specifies the type of the policy level to be loaded. |
- Returns
- The loaded policy level.
- Exceptions
-
T:System.ArgumentNullException | The path parameter is null . |
T:System.ArgumentException | The file indicated by the path parameter does not exist. |
T:System.Security.SecurityException | The 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.NotSupportedException | This 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()
Loads a T:System.Security.Policy.PolicyLevel from the specified string.
- Parameters
-
str | The XML representation of a security policy level in the same form in which it appears in a configuration file. |
type | One of the enumeration values that specifies the type of the policy level to be loaded. |
- Returns
- The loaded policy level.
- Exceptions
-
T:System.ArgumentNullException | The str parameter is null . |
T:System.ArgumentException | The str parameter is not valid. |
T:System.Security.SecurityException | The 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.NotSupportedException | This 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.SecurityException | The 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]
Determines what permissions to grant to code based on the specified evidence and requests.
- Parameters
-
evidence | The evidence set used to evaluate policy. |
reqdPset | The required permissions the code needs to run. |
optPset | The optional permissions that will be used if granted, but aren't required for the code to run. |
denyPset | The denied permissions that must never be granted to the code even if policy otherwise permits it. |
denied | An 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.NotSupportedException | This 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.PolicyException | Policy fails to grant the minimum required permissions specified by the reqdPset parameter. |
Definition at line 305 of file SecurityManager.cs.
◆ ResolvePolicy() [2/3]
Determines what permissions to grant to code based on the specified evidence.
- Parameters
-
evidence | The evidence set used to evaluate policy. |
- Returns
- The set of permissions that can be granted by the security system.
- Exceptions
-
T:System.NotSupportedException | This 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]
Determines what permissions to grant to code based on the specified evidence.
- Parameters
-
evidences | An 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.NotSupportedException | This 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()
Gets a collection of code groups matching the specified evidence.
- Parameters
-
evidence | The evidence set against which the policy is evaluated. |
- Returns
- An enumeration of the set of code groups matching the evidence.
- Exceptions
-
T:System.NotSupportedException | This 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()
Determines which permissions to grant to code based on the specified evidence, excluding the policy for the T:System.AppDomain level.
- Parameters
-
evidence | The evidence set used to evaluate policy. |
- Returns
- The set of permissions that can be granted by the security system.
- Exceptions
-
T:System.NotSupportedException | This 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.NotSupportedException | This 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.SecurityException | The 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
-
level | The policy level object to be saved. |
- Exceptions
-
T:System.Security.SecurityException | The code that calls this method does not have F:System.Security.Permissions.SecurityPermissionFlag.ControlPolicy. |
T:System.NotSupportedException | This 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.
◆ 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.SecurityException | The 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.SecurityException | The 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: