Saml2SecurityTokenHandler.CreateConditions Method

Definition

Creates the conditions for the assertion.

C#
protected virtual System.IdentityModel.Tokens.Saml2Conditions CreateConditions(System.IdentityModel.Protocols.WSTrust.Lifetime tokenLifetime, string relyingPartyAddress, System.IdentityModel.Tokens.SecurityTokenDescriptor tokenDescriptor);

Parameters

tokenLifetime
Lifetime

The lifetime of the token.

relyingPartyAddress
String

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

tokenDescriptor
SecurityTokenDescriptor

The token descriptor.

Returns

A Saml2Conditions object that contains the conditions for the assertion.

Remarks

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.

Applies to

Produkt Versiounen
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1