diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-18 21:21:34 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-18 21:21:34 -0700 |
commit | 548147a67be56f046a7d4515d61a8210d78677de (patch) | |
tree | 95ad7e72f40c60637569b30f292cd5ad9f583737 /src/DotNetOpenAuth.OAuth2/Configuration | |
parent | 1cefb24fd021a0292c13d6bfd61bd81543d4dfce (diff) | |
download | DotNetOpenAuth-548147a67be56f046a7d4515d61a8210d78677de.zip DotNetOpenAuth-548147a67be56f046a7d4515d61a8210d78677de.tar.gz DotNetOpenAuth-548147a67be56f046a7d4515d61a8210d78677de.tar.bz2 |
Fixed up the configuration story for OAuth 2.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/Configuration')
4 files changed, 4 insertions, 150 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2AuthorizationServerElement.cs b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2AuthorizationServerElement.cs deleted file mode 100644 index 1329ce2..0000000 --- a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2AuthorizationServerElement.cs +++ /dev/null @@ -1,54 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="OAuth2AuthorizationServerElement.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.Configuration { - using System; - using System.Configuration; - using DotNetOpenAuth.Messaging.Bindings; - using DotNetOpenAuth.OAuth2.ChannelElements; - - /// <summary> - /// Represents the <oauth2/authorizationServer> element in the host's .config file. - /// </summary> - internal class OAuth2AuthorizationServerElement : ConfigurationElement { - /// <summary> - /// The name of the <clientAuthenticationModules> sub-element. - /// </summary> - private const string ClientAuthenticationModulesElementName = "clientAuthenticationModules"; - - /// <summary> - /// The built-in set of identifier discovery services. - /// </summary> - private static readonly TypeConfigurationCollection<IClientAuthenticationModule> defaultClientAuthenticationModules = - new TypeConfigurationCollection<IClientAuthenticationModule>(); - - /// <summary> - /// Initializes a new instance of the <see cref="OAuth2AuthorizationServerElement"/> class. - /// </summary> - internal OAuth2AuthorizationServerElement() { - } - - /// <summary> - /// Gets or sets the services to use for discovering service endpoints for identifiers. - /// </summary> - /// <remarks> - /// 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. - /// </remarks> - [ConfigurationProperty(ClientAuthenticationModulesElementName, IsDefaultCollection = false)] - [ConfigurationCollection(typeof(TypeConfigurationCollection<IClientAuthenticationModule>))] - internal TypeConfigurationCollection<IClientAuthenticationModule> ClientAuthenticationModules { - get { - var configResult = (TypeConfigurationCollection<IClientAuthenticationModule>)this[ClientAuthenticationModulesElementName]; - return configResult != null && configResult.Count > 0 ? configResult : defaultClientAuthenticationModules; - } - - set { - this[ClientAuthenticationModulesElementName] = value; - } - } - } -} diff --git a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2ClientElement.cs b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2ClientElement.cs deleted file mode 100644 index 95a7a36..0000000 --- a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2ClientElement.cs +++ /dev/null @@ -1,20 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="OAuth2ClientElement.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.Configuration { - using System.Configuration; - - /// <summary> - /// Represents the <oauth2/client> element in the host's .config file. - /// </summary> - internal class OAuth2ClientElement : ConfigurationElement { - /// <summary> - /// Initializes a new instance of the <see cref="OAuth2ClientElement"/> class. - /// </summary> - internal OAuth2ClientElement() { - } - } -} diff --git a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2Element.cs b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2Element.cs index 6ba7e23..858d27b 100644 --- a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2Element.cs +++ b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2Element.cs @@ -11,68 +11,16 @@ namespace DotNetOpenAuth.Configuration { /// <summary> /// Represents the <oauth> element in the host's .config file. /// </summary> - internal class OAuth2Element : ConfigurationSection { + internal class OAuth2SectionGroup : ConfigurationSectionGroup { /// <summary> /// The name of the oauth section. /// </summary> - private const string SectionName = DotNetOpenAuthSection.SectionName + "/oauth2"; + internal const string SectionName = DotNetOpenAuthSection.SectionName + "/oauth2"; /// <summary> - /// The name of the <client> sub-element. + /// Initializes a new instance of the <see cref="OAuth2SectionGroup"/> class. /// </summary> - private const string ClientElementName = "client"; - - /// <summary> - /// The name of the <authorizationServer> sub-element. - /// </summary> - private const string AuthorizationServerElementName = "authorizationServer"; - - /// <summary> - /// The name of the <resourceServer> sub-element. - /// </summary> - private const string ResourceServerElementName = "resourceServer"; - - /// <summary> - /// Initializes a new instance of the <see cref="OAuth2Element"/> class. - /// </summary> - internal OAuth2Element() { - } - - /// <summary> - /// Gets the configuration section from the .config file. - /// </summary> - public static OAuth2Element Configuration { - get { - Contract.Ensures(Contract.Result<OAuth2Element>() != null); - return (OAuth2Element)ConfigurationManager.GetSection(SectionName) ?? new OAuth2Element(); - } - } - - /// <summary> - /// Gets or sets the configuration specific for Clients. - /// </summary> - [ConfigurationProperty(ClientElementName)] - internal OAuth2ClientElement Client { - get { return (OAuth2ClientElement)this[ClientElementName] ?? new OAuth2ClientElement(); } - set { this[ClientElementName] = value; } - } - - /// <summary> - /// Gets or sets the configuration specific for Authorization Servers. - /// </summary> - [ConfigurationProperty(AuthorizationServerElementName)] - internal OAuth2AuthorizationServerElement AuthorizationServer { - get { return (OAuth2AuthorizationServerElement)this[AuthorizationServerElementName] ?? new OAuth2AuthorizationServerElement(); } - set { this[AuthorizationServerElementName] = value; } - } - - /// <summary> - /// Gets or sets the configuration specific for Resource Servers. - /// </summary> - [ConfigurationProperty(ResourceServerElementName)] - internal OAuth2ResourceServerElement ResourceServer { - get { return (OAuth2ResourceServerElement)this[ResourceServerElementName] ?? new OAuth2ResourceServerElement(); } - set { this[ResourceServerElementName] = value; } + internal OAuth2SectionGroup() { } } } diff --git a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2ResourceServerElement.cs b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2ResourceServerElement.cs deleted file mode 100644 index a07e973..0000000 --- a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2ResourceServerElement.cs +++ /dev/null @@ -1,20 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="OAuth2ResourceServerElement.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.Configuration { - using System.Configuration; - - /// <summary> - /// Represents the <oauth2/resourceServer> element in the host's .config file. - /// </summary> - internal class OAuth2ResourceServerElement : ConfigurationElement { - /// <summary> - /// Initializes a new instance of the <see cref="OAuth2ResourceServerElement"/> class. - /// </summary> - internal OAuth2ResourceServerElement() { - } - } -} |