summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Messaging
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Messaging')
-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/ITamperProtectionChannelBindingElement.cs124
-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
7 files changed, 11 insertions, 225 deletions
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/ITamperProtectionChannelBindingElement.cs b/src/DotNetOpenAuth.Messaging/Messaging/ITamperProtectionChannelBindingElement.cs
deleted file mode 100644
index e177dd9..0000000
--- a/src/DotNetOpenAuth.Messaging/Messaging/ITamperProtectionChannelBindingElement.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="ITamperProtectionChannelBindingElement.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
- using System.Diagnostics.Contracts;
- using DotNetOpenAuth.OAuth.ChannelElements;
-
- /// <summary>
- /// An interface that must be implemented by message transforms/validators in order
- /// to be included in the channel stack.
- /// </summary>
- [ContractClass(typeof(ITamperProtectionChannelBindingElementContract))]
- public interface ITamperProtectionChannelBindingElement : IChannelBindingElement {
- /// <summary>
- /// Gets or sets the delegate that will initialize the non-serialized properties necessary on a
- /// signable message so that its signature can be correctly calculated or verified.
- /// </summary>
- Action<ITamperResistantOAuthMessage> SignatureCallback { get; set; }
-
- /// <summary>
- /// Clones this instance.
- /// </summary>
- /// <returns>The cloned instance.</returns>
- ITamperProtectionChannelBindingElement Clone();
- }
-
- /// <summary>
- /// Contract class for the <see cref="ITamperProtectionChannelBindingElement"/> interface.
- /// </summary>
- [ContractClassFor(typeof(ITamperProtectionChannelBindingElement))]
- internal abstract class ITamperProtectionChannelBindingElementContract : ITamperProtectionChannelBindingElement {
- #region ITamperProtectionChannelBindingElement Properties
-
- /// <summary>
- /// Gets or sets the delegate that will initialize the non-serialized properties necessary on a
- /// signable message so that its signature can be correctly calculated or verified.
- /// </summary>
- Action<ITamperResistantOAuthMessage> ITamperProtectionChannelBindingElement.SignatureCallback {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IChannelBindingElement Members
-
- /// <summary>
- /// Gets or sets the channel that this binding element belongs to.
- /// </summary>
- /// <remarks>
- /// This property is set by the channel when it is first constructed.
- /// </remarks>
- Channel IChannelBindingElement.Channel {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the protection commonly offered (if any) by this binding element.
- /// </summary>
- /// <remarks>
- /// This value is used to assist in sorting binding elements in the channel stack.
- /// </remarks>
- MessageProtections IChannelBindingElement.Protection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Prepares a message for sending based on the rules of this channel binding element.
- /// </summary>
- /// <param name="message">The message to prepare for sending.</param>
- /// <returns>
- /// The protections (if any) that this binding element applied to the message.
- /// Null if this binding element did not even apply to this binding element.
- /// </returns>
- /// <remarks>
- /// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
- /// </remarks>
- MessageProtections? IChannelBindingElement.ProcessOutgoingMessage(IProtocolMessage message) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Performs any transformation on an incoming message that may be necessary and/or
- /// validates an incoming message based on the rules of this channel binding element.
- /// </summary>
- /// <param name="message">The incoming message to process.</param>
- /// <returns>
- /// The protections (if any) that this binding element applied to the message.
- /// Null if this binding element did not even apply to this binding element.
- /// </returns>
- /// <exception cref="ProtocolException">
- /// Thrown when the binding element rules indicate that this message is invalid and should
- /// NOT be processed.
- /// </exception>
- /// <remarks>
- /// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
- /// </remarks>
- MessageProtections? IChannelBindingElement.ProcessIncomingMessage(IProtocolMessage message) {
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region ITamperProtectionChannelBindingElement Methods
-
- /// <summary>
- /// Clones this instance.
- /// </summary>
- /// <returns>The cloned instance.</returns>
- ITamperProtectionChannelBindingElement ITamperProtectionChannelBindingElement.Clone() {
- Contract.Ensures(Contract.Result<ITamperProtectionChannelBindingElement>() != null);
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
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>