1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
//-----------------------------------------------------------------------
// <copyright file="Saml2Conditions.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
using System;
using System.Collections.ObjectModel;
/// <summary>
/// Represents the Conditions element specified in [Saml2Core, 2.5.1].
/// </summary>
public class Saml2Conditions
{
private Collection<Saml2AudienceRestriction> audienceRestrictions = new Collection<Saml2AudienceRestriction>();
private DateTime? notBefore;
private DateTime? notOnOrAfter;
private bool oneTimeUse;
private Saml2ProxyRestriction proxyRestriction;
/// <summary>
/// Initializes a new instance of <see cref="Saml2Conditions"/>. class.
/// </summary>
public Saml2Conditions()
{
}
/// <summary>
/// Gets a collection of <see cref="Saml2AudienceRestriction"/> that the assertion is addressed to.
/// [Saml2Core, 2.5.1]
/// </summary>
public Collection<Saml2AudienceRestriction> AudienceRestrictions
{
get { return this.audienceRestrictions; }
}
/// <summary>
/// Gets or sets the earliest time instant at which the assertion is valid.
/// [Saml2Core, 2.5.1]
/// </summary>
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;
}
}
/// <summary>
/// Gets or sets the time instant at which the assertion has expired.
/// [Saml2Core, 2.5.1]
/// </summary>
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;
}
}
/// <summary>
/// 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]
/// </summary>
public bool OneTimeUse
{
get { return this.oneTimeUse; }
set { this.oneTimeUse = value; }
}
/// <summary>
/// Gets or sets the <see cref="Saml2ProxyRestriction"/> 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]
/// </summary>
public Saml2ProxyRestriction ProxyRestriction
{
get { return this.proxyRestriction; }
set { this.proxyRestriction = value; }
}
}
}
|