AuthorizationContext.ClaimSets Property


Gets the set of claims associated with an authorization policy.

Namespace:   System.IdentityModel.Policy
Assembly:  System.IdentityModel (in System.IdentityModel.dll)

public abstract ReadOnlyCollection<ClaimSet> ClaimSets { get; }

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<ClaimSet>

A ReadOnlyCollection<T> of type ClaimSet that contains the set of claims.

Use the ClaimSets property to get the set of claims that were added by the authorization policy. A class deriving from ServiceAuthorizationManager can use the claims to make authorization decisions.

// Iterate through the various claim sets in the AuthorizationContext.
foreach(ClaimSet cs in operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets)
    // Examine only those claim sets issued by System.
    if (cs.Issuer == ClaimSet.System)
        // Iterate through claims of type "".
        foreach (Claim c in cs.FindClaims("", Rights.PossessProperty))
            // Write the Claim resource to the console.
            Console.WriteLine("resource: {0}", c.Resource.ToString());

            // If the Claim resource matches the action URI then return true to allow access.
            if (action == c.Resource.ToString())
                return true;

.NET Framework
Available since 3.0
Return to top