summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-07-02 19:33:28 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-07-02 19:33:28 -0700
commitf2306dd1eb03996d314927c96bbd2a9412c30c8a (patch)
tree60ca38d087c7980390f4a27906da4038677347ca
parentb6f7a18b949acb4346754ae47fb07424076a3cd0 (diff)
downloadDotNetOpenAuth-f2306dd1eb03996d314927c96bbd2a9412c30c8a.zip
DotNetOpenAuth-f2306dd1eb03996d314927c96bbd2a9412c30c8a.tar.gz
DotNetOpenAuth-f2306dd1eb03996d314927c96bbd2a9412c30c8a.tar.bz2
Messaging project now compiles.
-rw-r--r--src/DotNetOpenAuth.InfoCard/DotNetOpenAuth.InfoCard.csproj1
-rw-r--r--src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs36
-rw-r--r--src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs30
-rw-r--r--src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj1
-rw-r--r--src/DotNetOpenAuth.Messaging/Messaging/ErrorUtilities.cs20
-rw-r--r--src/DotNetOpenAuth.Messaging/Messaging/MessageSerializer.cs1
-rw-r--r--src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs23
-rw-r--r--src/DotNetOpenAuth.Messaging/Reporting.cs37
-rw-r--r--src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj2
-rw-r--r--src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs (renamed from src/DotNetOpenAuth.Messaging/Messaging/ITamperProtectionChannelBindingElement.cs)0
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuthReporting.cs46
11 files changed, 96 insertions, 101 deletions
diff --git a/src/DotNetOpenAuth.InfoCard/DotNetOpenAuth.InfoCard.csproj b/src/DotNetOpenAuth.InfoCard/DotNetOpenAuth.InfoCard.csproj
index 62ac34b..2b9e01b 100644
--- a/src/DotNetOpenAuth.InfoCard/DotNetOpenAuth.InfoCard.csproj
+++ b/src/DotNetOpenAuth.InfoCard/DotNetOpenAuth.InfoCard.csproj
@@ -278,6 +278,7 @@ http://opensource.org/licenses/ms-pl.html
</ItemGroup>
<ItemGroup>
<Compile Include="ComponentModel\IssuersSuggestions.cs" />
+ <Compile Include="InfoCardErrorUtilities.cs" />
<Compile Include="InfoCard\ClaimType.cs" />
<Compile Include="InfoCard\InfoCardImage.cs" />
<Compile Include="InfoCard\InfoCardStrings.Designer.cs">
diff --git a/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs b/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs
new file mode 100644
index 0000000..8d627fa
--- /dev/null
+++ b/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs
@@ -0,0 +1,36 @@
+//-----------------------------------------------------------------------
+// <copyright file="InfoCardErrorUtilities.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Diagnostics.Contracts;
+ using System.Globalization;
+
+ internal static class InfoCardErrorUtilities {
+ /// <summary>
+ /// Checks a condition and throws an <see cref="InfoCard.InformationCardException"/>
+ /// if it evaluates to false.
+ /// </summary>
+ /// <param name="condition">The condition to check.</param>
+ /// <param name="errorMessage">The message to include in the exception, if created.</param>
+ /// <param name="args">The formatting arguments.</param>
+ /// <exception cref="InfoCard.InformationCardException">Thrown if <paramref name="condition"/> evaluates to <c>false</c>.</exception>
+ [Pure]
+ internal static void VerifyInfoCard(bool condition, string errorMessage, params object[] args) {
+ Contract.Requires<ArgumentNullException>(args != null);
+ Contract.Ensures(condition);
+ Contract.EnsuresOnThrow<InfoCard.InformationCardException>(!condition);
+ Contract.Assume(errorMessage != null);
+ if (!condition) {
+ errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args);
+ throw new InfoCard.InformationCardException(errorMessage);
+ }
+ }
+ }
+}
diff --git a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs
index 409fca9..d41460b 100644
--- a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs
+++ b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs
@@ -78,36 +78,6 @@ namespace DotNetOpenAuth.Configuration {
}
/// <summary>
- /// Gets or sets the configuration for OpenID.
- /// </summary>
- [ConfigurationProperty(OpenIdElementName)]
- internal OpenIdElement OpenId {
- get {
- Contract.Ensures(Contract.Result<OpenIdElement>() != null);
- return (OpenIdElement)this[OpenIdElementName] ?? new OpenIdElement();
- }
-
- set {
- this[OpenIdElementName] = value;
- }
- }
-
- /// <summary>
- /// Gets or sets the configuration for OAuth.
- /// </summary>
- [ConfigurationProperty(OAuthElementName)]
- internal OAuthElement OAuth {
- get {
- Contract.Ensures(Contract.Result<OAuthElement>() != null);
- return (OAuthElement)this[OAuthElementName] ?? new OAuthElement();
- }
-
- set {
- this[OAuthElementName] = value;
- }
- }
-
- /// <summary>
/// Gets or sets the configuration for reporting.
/// </summary>
[ConfigurationProperty(ReportingElementName)]
diff --git a/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj b/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj
index 50b367f..46aadaf 100644
--- a/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj
+++ b/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj
@@ -322,7 +322,6 @@ http://opensource.org/licenses/ms-pl.html
<Compile Include="Messaging\TimestampEncoder.cs" />
<Compile Include="Messaging\IMessageWithBinaryData.cs" />
<Compile Include="Messaging\ChannelEventArgs.cs" />
- <Compile Include="Messaging\ITamperProtectionChannelBindingElement.cs" />
<Compile Include="Messaging\Bindings\NonceMemoryStore.cs" />
<Compile Include="Messaging\IDirectWebRequestHandler.cs" />
<Compile Include="Messaging\Bindings\INonceStore.cs" />
diff --git a/src/DotNetOpenAuth.Messaging/Messaging/ErrorUtilities.cs b/src/DotNetOpenAuth.Messaging/Messaging/ErrorUtilities.cs
index 1807f54..c9e6e26 100644
--- a/src/DotNetOpenAuth.Messaging/Messaging/ErrorUtilities.cs
+++ b/src/DotNetOpenAuth.Messaging/Messaging/ErrorUtilities.cs
@@ -151,26 +151,6 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
- /// Checks a condition and throws an <see cref="InfoCard.InformationCardException"/>
- /// if it evaluates to false.
- /// </summary>
- /// <param name="condition">The condition to check.</param>
- /// <param name="errorMessage">The message to include in the exception, if created.</param>
- /// <param name="args">The formatting arguments.</param>
- /// <exception cref="InfoCard.InformationCardException">Thrown if <paramref name="condition"/> evaluates to <c>false</c>.</exception>
- [Pure]
- internal static void VerifyInfoCard(bool condition, string errorMessage, params object[] args) {
- Contract.Requires<ArgumentNullException>(args != null);
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<InfoCard.InformationCardException>(!condition);
- Contract.Assume(errorMessage != null);
- if (!condition) {
- errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args);
- throw new InfoCard.InformationCardException(errorMessage);
- }
- }
-
- /// <summary>
/// Throws a <see cref="HostErrorException"/> if some <paramref name="condition"/> evaluates to false.
/// </summary>
/// <param name="condition">True to do nothing; false to throw the exception.</param>
diff --git a/src/DotNetOpenAuth.Messaging/Messaging/MessageSerializer.cs b/src/DotNetOpenAuth.Messaging/Messaging/MessageSerializer.cs
index 77a206c..7b0cfab 100644
--- a/src/DotNetOpenAuth.Messaging/Messaging/MessageSerializer.cs
+++ b/src/DotNetOpenAuth.Messaging/Messaging/MessageSerializer.cs
@@ -14,7 +14,6 @@ namespace DotNetOpenAuth.Messaging {
using System.Reflection;
using System.Xml;
using DotNetOpenAuth.Messaging.Reflection;
- using DotNetOpenAuth.OAuth.ChannelElements;
/// <summary>
/// Serializes/deserializes OAuth messages for/from transit.
diff --git a/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs b/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs
index e5cbff8..bf92803 100644
--- a/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs
+++ b/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs
@@ -16,7 +16,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
using System.Reflection;
using System.Xml;
using DotNetOpenAuth.Configuration;
- using DotNetOpenAuth.OpenId;
/// <summary>
/// Describes an individual member of a message and assists in its serialization.
@@ -74,11 +73,11 @@ namespace DotNetOpenAuth.Messaging.Reflection {
Contract.Assume(str != null);
return bool.Parse(str);
};
- Func<string, Identifier> safeIdentifier = str => {
- Contract.Assume(str != null);
- ErrorUtilities.VerifyFormat(str.Length > 0, MessagingStrings.NonEmptyStringExpected);
- return Identifier.Parse(str, true);
- };
+ ////Func<string, Identifier> safeIdentifier = str => {
+ //// Contract.Assume(str != null);
+ //// ErrorUtilities.VerifyFormat(str.Length > 0, MessagingStrings.NonEmptyStringExpected);
+ //// return Identifier.Parse(str, true);
+ ////};
Func<byte[], string> safeFromByteArray = bytes => {
Contract.Assume(bytes != null);
return Convert.ToBase64String(bytes);
@@ -87,16 +86,16 @@ namespace DotNetOpenAuth.Messaging.Reflection {
Contract.Assume(str != null);
return Convert.FromBase64String(str);
};
- Func<string, Realm> safeRealm = str => {
- Contract.Assume(str != null);
- return new Realm(str);
- };
+ ////Func<string, Realm> safeRealm = str => {
+ //// Contract.Assume(str != null);
+ //// return new Realm(str);
+ ////};
Map<Uri>(uri => uri.AbsoluteUri, uri => uri.OriginalString, safeUri);
Map<DateTime>(dt => XmlConvert.ToString(dt, XmlDateTimeSerializationMode.Utc), null, str => XmlConvert.ToDateTime(str, XmlDateTimeSerializationMode.Utc));
Map<TimeSpan>(ts => ts.ToString(), null, str => TimeSpan.Parse(str));
Map<byte[]>(safeFromByteArray, null, safeToByteArray);
- Map<Realm>(realm => realm.ToString(), realm => realm.OriginalString, safeRealm);
- Map<Identifier>(id => id.SerializedString, id => id.OriginalString, safeIdentifier);
+ ////Map<Realm>(realm => realm.ToString(), realm => realm.OriginalString, safeRealm);
+ ////Map<Identifier>(id => id.SerializedString, id => id.OriginalString, safeIdentifier);
Map<bool>(value => value.ToString().ToLowerInvariant(), null, safeBool);
Map<CultureInfo>(c => c.Name, null, str => new CultureInfo(str));
Map<CultureInfo[]>(cs => string.Join(",", cs.Select(c => c.Name).ToArray()), null, str => str.Split(',').Select(s => new CultureInfo(s)).ToArray());
diff --git a/src/DotNetOpenAuth.Messaging/Reporting.cs b/src/DotNetOpenAuth.Messaging/Reporting.cs
index 03565b8..65eddfe 100644
--- a/src/DotNetOpenAuth.Messaging/Reporting.cs
+++ b/src/DotNetOpenAuth.Messaging/Reporting.cs
@@ -23,8 +23,6 @@ namespace DotNetOpenAuth {
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.ChannelElements;
/// <summary>
/// The statistical reporting mechanism used so this library's project authors
@@ -282,41 +280,6 @@ namespace DotNetOpenAuth {
}
/// <summary>
- /// Records the feature and dependency use.
- /// </summary>
- /// <param name="value">The consumer or service provider.</param>
- /// <param name="service">The service.</param>
- /// <param name="tokenManager">The token manager.</param>
- /// <param name="nonceStore">The nonce store.</param>
- internal static void RecordFeatureAndDependencyUse(object value, ServiceProviderDescription service, ITokenManager tokenManager, INonceStore nonceStore) {
- Contract.Requires(value != null);
- Contract.Requires(service != null);
- Contract.Requires(tokenManager != null);
-
- // In release builds, just quietly return.
- if (value == null || service == null || tokenManager == null) {
- return;
- }
-
- if (Enabled && Configuration.IncludeFeatureUsage) {
- StringBuilder builder = new StringBuilder();
- builder.Append(value.GetType().Name);
- builder.Append(" ");
- builder.Append(tokenManager.GetType().Name);
- if (nonceStore != null) {
- builder.Append(" ");
- builder.Append(nonceStore.GetType().Name);
- }
- builder.Append(" ");
- builder.Append(service.Version);
- builder.Append(" ");
- builder.Append(service.UserAuthorizationEndpoint);
- observedFeatures.Add(builder.ToString());
- Touch();
- }
- }
-
- /// <summary>
/// Records statistics collected from incoming requests.
/// </summary>
/// <param name="request">The request.</param>
diff --git a/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj b/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj
index 8f1d474..56fd753 100644
--- a/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj
+++ b/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj
@@ -282,6 +282,8 @@ http://opensource.org/licenses/ms-pl.html
<Compile Include="Configuration\OAuthElement.cs" />
<Compile Include="Configuration\OAuthServiceProviderElement.cs" />
<Compile Include="Configuration\OAuthServiceProviderSecuritySettingsElement.cs" />
+ <Compile Include="Messaging\ITamperProtectionChannelBindingElement.cs" />
+ <Compile Include="OAuthReporting.cs" />
<Compile Include="OAuth\ChannelElements\ICombinedOpenIdProviderTokenManager.cs" />
<Compile Include="OAuth\ChannelElements\IConsumerDescription.cs" />
<Compile Include="OAuth\ChannelElements\IConsumerTokenManager.cs" />
diff --git a/src/DotNetOpenAuth.Messaging/Messaging/ITamperProtectionChannelBindingElement.cs b/src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs
index e177dd9..e177dd9 100644
--- a/src/DotNetOpenAuth.Messaging/Messaging/ITamperProtectionChannelBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs
diff --git a/src/DotNetOpenAuth.OAuth/OAuthReporting.cs b/src/DotNetOpenAuth.OAuth/OAuthReporting.cs
new file mode 100644
index 0000000..ba4e9a1
--- /dev/null
+++ b/src/DotNetOpenAuth.OAuth/OAuthReporting.cs
@@ -0,0 +1,46 @@
+namespace DotNetOpenAuth {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Diagnostics.Contracts;
+ using DotNetOpenAuth.OAuth;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+
+ internal static class OAuthReporting {
+ /// <summary>
+ /// Records the feature and dependency use.
+ /// </summary>
+ /// <param name="value">The consumer or service provider.</param>
+ /// <param name="service">The service.</param>
+ /// <param name="tokenManager">The token manager.</param>
+ /// <param name="nonceStore">The nonce store.</param>
+ internal static void RecordFeatureAndDependencyUse(object value, ServiceProviderDescription service, ITokenManager tokenManager, INonceStore nonceStore) {
+ Contract.Requires(value != null);
+ Contract.Requires(service != null);
+ Contract.Requires(tokenManager != null);
+
+ // In release builds, just quietly return.
+ if (value == null || service == null || tokenManager == null) {
+ return;
+ }
+
+ if (Enabled && Configuration.IncludeFeatureUsage) {
+ StringBuilder builder = new StringBuilder();
+ builder.Append(value.GetType().Name);
+ builder.Append(" ");
+ builder.Append(tokenManager.GetType().Name);
+ if (nonceStore != null) {
+ builder.Append(" ");
+ builder.Append(nonceStore.GetType().Name);
+ }
+ builder.Append(" ");
+ builder.Append(service.Version);
+ builder.Append(" ");
+ builder.Append(service.UserAuthorizationEndpoint);
+ observedFeatures.Add(builder.ToString());
+ Touch();
+ }
+ }
+ }
+}