diff options
Diffstat (limited to 'src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs')
-rw-r--r-- | src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs b/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs index 282bdba..f425527 100644 --- a/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs +++ b/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs @@ -6,11 +6,17 @@ namespace DotNetOpenAuth.Configuration { using System.Configuration; + using System.Diagnostics.Contracts; /// <summary> /// Represents the <oauth> element in the host's .config file. /// </summary> - internal class OAuthElement : ConfigurationElement { + internal class OAuthElement : ConfigurationSection { + /// <summary> + /// The name of the oauth section. + /// </summary> + private const string SectionName = "oauth"; + /// <summary> /// The name of the <consumer> sub-element. /// </summary> @@ -28,6 +34,16 @@ namespace DotNetOpenAuth.Configuration { } /// <summary> + /// Gets the configuration section from the .config file. + /// </summary> + public static OAuthElement Configuration { + get { + Contract.Ensures(Contract.Result<OAuthElement>() != null); + return (OAuthElement)ConfigurationManager.GetSection(SectionName) ?? new OAuthElement(); + } + } + + /// <summary> /// Gets or sets the configuration specific for Consumers. /// </summary> [ConfigurationProperty(ConsumerElementName)] |