//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System; using System.Collections.ObjectModel; /// /// Represents the Conditions element specified in [Saml2Core, 2.5.1]. /// public class Saml2Conditions { private Collection audienceRestrictions = new Collection(); private DateTime? notBefore; private DateTime? notOnOrAfter; private bool oneTimeUse; private Saml2ProxyRestriction proxyRestriction; /// /// Initializes a new instance of . class. /// public Saml2Conditions() { } /// /// Gets a collection of that the assertion is addressed to. /// [Saml2Core, 2.5.1] /// public Collection AudienceRestrictions { get { return this.audienceRestrictions; } } /// /// Gets or sets the earliest time instant at which the assertion is valid. /// [Saml2Core, 2.5.1] /// public DateTime? NotBefore { get { return this.notBefore; } set { value = DateTimeUtil.ToUniversalTime(value); // NotBefore must be earlier than NotOnOrAfter if (null != value && null != this.notOnOrAfter) { if (value.Value >= this.notOnOrAfter.Value) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.ID4116)); } } this.notBefore = value; } } /// /// Gets or sets the time instant at which the assertion has expired. /// [Saml2Core, 2.5.1] /// public DateTime? NotOnOrAfter { get { return this.notOnOrAfter; } set { value = DateTimeUtil.ToUniversalTime(value); // NotBefore must be earlier than NotOnOrAfter if (null != value && null != this.notBefore) { if (value.Value <= this.notBefore.Value) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.ID4116)); } } this.notOnOrAfter = value; } } /// /// Gets or sets a value indicating whether the assertion SHOULD be used immediately and MUST NOT /// be retained for future use. [Saml2Core, 2.5.1] /// public bool OneTimeUse { get { return this.oneTimeUse; } set { this.oneTimeUse = value; } } /// /// Gets or sets the that specified limitations that the asserting party imposes on relying parties /// that wish to subsequently act as asserting parties themselves and issue assertions of their own on the basis of the information contained in /// the original assertion. [Saml2Core, 2.5.1] /// public Saml2ProxyRestriction ProxyRestriction { get { return this.proxyRestriction; } set { this.proxyRestriction = value; } } } }