Saml2SecurityTokenHandler.CreateConditions Method (Lifetime, String, SecurityTokenDescriptor)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Creates the conditions for the assertion.

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

protected virtual Saml2Conditions CreateConditions(
	Lifetime tokenLifetime,
	string relyingPartyAddress,
	SecurityTokenDescriptor tokenDescriptor


Type: System.IdentityModel.Protocols.WSTrust.Lifetime

The lifetime of the token.

Type: System.String

The endpoint address for which the token is created. The address is modeled as an AudienceRestriction condition.

Type: System.IdentityModel.Tokens.SecurityTokenDescriptor

The token descriptor.

Return Value

Type: System.IdentityModel.Tokens.Saml2Conditions

A Saml2Conditions object that contains the conditions for the assertion.

Generally, conditions should be included in assertions to limit the impact of misuse of the assertion. Specifying the NotBefore and NotOnOrAfter conditions can limit the period of vulnerability in the case of a compromised assertion. The AudienceRestrictionCondition can be used to explicitly state the intended relying party or parties of the assertion, which coupled with appropriate audience restriction enforcement at relying parties can help to mitigate spoofing attacks between relying parties.

The default implementation creates NotBefore and NotOnOrAfter conditions based on the Lifetime property of the tokenDescriptor. It will also generate an AudienceRestrictionCondition limiting consumption of the assertion to the AppliesToAddress property of the tokenDescriptor.

.NET Framework
Available since 4.5
Return to top