diff options
26 files changed, 89 insertions, 81 deletions
diff --git a/projecttemplates/RelyingPartyLogic/NonceDbStore.cs b/projecttemplates/RelyingPartyLogic/NonceDbStore.cs index 951bf0f..01a59b5 100644 --- a/projecttemplates/RelyingPartyLogic/NonceDbStore.cs +++ b/projecttemplates/RelyingPartyLogic/NonceDbStore.cs @@ -64,7 +64,7 @@ namespace RelyingPartyLogic { Context = context, Code = nonce, IssuedUtc = timestampUtc, - ExpiresUtc = timestampUtc + DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetime, + ExpiresUtc = timestampUtc + DotNetOpenAuthSection.Messaging.MaximumMessageLifetime, }; // The database columns [context] and [code] MUST be using diff --git a/samples/OpenIdProviderWebForms/Code/CustomStore.cs b/samples/OpenIdProviderWebForms/Code/CustomStore.cs index b2316a4..6688e27 100644 --- a/samples/OpenIdProviderWebForms/Code/CustomStore.cs +++ b/samples/OpenIdProviderWebForms/Code/CustomStore.cs @@ -67,7 +67,7 @@ namespace OpenIdProviderWebForms.Code { return false; } - TimeSpan maxMessageAge = DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetime; + TimeSpan maxMessageAge = DotNetOpenAuthSection.Messaging.MaximumMessageLifetime; dataSet.Nonce.AddNonceRow(context, nonce, timestampUtc, timestampUtc + maxMessageAge); return true; } diff --git a/samples/OpenIdRelyingPartyWebForms/Code/CustomStore.cs b/samples/OpenIdRelyingPartyWebForms/Code/CustomStore.cs index 3ab6292..3f52015 100644 --- a/samples/OpenIdRelyingPartyWebForms/Code/CustomStore.cs +++ b/samples/OpenIdRelyingPartyWebForms/Code/CustomStore.cs @@ -68,7 +68,7 @@ namespace OpenIdRelyingPartyWebForms.Code { return false; } - TimeSpan maxMessageAge = DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetime; + TimeSpan maxMessageAge = DotNetOpenAuthSection.Messaging.MaximumMessageLifetime; dataSet.Nonce.AddNonceRow(context, nonce, timestampUtc, timestampUtc + maxMessageAge); return true; } diff --git a/samples/OpenIdRelyingPartyWebForms/Web.config b/samples/OpenIdRelyingPartyWebForms/Web.config index 485f8dc..6c1648b 100644 --- a/samples/OpenIdRelyingPartyWebForms/Web.config +++ b/samples/OpenIdRelyingPartyWebForms/Web.config @@ -3,7 +3,11 @@ <configSections> <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" /> - <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/> + <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection"> + <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement" requirePermission="false" allowLocation="true" /> + <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement" requirePermission="false" allowLocation="true" /> + <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement" requirePermission="false" allowLocation="true" /> + </sectionGroup> </configSections> <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names), @@ -37,7 +41,7 @@ <behaviors> <!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible with OPs that use Attribute Exchange (in various formats). --> - <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" /> + <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth.OpenId" /> <!--<add type="DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile, DotNetOpenAuth" />--> </behaviors> <!-- Uncomment the following to activate the sample custom store. --> diff --git a/samples/OpenIdRelyingPartyWebForms/login.aspx b/samples/OpenIdRelyingPartyWebForms/login.aspx index e35a649..554540d 100644 --- a/samples/OpenIdRelyingPartyWebForms/login.aspx +++ b/samples/OpenIdRelyingPartyWebForms/login.aspx @@ -1,8 +1,8 @@ <%@ Page Language="C#" AutoEventWireup="True" CodeBehind="login.aspx.cs" Inherits="OpenIdRelyingPartyWebForms.login" ValidateRequest="false" MasterPageFile="~/Site.Master" %> -<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %> -<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.Extensions.SimpleRegistration" TagPrefix="sreg" %> +<%@ Register Assembly="DotNetOpenAuth.OpenId" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %> +<%@ Register Assembly="DotNetOpenAuth.OpenId" Namespace="DotNetOpenAuth.OpenId.Extensions.SimpleRegistration" TagPrefix="sreg" %> <asp:Content runat="server" ContentPlaceHolderID="Main"> <h2>Login Page </h2> <rp:OpenIdLogin ID="OpenIdLogin1" runat="server" CssClass="openid_login" RequestCountry="Request" diff --git a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs index 84121ef..e628097 100644 --- a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs +++ b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs @@ -35,7 +35,7 @@ namespace DotNetOpenAuth.InfoCard { /// Gets the maximum amount the token can be out of sync with time. /// </summary> internal static TimeSpan MaximumClockSkew { - get { return DotNetOpenAuth.Configuration.DotNetOpenAuthSection.Configuration.Messaging.MaximumClockSkew; } + get { return DotNetOpenAuth.Configuration.DotNetOpenAuthSection.Messaging.MaximumClockSkew; } } /// <summary> diff --git a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs index d41460b..5e2a494 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs @@ -13,16 +13,11 @@ namespace DotNetOpenAuth.Configuration { /// this library's settings. /// </summary> [ContractVerification(true)] - public class DotNetOpenAuthSection : ConfigurationSection { + public class DotNetOpenAuthSection : ConfigurationSectionGroup { /// <summary> /// The name of the section under which this library's settings must be found. /// </summary> - private const string SectionName = "dotNetOpenAuth"; - - /// <summary> - /// The name of the <messaging> sub-element. - /// </summary> - private const string MessagingElementName = "messaging"; + internal const string SectionName = "dotNetOpenAuth"; /// <summary> /// The name of the <openid> sub-element. @@ -35,21 +30,9 @@ namespace DotNetOpenAuth.Configuration { private const string OAuthElementName = "oauth"; /// <summary> - /// The name of the <reporting> sub-element. - /// </summary> - private const string ReportingElementName = "reporting"; - - /// <summary> - /// The name of the <webResourceUrlProvider> sub-element. - /// </summary> - private const string WebResourceUrlProviderName = "webResourceUrlProvider"; - - /// <summary> /// Initializes a new instance of the <see cref="DotNetOpenAuthSection"/> class. /// </summary> internal DotNetOpenAuthSection() { - Contract.Assume(this.SectionInformation != null); - this.SectionInformation.AllowLocation = false; } /// <summary> @@ -62,43 +45,17 @@ namespace DotNetOpenAuth.Configuration { } } - /// <summary> - /// Gets or sets the configuration for the messaging framework. - /// </summary> - [ConfigurationProperty(MessagingElementName)] - public MessagingElement Messaging { - get { - Contract.Ensures(Contract.Result<MessagingElement>() != null); - return (MessagingElement)this[MessagingElementName] ?? new MessagingElement(); - } - - set { - this[MessagingElementName] = value; - } + public static MessagingElement Messaging { + get { return MessagingElement.Configuration; } } - /// <summary> - /// Gets or sets the configuration for reporting. - /// </summary> - [ConfigurationProperty(ReportingElementName)] - internal ReportingElement Reporting { - get { - Contract.Ensures(Contract.Result<ReportingElement>() != null); - return (ReportingElement)this[ReportingElementName] ?? new ReportingElement(); - } - - set { - this[ReportingElementName] = value; - } + internal TypeConfigurationElement<IEmbeddedResourceRetrieval> EmbeddedResourceRetrievalProvider { + get { return /*(TypeConfigurationElement<IEmbeddedResourceRetrieval>)this[WebResourceUrlProviderName] ??*/ new TypeConfigurationElement<IEmbeddedResourceRetrieval>(); } + set { /*this[WebResourceUrlProviderName] = value;*/ } } - /// <summary> - /// Gets or sets the type to use for obtaining URLs that fetch embedded resource streams. - /// </summary> - [ConfigurationProperty(WebResourceUrlProviderName)] - internal TypeConfigurationElement<IEmbeddedResourceRetrieval> EmbeddedResourceRetrievalProvider { - get { return (TypeConfigurationElement<IEmbeddedResourceRetrieval>)this[WebResourceUrlProviderName] ?? new TypeConfigurationElement<IEmbeddedResourceRetrieval>(); } - set { this[WebResourceUrlProviderName] = value; } + internal static ReportingElement Reporting { + get { return ReportingElement.Configuration; } } } } diff --git a/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs index 1c46bcf..cec2552 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs @@ -15,7 +15,7 @@ namespace DotNetOpenAuth.Configuration { /// Represents the <messaging> element in the host's .config file. /// </summary> [ContractVerification(true)] - public class MessagingElement : ConfigurationElement { + public class MessagingElement : ConfigurationSection { /// <summary> /// The name of the <untrustedWebRequest> sub-element. /// </summary> @@ -61,6 +61,21 @@ namespace DotNetOpenAuth.Configuration { private const string PrivateSecretMaximumAgeConfigName = "privateSecretMaximumAge"; /// <summary> + /// The name of the <messaging> sub-element. + /// </summary> + private const string MessagingElementName = DotNetOpenAuthSection.SectionName + "/messaging"; + + /// <summary> + /// Gets the configuration section from the .config file. + /// </summary> + public static MessagingElement Configuration { + get { + Contract.Ensures(Contract.Result<MessagingElement>() != null); + return (MessagingElement)ConfigurationManager.GetSection(MessagingElementName) ?? new MessagingElement(); + } + } + + /// <summary> /// Gets the actual maximum message lifetime that a program should allow. /// </summary> /// <value>The sum of the <see cref="MaximumMessageLifetime"/> and diff --git a/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs index 2374448..3cd0af1 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs @@ -10,11 +10,12 @@ namespace DotNetOpenAuth.Configuration { using System.Configuration; using System.Linq; using System.Text; + using System.Diagnostics.Contracts; /// <summary> /// Represents the <reporting> element in the host's .config file. /// </summary> - internal class ReportingElement : ConfigurationElement { + internal class ReportingElement : ConfigurationSection { /// <summary> /// The name of the @enabled attribute. /// </summary> @@ -51,6 +52,11 @@ namespace DotNetOpenAuth.Configuration { private const string IncludeCulturesAttributeName = "includeCultures"; /// <summary> + /// The name of the <reporting> sub-element. + /// </summary> + private const string ReportingElementName = DotNetOpenAuthSection.SectionName + "/reporting"; + + /// <summary> /// The default value for the @minimumFlushInterval attribute. /// </summary> #if DEBUG @@ -66,6 +72,16 @@ namespace DotNetOpenAuth.Configuration { } /// <summary> + /// Gets the configuration section from the .config file. + /// </summary> + public static ReportingElement Configuration { + get { + Contract.Ensures(Contract.Result<ReportingElement>() != null); + return (ReportingElement)ConfigurationManager.GetSection(ReportingElementName) ?? new ReportingElement(); + } + } + + /// <summary> /// Gets or sets a value indicating whether this reporting is enabled. /// </summary> /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value> diff --git a/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs index 89cd435..40a3d0c 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs @@ -7,12 +7,18 @@ namespace DotNetOpenAuth.Configuration { using System; using System.Configuration; + using System.Diagnostics.Contracts; /// <summary> /// Represents the section of a .config file where security policies regarding web requests /// to user-provided, untrusted servers is controlled. /// </summary> internal class UntrustedWebRequestElement : ConfigurationElement { + /// <summary> + /// The name of the <webResourceUrlProvider> sub-element. + /// </summary> + private const string WebResourceUrlProviderName = "webResourceUrlProvider"; + #region Attribute names /// <summary> @@ -58,6 +64,16 @@ namespace DotNetOpenAuth.Configuration { #endregion /// <summary> + /// Gets the configuration section from the .config file. + /// </summary> + public static UntrustedWebRequestElement Configuration { + get { + Contract.Ensures(Contract.Result<UntrustedWebRequestElement>() != null); + return (UntrustedWebRequestElement)ConfigurationManager.GetSection(WebResourceUrlProviderName) ?? new UntrustedWebRequestElement(); + } + } + + /// <summary> /// Gets or sets the read/write timeout after which an HTTP request will fail. /// </summary> [ConfigurationProperty(ReadWriteTimeoutConfigName, DefaultValue = "00:00:01.500")] diff --git a/src/DotNetOpenAuth.Messaging/Messaging/Bindings/StandardExpirationBindingElement.cs b/src/DotNetOpenAuth.Messaging/Messaging/Bindings/StandardExpirationBindingElement.cs index 4396c16..f8c8c6a 100644 --- a/src/DotNetOpenAuth.Messaging/Messaging/Bindings/StandardExpirationBindingElement.cs +++ b/src/DotNetOpenAuth.Messaging/Messaging/Bindings/StandardExpirationBindingElement.cs @@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// being discarded as too old. /// </summary> protected internal static TimeSpan MaximumMessageAge { - get { return Configuration.DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetime; } + get { return Configuration.DotNetOpenAuthSection.Messaging.MaximumMessageLifetime; } } #region IChannelBindingElement Methods @@ -92,7 +92,7 @@ namespace DotNetOpenAuth.Messaging.Bindings { // Mitigate HMAC attacks (just guessing the signature until they get it) by // disallowing post-dated messages. ErrorUtilities.VerifyProtocol( - creationDate <= DateTime.UtcNow + DotNetOpenAuthSection.Configuration.Messaging.MaximumClockSkew, + creationDate <= DateTime.UtcNow + DotNetOpenAuthSection.Messaging.MaximumClockSkew, MessagingStrings.MessageTimestampInFuture, creationDate); diff --git a/src/DotNetOpenAuth.Messaging/Messaging/Channel.cs b/src/DotNetOpenAuth.Messaging/Messaging/Channel.cs index bff395b..cb32ca3 100644 --- a/src/DotNetOpenAuth.Messaging/Messaging/Channel.cs +++ b/src/DotNetOpenAuth.Messaging/Messaging/Channel.cs @@ -134,7 +134,7 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// Backing field for the <see cref="MaximumIndirectMessageUrlLength"/> property. /// </summary> - private int maximumIndirectMessageUrlLength = Configuration.DotNetOpenAuthSection.Configuration.Messaging.MaximumIndirectMessageUrlLength; + private int maximumIndirectMessageUrlLength = Configuration.DotNetOpenAuthSection.Messaging.MaximumIndirectMessageUrlLength; /// <summary> /// Initializes a new instance of the <see cref="Channel"/> class. diff --git a/src/DotNetOpenAuth.Messaging/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Messaging/Messaging/MessagingUtilities.cs index 8fc691f..e88f2a9 100644 --- a/src/DotNetOpenAuth.Messaging/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth.Messaging/Messaging/MessagingUtilities.cs @@ -89,7 +89,7 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// The default lifetime of a private secret. /// </summary> - private static readonly TimeSpan SymmetricSecretKeyLifespan = Configuration.DotNetOpenAuthSection.Configuration.Messaging.PrivateSecretMaximumAge; + private static readonly TimeSpan SymmetricSecretKeyLifespan = Configuration.DotNetOpenAuthSection.Messaging.PrivateSecretMaximumAge; /// <summary> /// A character array containing just the = character. diff --git a/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs b/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs index bf92803..e0e48fe 100644 --- a/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs +++ b/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs @@ -233,7 +233,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { try { if (this.IsConstantValue) { string constantValue = this.GetValue(message); - var caseSensitivity = DotNetOpenAuthSection.Configuration.Messaging.Strict ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + var caseSensitivity = DotNetOpenAuthSection.Messaging.Strict ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; if (!string.Equals(constantValue, value, caseSensitivity)) { throw new ArgumentException(string.Format( CultureInfo.CurrentCulture, diff --git a/src/DotNetOpenAuth.Messaging/Messaging/UntrustedWebRequestHandler.cs b/src/DotNetOpenAuth.Messaging/Messaging/UntrustedWebRequestHandler.cs index 838b7e8..a1a34a5 100644 --- a/src/DotNetOpenAuth.Messaging/Messaging/UntrustedWebRequestHandler.cs +++ b/src/DotNetOpenAuth.Messaging/Messaging/UntrustedWebRequestHandler.cs @@ -174,7 +174,7 @@ namespace DotNetOpenAuth.Messaging { /// Gets the configuration for this class that is specified in the host's .config file. /// </summary> private static UntrustedWebRequestElement Configuration { - get { return DotNetOpenAuthSection.Configuration.Messaging.UntrustedWebRequest; } + get { return DotNetOpenAuthSection.Messaging.UntrustedWebRequest; } } #region IDirectWebRequestHandler Members diff --git a/src/DotNetOpenAuth.Messaging/Reporting.cs b/src/DotNetOpenAuth.Messaging/Reporting.cs index fcd35c7..c528972 100644 --- a/src/DotNetOpenAuth.Messaging/Reporting.cs +++ b/src/DotNetOpenAuth.Messaging/Reporting.cs @@ -115,7 +115,7 @@ namespace DotNetOpenAuth { [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "We do more than field initialization here.")] [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Reporting MUST NOT cause unhandled exceptions.")] static Reporting() { - Enabled = DotNetOpenAuthSection.Configuration.Reporting.Enabled; + Enabled = DotNetOpenAuthSection.Reporting.Enabled; } /// <summary> @@ -150,7 +150,7 @@ namespace DotNetOpenAuth { /// Gets the configuration to use for reporting. /// </summary> internal static ReportingElement Configuration { - get { return DotNetOpenAuthSection.Configuration.Reporting; } + get { return DotNetOpenAuthSection.Reporting; } } /// <summary> diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs index 4569c93..b0e6203 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs @@ -40,7 +40,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// </summary> /// <value>This interval need not account for clock skew because it is only compared within a single authorization server or farm of servers.</value> internal static TimeSpan MaximumMessageAge { - get { return Configuration.DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetimeNoSkew; } + get { return Configuration.DotNetOpenAuthSection.Messaging.MaximumMessageLifetimeNoSkew; } } /// <summary> diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRequestBase.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRequestBase.cs index 10dc231..4bf593a 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRequestBase.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRequestBase.cs @@ -71,7 +71,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { protected override void EnsureValidMessage() { base.EnsureValidMessage(); ErrorUtilities.VerifyProtocol( - DotNetOpenAuthSection.Configuration.Messaging.RelaxSslRequirements || this.Recipient.IsTransportSecure(), + DotNetOpenAuthSection.Messaging.RelaxSslRequirements || this.Recipient.IsTransportSecure(), OAuthStrings.HttpsRequired); } } diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationRequest.cs index 856fe22..1cb2bab 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationRequest.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationRequest.cs @@ -110,7 +110,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { base.EnsureValidMessage(); ErrorUtilities.VerifyProtocol( - DotNetOpenAuthSection.Configuration.Messaging.RelaxSslRequirements || this.Recipient.IsTransportSecure(), + DotNetOpenAuthSection.Messaging.RelaxSslRequirements || this.Recipient.IsTransportSecure(), OAuthStrings.HttpsRequired); ErrorUtilities.VerifyProtocol(this.Callback == null || this.Callback.IsAbsoluteUri, this, OAuthStrings.AbsoluteUriRequired, Protocol.redirect_uri); } diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs index 19606fa..4742172 100644 --- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs +++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs @@ -19,7 +19,7 @@ namespace DotNetOpenAuth.Configuration { /// <summary> /// The name of the section under which this library's settings must be found. /// </summary> - private const string SectionName = "openId"; + private const string SectionName = DotNetOpenAuthSection.SectionName + "/openid"; /// <summary> /// The name of the <relyingParty> sub-element. diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs index e116f52..225b1e7 100644 --- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs +++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs @@ -247,7 +247,7 @@ namespace DotNetOpenAuth.Configuration { settings.MinimumRequiredOpenIdVersion = this.MinimumRequiredOpenIdVersion; settings.MinimumHashBitLength = this.MinimumHashBitLength; settings.MaximumHashBitLength = this.MaximumHashBitLength; - settings.PrivateSecretMaximumAge = DotNetOpenAuthSection.Configuration.Messaging.PrivateSecretMaximumAge; + settings.PrivateSecretMaximumAge = DotNetOpenAuthSection.Messaging.PrivateSecretMaximumAge; settings.RejectUnsolicitedAssertions = this.RejectUnsolicitedAssertions; settings.RejectDelegatingIdentifiers = this.RejectDelegatingIdentifiers; settings.IgnoreUnsignedExtensions = this.IgnoreUnsignedExtensions; diff --git a/src/DotNetOpenAuth.OpenId/Mvc/OpenIdHelper.cs b/src/DotNetOpenAuth.OpenId/Mvc/OpenIdHelper.cs index 5436837..b98e0d6 100644 --- a/src/DotNetOpenAuth.OpenId/Mvc/OpenIdHelper.cs +++ b/src/DotNetOpenAuth.OpenId/Mvc/OpenIdHelper.cs @@ -117,7 +117,7 @@ window.openid_trace = {1}; // causes lots of messages"; // Positive assertions can last no longer than this library is willing to consider them valid, // and when they come with OP private associations they last no longer than the OP is willing // to consider them valid. We assume the OP will hold them valid for at least five minutes. - double assertionLifetimeInMilliseconds = Math.Min(TimeSpan.FromMinutes(5).TotalMilliseconds, Math.Min(OpenIdElement.Configuration.MaxAuthenticationTime.TotalMilliseconds, DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetime.TotalMilliseconds)); + double assertionLifetimeInMilliseconds = Math.Min(TimeSpan.FromMinutes(5).TotalMilliseconds, Math.Min(OpenIdElement.Configuration.MaxAuthenticationTime.TotalMilliseconds, DotNetOpenAuthSection.Messaging.MaximumMessageLifetime.TotalMilliseconds)); blockBuilder.WriteLine( "{0} = {1};", OpenIdRelyingPartyAjaxControlBase.MaxPositiveAssertionLifetimeJsName, diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfile.cs b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfile.cs index 66ac276..317a2b4 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfile.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfile.cs @@ -37,7 +37,7 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// <summary> /// Backing field for the <see cref="DisableSslRequirement"/> static property. /// </summary> - private static bool disableSslRequirement = DotNetOpenAuthSection.Configuration.Messaging.RelaxSslRequirements; + private static bool disableSslRequirement = DotNetOpenAuthSection.Messaging.RelaxSslRequirements; /// <summary> /// Initializes a new instance of the <see cref="GsaIcamProfile"/> class. diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs index 04f8d54..eaaba8c 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs @@ -386,7 +386,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { // Positive assertions can last no longer than this library is willing to consider them valid, // and when they come with OP private associations they last no longer than the OP is willing // to consider them valid. We assume the OP will hold them valid for at least five minutes. - double assertionLifetimeInMilliseconds = Math.Min(TimeSpan.FromMinutes(5).TotalMilliseconds, Math.Min(OpenIdElement.Configuration.MaxAuthenticationTime.TotalMilliseconds, DotNetOpenAuthSection.Configuration.Messaging.MaximumMessageLifetime.TotalMilliseconds)); + double assertionLifetimeInMilliseconds = Math.Min(TimeSpan.FromMinutes(5).TotalMilliseconds, Math.Min(OpenIdElement.Configuration.MaxAuthenticationTime.TotalMilliseconds, DotNetOpenAuthSection.Messaging.MaximumMessageLifetime.TotalMilliseconds)); initScript.AppendLine(MaxPositiveAssertionLifetimeJsName + " = " + assertionLifetimeInMilliseconds.ToString(CultureInfo.InvariantCulture) + ";"); // We register this callback code explicitly with a specific type rather than the derived-type of the control diff --git a/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs b/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs index 0caf17a..0cff4b7 100644 --- a/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs +++ b/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs @@ -15,7 +15,7 @@ namespace DotNetOpenAuth.Test.Configuration { public class SectionTests { [TestCase] public void UntrustedWebRequest() { - var uwr = DotNetOpenAuthSection.Configuration.Messaging.UntrustedWebRequest; + var uwr = DotNetOpenAuthSection.Messaging.UntrustedWebRequest; Assert.AreEqual(TimeSpan.Parse("01:23:45"), uwr.Timeout); Assert.AreEqual(TimeSpan.Parse("01:23:56"), uwr.ReadWriteTimeout); diff --git a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs index 84b6654..2c3cae2 100644 --- a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs @@ -35,7 +35,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings { [TestCase] public void VerifyFutureTimestampWithinClockSkewIsAccepted() { this.Channel = CreateChannel(MessageProtections.Expiration); - this.ParameterizedReceiveProtectedTest(DateTime.UtcNow + DotNetOpenAuthSection.Configuration.Messaging.MaximumClockSkew - TimeSpan.FromSeconds(1), false); + this.ParameterizedReceiveProtectedTest(DateTime.UtcNow + DotNetOpenAuthSection.Messaging.MaximumClockSkew - TimeSpan.FromSeconds(1), false); } [TestCase, ExpectedException(typeof(ExpiredMessageException))] @@ -47,7 +47,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings { [TestCase, ExpectedException(typeof(ProtocolException))] public void VerifyFutureTimestampIsRejected() { this.Channel = CreateChannel(MessageProtections.Expiration); - this.ParameterizedReceiveProtectedTest(DateTime.UtcNow + DotNetOpenAuthSection.Configuration.Messaging.MaximumClockSkew + TimeSpan.FromSeconds(2), false); + this.ParameterizedReceiveProtectedTest(DateTime.UtcNow + DotNetOpenAuthSection.Messaging.MaximumClockSkew + TimeSpan.FromSeconds(2), false); } } } |