Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CreateConditions Method
Collapse the table of content
Expand the table of content

SamlSecurityTokenHandler.CreateConditions Method

.NET Framework 4.6 and 4.5

Creates the conditions for the assertion.

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

protected virtual SamlConditions 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.SamlConditions
A SamlConditions 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

Supported in: 4.6, 4.5
© 2015 Microsoft