This topic has not yet been rated - Rate this topic

ClaimsPrincipalPermissionAttribute Class

Windows Identity Foundation


Represents the attribute used to declaratively request access checks using the claims authorization manager.


Namespace: Microsoft.IdentityModel.Claims
Assembly: Microsoft.IdentityModel (in microsoft.identitymodel.dll)
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple=true)] 
public class ClaimsPrincipalPermissionAttribute : CodeAccessSecurityAttribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple=true) */ 
public class ClaimsPrincipalPermissionAttribute extends CodeAccessSecurityAttribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple=true) 
public class ClaimsPrincipalPermissionAttribute extends CodeAccessSecurityAttribute

The following code example shows how to attribute a method. The claims authorization manager will be invoked to authorize any IClaimsPrincipal that tries to execute the method.

    class Program
    {        
        //
        // Declarative access check using the permission class
        //
        [ClaimsPrincipalPermission( System.Security.SecurityAction.Demand, Resource = "resource", Operation = "action")]
        [ClaimsPrincipalPermission( SecurityAction.Demand, Resource = "resource1", Operation = "action1" )]
        static void ProtectedMethod()
        {
        }

The ClaimsPrincipalPermissionAttribute is used to declaratively request an access check using the configured claims authorization manager through the ClaimsPrincipalPermission class. See the Claims Based Authorization SDK sample in the <Installation Directory>\Windows Identity Foundation SDK\<Version>\Samples\Extensibility directory for a full example of how to invoke the claims authorization manager to authorize access for protected sections of code.


System.Object
   System.Attribute
     System.Security.Permissions.SecurityAttribute
       System.Security.Permissions.CodeAccessSecurityAttribute
        Microsoft.IdentityModel.Claims.ClaimsPrincipalPermissionAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

 

Target Platforms

Windows 7, Windows Server 2008 R2, Windows Vista SP2, Windows Server 2008 SP2, Windows Server 2003 SP2 (32-bit or 64-bit)
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ