summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2.Client/Configuration/OAuth2ClientSection.cs
blob: 1ee5aa5a322fb447c1c786eb4d9dc412d423fc1d (plain)
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
//-----------------------------------------------------------------------
// <copyright file="OAuth2ClientSection.cs" company="Outercurve Foundation">
//     Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Configuration {
	using System.Configuration;
	using System.Diagnostics.Contracts;

	/// <summary>
	/// Represents the &lt;oauth2/client&gt; section in the host's .config file.
	/// </summary>
	internal class OAuth2ClientSection : ConfigurationSection {
		/// <summary>
		/// The name of the oauth2/client section.
		/// </summary>
		private const string SectionName = OAuth2SectionGroup.SectionName + "/client";

		/// <summary>
		/// Initializes a new instance of the <see cref="OAuth2ClientSection"/> class.
		/// </summary>
		internal OAuth2ClientSection() {
		}

		/// <summary>
		/// Gets the configuration section from the .config file.
		/// </summary>
		internal static OAuth2ClientSection Configuration {
			get {
				Contract.Ensures(Contract.Result<OAuth2ClientSection>() != null);
				return (OAuth2ClientSection)ConfigurationManager.GetSection(SectionName) ?? new OAuth2ClientSection();
			}
		}
	}
}