Individual association types can now have configured lifetimes.
[dotnetoauth.git] / src / DotNetOpenAuth / OpenId / Provider / ProviderSecuritySettings.cs
blobcb35c3c5b3230a4a851a17eec2c9c587dee60ddf
1 //-----------------------------------------------------------------------
2 // <copyright file="ProviderSecuritySettings.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
4 // </copyright>
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenAuth.OpenId.Provider {
8 using System;
9 using System.Collections.Generic;
10 using DotNetOpenAuth.Messaging;
12 /// <summary>
13 /// Security settings that are applicable to providers.
14 /// </summary>
15 public sealed class ProviderSecuritySettings : SecuritySettings {
16 /// <summary>
17 /// The subset of association types and their customized lifetimes.
18 /// </summary>
19 private IDictionary<string, TimeSpan> associationLifetimes = new Dictionary<string, TimeSpan>();
21 /// <summary>
22 /// Initializes a new instance of the <see cref="ProviderSecuritySettings"/> class.
23 /// </summary>
24 internal ProviderSecuritySettings()
25 : base(true) {
28 /// <summary>
29 /// Gets a subset of the available association types and their
30 /// customized maximum lifetimes.
31 /// </summary>
32 public IDictionary<string, TimeSpan> AssociationLifetimes {
33 get { return this.associationLifetimes; }
36 /// <summary>
37 /// Gets or sets a value indicating whether OpenID 1.x relying parties that may not be
38 /// protecting their users from replay attacks are protected from
39 /// replay attacks by this provider.
40 /// *** This property is a placeholder for a feature that has not been written yet. ***
41 /// </summary>
42 /// <remarks>
43 /// <para>Nonces for protection against replay attacks were not mandated
44 /// by OpenID 1.x, which leaves users open to replay attacks.</para>
45 /// <para>This feature works by preventing associations from being formed
46 /// with OpenID 1.x relying parties, thereby forcing them into
47 /// "dumb" mode and verifying every claim with this provider.
48 /// This gives the provider an opportunity to verify its own nonce
49 /// to protect against replay attacks.</para>
50 /// </remarks>
51 internal bool ProtectDownlevelReplayAttacks { get; set; }