//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Configuration { using System; using System.Configuration; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OAuth2.ChannelElements; /// /// Represents the <oauth2/authorizationServer> element in the host's .config file. /// internal class OAuth2AuthorizationServerElement : ConfigurationElement { /// /// The name of the <clientAuthenticationModules> sub-element. /// private const string ClientAuthenticationModulesElementName = "clientAuthenticationModules"; /// /// The built-in set of identifier discovery services. /// private static readonly TypeConfigurationCollection defaultClientAuthenticationModules = new TypeConfigurationCollection(); /// /// Initializes a new instance of the class. /// internal OAuth2AuthorizationServerElement() { } /// /// Gets or sets the services to use for discovering service endpoints for identifiers. /// /// /// If no discovery services are defined in the (web) application's .config file, /// the default set of discovery services built into the library are used. /// [ConfigurationProperty(ClientAuthenticationModulesElementName, IsDefaultCollection = false)] [ConfigurationCollection(typeof(TypeConfigurationCollection))] internal TypeConfigurationCollection ClientAuthenticationModules { get { var configResult = (TypeConfigurationCollection)this[ClientAuthenticationModulesElementName]; return configResult != null && configResult.Count > 0 ? configResult : defaultClientAuthenticationModules; } set { this[ClientAuthenticationModulesElementName] = value; } } } }