CodeAccessSecurityAttribute Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Spécifie la classe d’attribut de base pour la sécurité de l’accès au code.
public ref class CodeAccessSecurityAttribute abstract : System::Security::Permissions::SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Serializable]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Serializable>]
type CodeAccessSecurityAttribute = class
inherit SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type CodeAccessSecurityAttribute = class
inherit SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
type CodeAccessSecurityAttribute = class
inherit SecurityAttribute
Public MustInherit Class CodeAccessSecurityAttribute
Inherits SecurityAttribute
- Héritage
- Dérivé
- Attributs
Remarques
Avertissement
La sécurité d’accès du code (CAS) a été déconseillée dans toutes les versions du .NET Framework et de .NET. Les versions récentes de .NET n’honorent pas les annotations CAS et produisent des erreurs si les API liées à CAS sont utilisées. Les développeurs doivent rechercher d’autres moyens d’accomplir des tâches de sécurité.
Cette classe d’attribut associe un SecurityActionattribut de sécurité personnalisé, par exemple Demand.
Les types dérivés CodeAccessSecurityAttribute sont utilisés pour limiter l’accès aux ressources ou aux opérations sécurisables.
Les informations de sécurité déclarées par un attribut de sécurité sont stockées dans les métadonnées de la cible d’attribut et sont accessibles par le système au moment de l’exécution. Les attributs de sécurité sont utilisés uniquement pour la sécurité déclarative. Utilisez la classe d’autorisation correspondante dérivée de CodeAccessPermission la sécurité impérative.
Notes pour les responsables de l’implémentation
Tous les attributs d’autorisation dérivés de cette classe ne doivent avoir qu’un seul constructeur qui prend comme SecurityAction seul paramètre.
Constructeurs
| Nom | Description |
|---|---|
| CodeAccessSecurityAttribute(SecurityAction) |
Initialise une nouvelle instance avec CodeAccessSecurityAttribute le fichier spécifié SecurityAction. |
Propriétés
| Nom | Description |
|---|---|
| Action |
Obtient ou définit une action de sécurité. (Hérité de SecurityAttribute) |
| TypeId |
En cas d’implémentation dans une classe dérivée, obtient un identificateur unique pour cette Attribute. (Hérité de Attribute) |
| Unrestricted |
Obtient ou définit une valeur indiquant si l’autorisation complète (illimitée) à la ressource protégée par l’attribut est déclarée. (Hérité de SecurityAttribute) |
Méthodes
| Nom | Description |
|---|---|
| CreatePermission() |
En cas de substitution dans une classe dérivée, crée un objet d’autorisation qui peut ensuite être sérialisé sous forme binaire et stocké de manière permanente avec les SecurityAction métadonnées d’un assembly. (Hérité de SecurityAttribute) |
| Equals(Object) |
Retourne une valeur qui indique si cette instance est égale à un objet spécifié. (Hérité de Attribute) |
| GetHashCode() |
Retourne le code de hachage pour cette instance. (Hérité de Attribute) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| IsDefaultAttribute() |
En cas de substitution dans une classe dérivée, indique si la valeur de cette instance est la valeur par défaut de la classe dérivée. (Hérité de Attribute) |
| Match(Object) |
En cas de substitution dans une classe dérivée, retourne une valeur qui indique si cette instance est égale à un objet spécifié. (Hérité de Attribute) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |
Implémentations d’interfaces explicites
| Nom | Description |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch. (Hérité de Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Récupère les informations de type d’un objet, qui peuvent être utilisées pour obtenir les informations de type d’une interface. (Hérité de Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1). (Hérité de Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fournit l’accès aux propriétés et méthodes exposées par un objet. (Hérité de Attribute) |