Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
0 out of 1 rated this helpful - Rate this topic

ClaimSet Class

Represents the collection of claims that are associated with an entity.

Namespace: System.IdentityModel.Claims
Assembly: System.IdentityModel (in system.identitymodel.dll)

public abstract class ClaimSet : IEnumerable<Claim>, IEnumerable
public abstract class ClaimSet implements IEnumerable<Claim>, 
	IEnumerable
public abstract class ClaimSet implements IEnumerable<Claim>, 
	IEnumerable
Not applicable.

After the ClaimSet class has been created, it cannot be changed.

Examining the content of a ClaimSet for particular types of claims is a common task when using claim-based authorization. To examine a ClaimSet for the presence of particular claims, use the FindClaims method. The method provides better performance than iterating directly over the ClaimSet.

public class MyServiceAuthorizationManager : ServiceAuthorizationManager
{
 
   protected override bool CheckAccessCore(OperationContext operationContext)
    {                
        // Extract the action URI from the OperationContext. Match this against the claims
        // in the AuthorizationContext.

        string action = operationContext.RequestContext.RequestMessage.Headers.Action;
        Console.WriteLine("action: {0}", action);

        // 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 "http://example.org/claims/allowedoperation".
                foreach (Claim c in cs.FindClaims("http://example.org/claims/allowedoperation", 
                    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;
                }
            }
        }
        
        // If this point is reached, return false to deny access.
        return false;                 
    }

}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.