This documentation is archived and is not being maintained.

EvaluationContext Class

When overridden in a derived class, represents the results of the authorization policies that have been evaluated.


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

public abstract class EvaluationContext

The EvaluationContext type exposes the following members.

Protected methodEvaluationContextInitializes a new instance of the EvaluationContext class.

Public propertyClaimSetsGets a read-only collection of ClaimSet objects that contains the claims added by authorization policies that have been evaluated.
Public propertyGenerationGets the number of times that claims have been added to the evaluation context.
Public propertyPropertiesGets a collection of non-claim properties associated with this EvaluationContext.

Public methodAddClaimSetAdds a set of claims to the evaluation context.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRecordExpirationTimeSets the date and time at which this EvaluationContext is no longer valid.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Claims are added to an EvaluationContext by authorization policies. An authorization policy takes a set of claims, such as those found in a security token, and adds additional claims based on the current set. For instance, an authorization policy might evaluate a claim that contains the date of birth and add a claim that states the user is over 21 years old and add an Over21 claim to the EvaluationContext.

Classes that implement the IAuthorizationPolicy interface do not authorize users, but they enable the ServiceAuthorizationManager class to do so. The ServiceAuthorizationManager calls the Evaluate method for each authorization policy in effect. The Evaluate method determines whether additional claims should be added for the user based on the current claims. An authorization policy's Evaluate method may be called multiple times, as claims are added to the EvaluationContext by other authorization policies. When all authorization policies in effect are done, the ServiceAuthorizationManager class makes authorization decisions based upon the final set of claims. The ServiceAuthorizationManager class then creates an AuthorizationContext that contains an immutable set of claims that reflects these authorization decisions.

An evaluation context contains a set of ClaimSet objects: an expiration time, which specifies the span of time during which the evaluation context is valid, and a unique identifier.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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