//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Configuration { using System.Configuration; /// /// Represents the <oauth> element in the host's .config file. /// internal class OAuthElement : ConfigurationSection { /// /// The name of the oauth section. /// private const string SectionName = DotNetOpenAuthSection.SectionName + "/oauth"; /// /// The name of the <consumer> sub-element. /// private const string ConsumerElementName = "consumer"; /// /// The name of the <serviceProvider> sub-element. /// private const string ServiceProviderElementName = "serviceProvider"; /// /// Initializes a new instance of the class. /// internal OAuthElement() { } /// /// Gets the configuration section from the .config file. /// public static OAuthElement Configuration { get { return (OAuthElement)ConfigurationManager.GetSection(SectionName) ?? new OAuthElement(); } } /// /// Gets or sets the configuration specific for Consumers. /// [ConfigurationProperty(ConsumerElementName)] internal OAuthConsumerElement Consumer { get { return (OAuthConsumerElement)this[ConsumerElementName] ?? new OAuthConsumerElement(); } set { this[ConsumerElementName] = value; } } /// /// Gets or sets the configuration specific for Service Providers. /// [ConfigurationProperty(ServiceProviderElementName)] internal OAuthServiceProviderElement ServiceProvider { get { return (OAuthServiceProviderElement)this[ServiceProviderElementName] ?? new OAuthServiceProviderElement(); } set { this[ServiceProviderElementName] = value; } } } }