diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-12-30 20:45:06 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-03 19:24:46 -0800 |
commit | 49aaed61a5c029c0fc98fcd5ab252902601bad5b (patch) | |
tree | 533d8e4f275c900c310a1a2f75feb4f90ffa45b4 | |
parent | 465f21e83ca4ac7b39376adf6396ee4db0ce8c43 (diff) | |
download | DotNetOpenAuth-49aaed61a5c029c0fc98fcd5ab252902601bad5b.zip DotNetOpenAuth-49aaed61a5c029c0fc98fcd5ab252902601bad5b.tar.gz DotNetOpenAuth-49aaed61a5c029c0fc98fcd5ab252902601bad5b.tar.bz2 |
Added authentication response.
17 files changed, 1291 insertions, 931 deletions
diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj index ec5cef4..537b593 100644 --- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj +++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj @@ -227,7 +227,10 @@ <Compile Include="OpenId\RelyingParty\AssociationPreference.cs" /> <Compile Include="OpenId\RelyingParty\AuthenticationRequest.cs" /> <Compile Include="OpenId\RelyingParty\AuthenticationRequestMode.cs" /> + <Compile Include="OpenId\RelyingParty\NegativeAuthenticationResponse.cs" /> + <Compile Include="OpenId\RelyingParty\PositiveAuthenticationResponse.cs" /> <Compile Include="OpenId\RelyingParty\AuthenticationStatus.cs" /> + <Compile Include="OpenId\RelyingParty\FailedAuthenticationResponse.cs" /> <Compile Include="OpenId\RelyingParty\IAuthenticationRequest.cs" /> <Compile Include="OpenId\RelyingParty\IAuthenticationResponse.cs" /> <Compile Include="OpenId\RelyingParty\IProviderEndpoint.cs" /> diff --git a/src/DotNetOpenAuth/Messaging/ErrorUtilities.cs b/src/DotNetOpenAuth/Messaging/ErrorUtilities.cs index b8213b3..fd202d6 100644 --- a/src/DotNetOpenAuth/Messaging/ErrorUtilities.cs +++ b/src/DotNetOpenAuth/Messaging/ErrorUtilities.cs @@ -1,133 +1,133 @@ -//-----------------------------------------------------------------------
-// <copyright file="ErrorUtilities.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
- using System.Globalization;
-
- /// <summary>
- /// A collection of error checking and reporting methods.
- /// </summary>
- internal class ErrorUtilities {
- /// <summary>
- /// Wraps an exception in a new <see cref="ProtocolException"/>.
- /// </summary>
- /// <param name="inner">The inner exception to wrap.</param>
- /// <param name="errorMessage">The error message for the outer exception.</param>
- /// <param name="args">The string formatting arguments, if any.</param>
- /// <returns>The newly constructed (unthrown) exception.</returns>
- internal static Exception Wrap(Exception inner, string errorMessage, params object[] args) {
- return new ProtocolException(string.Format(CultureInfo.CurrentCulture, errorMessage, args), inner);
- }
-
- /// <summary>
- /// Checks a condition and throws an internal error exception 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>
- internal static void VerifyInternal(bool condition, string errorMessage) {
- if (!condition) {
- throw new InternalErrorException(errorMessage);
- }
- }
-
- /// <summary>
- /// Checks a condition and throws an internal error exception 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>
- internal static void VerifyInternal(bool condition, string errorMessage, params object[] args) {
- if (!condition) {
- errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args);
- throw new InternalErrorException(errorMessage);
- }
- }
-
- /// <summary>
- /// Throws a <see cref="ProtocolException"/> if some <paramref name="condition"/> evaluates to false.
- /// </summary>
- /// <param name="condition">True to do nothing; false to throw the exception.</param>
- /// <param name="faultedMessage">The message being processed that would be responsible for the exception if thrown.</param>
- /// <param name="errorMessage">The error message for the exception.</param>
- /// <param name="args">The string formatting arguments, if any.</param>
- internal static void VerifyProtocol(bool condition, IProtocolMessage faultedMessage, string errorMessage, params object[] args) {
- if (!condition) {
- throw new ProtocolException(string.Format(CultureInfo.CurrentCulture, errorMessage, args), faultedMessage);
- }
- }
-
- /// <summary>
- /// Throws a <see cref="ProtocolException"/> if some <paramref name="condition"/> evaluates to false.
- /// </summary>
- /// <param name="condition">True to do nothing; false to throw the exception.</param>
- /// <param name="message">The error message for the exception.</param>
- /// <param name="args">The string formatting arguments, if any.</param>
- internal static void VerifyProtocol(bool condition, string message, params object[] args) {
- if (!condition) {
- throw new ProtocolException(string.Format(
- CultureInfo.CurrentCulture,
- message,
- args));
- }
- }
-
- /// <summary>
- /// Throws a <see cref="ProtocolException"/>.
- /// </summary>
- /// <param name="message">The message to set in the exception.</param>
- /// <param name="args">The formatting arguments of the message.</param>
- /// <returns>
- /// An InternalErrorException, which may be "thrown" by the caller in order
- /// to satisfy C# rules to show that code will never be reached, but no value
- /// actually is ever returned because this method guarantees to throw.
- /// </returns>
- internal static Exception ThrowProtocol(string message, params object[] args) {
- VerifyProtocol(false, message, args);
-
- // we never reach here, but this allows callers to "throw" this method.
- return new InternalErrorException();
- }
-
- /// <summary>
- /// Verifies something about the argument supplied to a method.
- /// </summary>
- /// <param name="condition">The condition that must evaluate to true to avoid an exception.</param>
- /// <param name="message">The message to use in the exception if the condition is false.</param>
- /// <param name="args">The string formatting arguments, if any.</param>
- internal static void VerifyArgument(bool condition, string message, params object[] args) {
- if (!condition) {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, message, args));
- }
- }
-
- /// <summary>
- /// Verifies that some given value is not null.
- /// </summary>
- /// <param name="value">The value to check.</param>
- /// <param name="paramName">Name of the parameter, which will be used in the <see cref="ArgumentException"/>, if thrown.</param>
- /// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception>
- internal static void VerifyArgumentNotNull(object value, string paramName) {
- if (Object.ReferenceEquals(value, null)) {
- throw new ArgumentNullException(paramName);
- }
- }
-
- /// <summary>
- /// Verifies that some string is not null and has non-zero length.
- /// </summary>
- /// <param name="value">The value to check.</param>
- /// <param name="paramName">Name of the parameter, which will be used in the <see cref="ArgumentException"/>, if thrown.</param>
- /// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception>
- /// <exception cref="ArgumentException">Thrown if <paramref name="value"/> has zero length.</exception>
- internal static void VerifyNonZeroLength(string value, string paramName) {
- VerifyArgumentNotNull(value, paramName);
- if (value.Length == 0) {
- throw new ArgumentException(MessagingStrings.UnexpectedEmptyString, paramName);
- }
- }
- }
-}
+//----------------------------------------------------------------------- +// <copyright file="ErrorUtilities.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.Messaging { + using System; + using System.Globalization; + + /// <summary> + /// A collection of error checking and reporting methods. + /// </summary> + internal class ErrorUtilities { + /// <summary> + /// Wraps an exception in a new <see cref="ProtocolException"/>. + /// </summary> + /// <param name="inner">The inner exception to wrap.</param> + /// <param name="errorMessage">The error message for the outer exception.</param> + /// <param name="args">The string formatting arguments, if any.</param> + /// <returns>The newly constructed (unthrown) exception.</returns> + internal static Exception Wrap(Exception inner, string errorMessage, params object[] args) { + return new ProtocolException(string.Format(CultureInfo.CurrentCulture, errorMessage, args), inner); + } + + /// <summary> + /// Checks a condition and throws an internal error exception 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> + internal static void VerifyInternal(bool condition, string errorMessage) { + if (!condition) { + throw new InternalErrorException(errorMessage); + } + } + + /// <summary> + /// Checks a condition and throws an internal error exception 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> + internal static void VerifyInternal(bool condition, string errorMessage, params object[] args) { + if (!condition) { + errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args); + throw new InternalErrorException(errorMessage); + } + } + + /// <summary> + /// Throws a <see cref="ProtocolException"/> if some <paramref name="condition"/> evaluates to false. + /// </summary> + /// <param name="condition">True to do nothing; false to throw the exception.</param> + /// <param name="faultedMessage">The message being processed that would be responsible for the exception if thrown.</param> + /// <param name="errorMessage">The error message for the exception.</param> + /// <param name="args">The string formatting arguments, if any.</param> + internal static void VerifyProtocol(bool condition, IProtocolMessage faultedMessage, string errorMessage, params object[] args) { + if (!condition) { + throw new ProtocolException(string.Format(CultureInfo.CurrentCulture, errorMessage, args), faultedMessage); + } + } + + /// <summary> + /// Throws a <see cref="ProtocolException"/> if some <paramref name="condition"/> evaluates to false. + /// </summary> + /// <param name="condition">True to do nothing; false to throw the exception.</param> + /// <param name="message">The error message for the exception.</param> + /// <param name="args">The string formatting arguments, if any.</param> + internal static void VerifyProtocol(bool condition, string message, params object[] args) { + if (!condition) { + throw new ProtocolException(string.Format( + CultureInfo.CurrentCulture, + message, + args)); + } + } + + /// <summary> + /// Throws a <see cref="ProtocolException"/>. + /// </summary> + /// <param name="message">The message to set in the exception.</param> + /// <param name="args">The formatting arguments of the message.</param> + /// <returns> + /// An InternalErrorException, which may be "thrown" by the caller in order + /// to satisfy C# rules to show that code will never be reached, but no value + /// actually is ever returned because this method guarantees to throw. + /// </returns> + internal static Exception ThrowProtocol(string message, params object[] args) { + VerifyProtocol(false, message, args); + + // we never reach here, but this allows callers to "throw" this method. + return new InternalErrorException(); + } + + /// <summary> + /// Verifies something about the argument supplied to a method. + /// </summary> + /// <param name="condition">The condition that must evaluate to true to avoid an exception.</param> + /// <param name="message">The message to use in the exception if the condition is false.</param> + /// <param name="args">The string formatting arguments, if any.</param> + internal static void VerifyArgument(bool condition, string message, params object[] args) { + if (!condition) { + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, message, args)); + } + } + + /// <summary> + /// Verifies that some given value is not null. + /// </summary> + /// <param name="value">The value to check.</param> + /// <param name="paramName">Name of the parameter, which will be used in the <see cref="ArgumentException"/>, if thrown.</param> + /// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception> + internal static void VerifyArgumentNotNull(object value, string paramName) { + if (Object.ReferenceEquals(value, null)) { + throw new ArgumentNullException(paramName); + } + } + + /// <summary> + /// Verifies that some string is not null and has non-zero length. + /// </summary> + /// <param name="value">The value to check.</param> + /// <param name="paramName">Name of the parameter, which will be used in the <see cref="ArgumentException"/>, if thrown.</param> + /// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception> + /// <exception cref="ArgumentException">Thrown if <paramref name="value"/> has zero length.</exception> + internal static void VerifyNonZeroLength(string value, string paramName) { + VerifyArgumentNotNull(value, paramName); + if (value.Length == 0) { + throw new ArgumentException(MessagingStrings.UnexpectedEmptyString, paramName); + } + } + } +} diff --git a/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs b/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs index 7d42c00..f370a1c 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs +++ b/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs @@ -1,513 +1,513 @@ -//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3521
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class MessagingStrings {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal MessagingStrings() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DotNetOpenAuth.Messaging.MessagingStrings", typeof(MessagingStrings).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Argument's {0}.{1} property is required but is empty or null..
- /// </summary>
- internal static string ArgumentPropertyMissing {
- get {
- return ResourceManager.GetString("ArgumentPropertyMissing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to HttpContext.Current is null. There must be an ASP.NET request in process for this operation to succeed..
- /// </summary>
- internal static string CurrentHttpContextRequired {
- get {
- return ResourceManager.GetString("CurrentHttpContextRequired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to DataContractSerializer could not be initialized on message type {0}. Is it missing a [DataContract] attribute?.
- /// </summary>
- internal static string DataContractMissingFromMessageType {
- get {
- return ResourceManager.GetString("DataContractMissingFromMessageType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to DataContractSerializer could not be initialized on message type {0} because the DataContractAttribute.Namespace property is not set..
- /// </summary>
- internal static string DataContractMissingNamespace {
- get {
- return ResourceManager.GetString("DataContractMissingNamespace", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An instance of type {0} was expected, but received unexpected derived type {1}..
- /// </summary>
- internal static string DerivedTypeNotExpected {
- get {
- return ResourceManager.GetString("DerivedTypeNotExpected", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The directed message's Recipient property must not be null..
- /// </summary>
- internal static string DirectedMessageMissingRecipient {
- get {
- return ResourceManager.GetString("DirectedMessageMissingRecipient", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Error while deserializing message {0}..
- /// </summary>
- internal static string ErrorDeserializingMessage {
- get {
- return ResourceManager.GetString("ErrorDeserializingMessage", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Error occurred while sending a direct message or getting the response..
- /// </summary>
- internal static string ErrorInRequestReplyMessage {
- get {
- return ResourceManager.GetString("ErrorInRequestReplyMessage", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This exception was not constructed with a root request message that caused it..
- /// </summary>
- internal static string ExceptionNotConstructedForTransit {
- get {
- return ResourceManager.GetString("ExceptionNotConstructedForTransit", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Expected {0} message but received no recognizable message..
- /// </summary>
- internal static string ExpectedMessageNotReceived {
- get {
- return ResourceManager.GetString("ExpectedMessageNotReceived", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The message expired at {0} and it is now {1}..
- /// </summary>
- internal static string ExpiredMessage {
- get {
- return ResourceManager.GetString("ExpiredMessage", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to At least one of GET or POST flags must be present..
- /// </summary>
- internal static string GetOrPostFlagsRequired {
- get {
- return ResourceManager.GetString("GetOrPostFlagsRequired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext..
- /// </summary>
- internal static string HttpContextRequired {
- get {
- return ResourceManager.GetString("HttpContextRequired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Messages that indicate indirect transport must implement the {0} interface..
- /// </summary>
- internal static string IndirectMessagesMustImplementIDirectedProtocolMessage {
- get {
- return ResourceManager.GetString("IndirectMessagesMustImplementIDirectedProtocolMessage", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Insecure web request for '{0}' aborted due to security requirements demanding HTTPS..
- /// </summary>
- internal static string InsecureWebRequestWithSslRequired {
- get {
- return ResourceManager.GetString("InsecureWebRequestWithSslRequired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The {0} message required protections {{{1}}} but the channel could only apply {{{2}}}..
- /// </summary>
- internal static string InsufficientMessageProtection {
- get {
- return ResourceManager.GetString("InsufficientMessageProtection", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The customized binding element ordering is invalid..
- /// </summary>
- internal static string InvalidCustomBindingElementOrder {
- get {
- return ResourceManager.GetString("InvalidCustomBindingElementOrder", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Some part(s) of the message have invalid values: {0}.
- /// </summary>
- internal static string InvalidMessageParts {
- get {
- return ResourceManager.GetString("InvalidMessageParts", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The incoming message had an invalid or missing nonce..
- /// </summary>
- internal static string InvalidNonceReceived {
- get {
- return ResourceManager.GetString("InvalidNonceReceived", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An item with the same key has already been added..
- /// </summary>
- internal static string KeyAlreadyExists {
- get {
- return ResourceManager.GetString("KeyAlreadyExists", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The value for {0}.{1} on member {1} was expected to derive from {2} but was {3}..
- /// </summary>
- internal static string MessagePartEncoderWrongType {
- get {
- return ResourceManager.GetString("MessagePartEncoderWrongType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Error while reading message '{0}' parameter '{1}' with value '{2}'..
- /// </summary>
- internal static string MessagePartReadFailure {
- get {
- return ResourceManager.GetString("MessagePartReadFailure", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Message parameter '{0}' with value '{1}' failed to base64 decode..
- /// </summary>
- internal static string MessagePartValueBase64DecodingFault {
- get {
- return ResourceManager.GetString("MessagePartValueBase64DecodingFault", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Error while preparing message '{0}' parameter '{1}' for sending..
- /// </summary>
- internal static string MessagePartWriteFailure {
- get {
- return ResourceManager.GetString("MessagePartWriteFailure", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A message response is already queued for sending in the response stream..
- /// </summary>
- internal static string QueuedMessageResponseAlreadyExists {
- get {
- return ResourceManager.GetString("QueuedMessageResponseAlreadyExists", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This message has already been processed. This could indicate a replay attack in progress..
- /// </summary>
- internal static string ReplayAttackDetected {
- get {
- return ResourceManager.GetString("ReplayAttackDetected", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This channel does not support replay protection..
- /// </summary>
- internal static string ReplayProtectionNotSupported {
- get {
- return ResourceManager.GetString("ReplayProtectionNotSupported", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The following required non-empty parameters were empty in the {0} message: {1}.
- /// </summary>
- internal static string RequiredNonEmptyParameterWasEmpty {
- get {
- return ResourceManager.GetString("RequiredNonEmptyParameterWasEmpty", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The following required parameters were missing from the {0} message: {1}.
- /// </summary>
- internal static string RequiredParametersMissing {
- get {
- return ResourceManager.GetString("RequiredParametersMissing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The binding element offering the {0} protection requires other protection that is not provided..
- /// </summary>
- internal static string RequiredProtectionMissing {
- get {
- return ResourceManager.GetString("RequiredProtectionMissing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The list is empty..
- /// </summary>
- internal static string SequenceContainsNoElements {
- get {
- return ResourceManager.GetString("SequenceContainsNoElements", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The list contains a null element..
- /// </summary>
- internal static string SequenceContainsNullElement {
- get {
- return ResourceManager.GetString("SequenceContainsNullElement", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Message signature was incorrect..
- /// </summary>
- internal static string SignatureInvalid {
- get {
- return ResourceManager.GetString("SignatureInvalid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This channel does not support signing messages. To support signing messages, a derived Channel type must override the Sign and IsSignatureValid methods..
- /// </summary>
- internal static string SigningNotSupported {
- get {
- return ResourceManager.GetString("SigningNotSupported", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The stream's CanRead property returned false..
- /// </summary>
- internal static string StreamUnreadable {
- get {
- return ResourceManager.GetString("StreamUnreadable", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The stream's CanWrite property returned false..
- /// </summary>
- internal static string StreamUnwritable {
- get {
- return ResourceManager.GetString("StreamUnwritable", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Expected at most 1 binding element to apply the {0} protection, but more than one applied..
- /// </summary>
- internal static string TooManyBindingsOfferingSameProtection {
- get {
- return ResourceManager.GetString("TooManyBindingsOfferingSameProtection", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The maximum allowable number of redirects were exceeded while requesting '{0}'..
- /// </summary>
- internal static string TooManyRedirects {
- get {
- return ResourceManager.GetString("TooManyRedirects", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The array must not be empty..
- /// </summary>
- internal static string UnexpectedEmptyArray {
- get {
- return ResourceManager.GetString("UnexpectedEmptyArray", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The empty string is not allowed..
- /// </summary>
- internal static string UnexpectedEmptyString {
- get {
- return ResourceManager.GetString("UnexpectedEmptyString", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Message parameter '{0}' had unexpected value '{1}'..
- /// </summary>
- internal static string UnexpectedMessagePartValue {
- get {
- return ResourceManager.GetString("UnexpectedMessagePartValue", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Expected message {0} parameter '{1}' to have value '{2}' but had '{3}' instead..
- /// </summary>
- internal static string UnexpectedMessagePartValueForConstant {
- get {
- return ResourceManager.GetString("UnexpectedMessagePartValueForConstant", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Expected message {0} but received {1} instead..
- /// </summary>
- internal static string UnexpectedMessageReceived {
- get {
- return ResourceManager.GetString("UnexpectedMessageReceived", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unexpected message type received..
- /// </summary>
- internal static string UnexpectedMessageReceivedOfMany {
- get {
- return ResourceManager.GetString("UnexpectedMessageReceivedOfMany", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A null value was included and is not allowed..
- /// </summary>
- internal static string UnexpectedNullValue {
- get {
- return ResourceManager.GetString("UnexpectedNullValue", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The type {0} or a derived type was expected, but {1} was given..
- /// </summary>
- internal static string UnexpectedType {
- get {
- return ResourceManager.GetString("UnexpectedType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to {0} property has unrecognized value {1}..
- /// </summary>
- internal static string UnrecognizedEnumValue {
- get {
- return ResourceManager.GetString("UnrecognizedEnumValue", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The URL '{0}' is rated unsafe and cannot be requested this way..
- /// </summary>
- internal static string UnsafeWebRequestDetected {
- get {
- return ResourceManager.GetString("UnsafeWebRequestDetected", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Redirects on POST requests that are to untrusted servers is not supported..
- /// </summary>
- internal static string UntrustedRedirectsOnPOSTNotSupported {
- get {
- return ResourceManager.GetString("UntrustedRedirectsOnPOSTNotSupported", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Web request to '{0}' failed..
- /// </summary>
- internal static string WebRequestFailed {
- get {
- return ResourceManager.GetString("WebRequestFailed", resourceCulture);
- }
- }
- }
-}
+//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.3521 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace DotNetOpenAuth.Messaging { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MessagingStrings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MessagingStrings() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DotNetOpenAuth.Messaging.MessagingStrings", typeof(MessagingStrings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to Argument's {0}.{1} property is required but is empty or null.. + /// </summary> + internal static string ArgumentPropertyMissing { + get { + return ResourceManager.GetString("ArgumentPropertyMissing", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to HttpContext.Current is null. There must be an ASP.NET request in process for this operation to succeed.. + /// </summary> + internal static string CurrentHttpContextRequired { + get { + return ResourceManager.GetString("CurrentHttpContextRequired", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to DataContractSerializer could not be initialized on message type {0}. Is it missing a [DataContract] attribute?. + /// </summary> + internal static string DataContractMissingFromMessageType { + get { + return ResourceManager.GetString("DataContractMissingFromMessageType", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to DataContractSerializer could not be initialized on message type {0} because the DataContractAttribute.Namespace property is not set.. + /// </summary> + internal static string DataContractMissingNamespace { + get { + return ResourceManager.GetString("DataContractMissingNamespace", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to An instance of type {0} was expected, but received unexpected derived type {1}.. + /// </summary> + internal static string DerivedTypeNotExpected { + get { + return ResourceManager.GetString("DerivedTypeNotExpected", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The directed message's Recipient property must not be null.. + /// </summary> + internal static string DirectedMessageMissingRecipient { + get { + return ResourceManager.GetString("DirectedMessageMissingRecipient", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Error while deserializing message {0}.. + /// </summary> + internal static string ErrorDeserializingMessage { + get { + return ResourceManager.GetString("ErrorDeserializingMessage", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Error occurred while sending a direct message or getting the response.. + /// </summary> + internal static string ErrorInRequestReplyMessage { + get { + return ResourceManager.GetString("ErrorInRequestReplyMessage", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to This exception was not constructed with a root request message that caused it.. + /// </summary> + internal static string ExceptionNotConstructedForTransit { + get { + return ResourceManager.GetString("ExceptionNotConstructedForTransit", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Expected {0} message but received no recognizable message.. + /// </summary> + internal static string ExpectedMessageNotReceived { + get { + return ResourceManager.GetString("ExpectedMessageNotReceived", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The message expired at {0} and it is now {1}.. + /// </summary> + internal static string ExpiredMessage { + get { + return ResourceManager.GetString("ExpiredMessage", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to At least one of GET or POST flags must be present.. + /// </summary> + internal static string GetOrPostFlagsRequired { + get { + return ResourceManager.GetString("GetOrPostFlagsRequired", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext.. + /// </summary> + internal static string HttpContextRequired { + get { + return ResourceManager.GetString("HttpContextRequired", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Messages that indicate indirect transport must implement the {0} interface.. + /// </summary> + internal static string IndirectMessagesMustImplementIDirectedProtocolMessage { + get { + return ResourceManager.GetString("IndirectMessagesMustImplementIDirectedProtocolMessage", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Insecure web request for '{0}' aborted due to security requirements demanding HTTPS.. + /// </summary> + internal static string InsecureWebRequestWithSslRequired { + get { + return ResourceManager.GetString("InsecureWebRequestWithSslRequired", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The {0} message required protections {{{1}}} but the channel could only apply {{{2}}}.. + /// </summary> + internal static string InsufficientMessageProtection { + get { + return ResourceManager.GetString("InsufficientMessageProtection", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The customized binding element ordering is invalid.. + /// </summary> + internal static string InvalidCustomBindingElementOrder { + get { + return ResourceManager.GetString("InvalidCustomBindingElementOrder", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Some part(s) of the message have invalid values: {0}. + /// </summary> + internal static string InvalidMessageParts { + get { + return ResourceManager.GetString("InvalidMessageParts", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The incoming message had an invalid or missing nonce.. + /// </summary> + internal static string InvalidNonceReceived { + get { + return ResourceManager.GetString("InvalidNonceReceived", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to An item with the same key has already been added.. + /// </summary> + internal static string KeyAlreadyExists { + get { + return ResourceManager.GetString("KeyAlreadyExists", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The value for {0}.{1} on member {1} was expected to derive from {2} but was {3}.. + /// </summary> + internal static string MessagePartEncoderWrongType { + get { + return ResourceManager.GetString("MessagePartEncoderWrongType", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Error while reading message '{0}' parameter '{1}' with value '{2}'.. + /// </summary> + internal static string MessagePartReadFailure { + get { + return ResourceManager.GetString("MessagePartReadFailure", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Message parameter '{0}' with value '{1}' failed to base64 decode.. + /// </summary> + internal static string MessagePartValueBase64DecodingFault { + get { + return ResourceManager.GetString("MessagePartValueBase64DecodingFault", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Error while preparing message '{0}' parameter '{1}' for sending.. + /// </summary> + internal static string MessagePartWriteFailure { + get { + return ResourceManager.GetString("MessagePartWriteFailure", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to A message response is already queued for sending in the response stream.. + /// </summary> + internal static string QueuedMessageResponseAlreadyExists { + get { + return ResourceManager.GetString("QueuedMessageResponseAlreadyExists", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to This message has already been processed. This could indicate a replay attack in progress.. + /// </summary> + internal static string ReplayAttackDetected { + get { + return ResourceManager.GetString("ReplayAttackDetected", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to This channel does not support replay protection.. + /// </summary> + internal static string ReplayProtectionNotSupported { + get { + return ResourceManager.GetString("ReplayProtectionNotSupported", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The following required non-empty parameters were empty in the {0} message: {1}. + /// </summary> + internal static string RequiredNonEmptyParameterWasEmpty { + get { + return ResourceManager.GetString("RequiredNonEmptyParameterWasEmpty", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The following required parameters were missing from the {0} message: {1}. + /// </summary> + internal static string RequiredParametersMissing { + get { + return ResourceManager.GetString("RequiredParametersMissing", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The binding element offering the {0} protection requires other protection that is not provided.. + /// </summary> + internal static string RequiredProtectionMissing { + get { + return ResourceManager.GetString("RequiredProtectionMissing", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The list is empty.. + /// </summary> + internal static string SequenceContainsNoElements { + get { + return ResourceManager.GetString("SequenceContainsNoElements", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The list contains a null element.. + /// </summary> + internal static string SequenceContainsNullElement { + get { + return ResourceManager.GetString("SequenceContainsNullElement", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Message signature was incorrect.. + /// </summary> + internal static string SignatureInvalid { + get { + return ResourceManager.GetString("SignatureInvalid", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to This channel does not support signing messages. To support signing messages, a derived Channel type must override the Sign and IsSignatureValid methods.. + /// </summary> + internal static string SigningNotSupported { + get { + return ResourceManager.GetString("SigningNotSupported", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The stream's CanRead property returned false.. + /// </summary> + internal static string StreamUnreadable { + get { + return ResourceManager.GetString("StreamUnreadable", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The stream's CanWrite property returned false.. + /// </summary> + internal static string StreamUnwritable { + get { + return ResourceManager.GetString("StreamUnwritable", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Expected at most 1 binding element to apply the {0} protection, but more than one applied.. + /// </summary> + internal static string TooManyBindingsOfferingSameProtection { + get { + return ResourceManager.GetString("TooManyBindingsOfferingSameProtection", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The maximum allowable number of redirects were exceeded while requesting '{0}'.. + /// </summary> + internal static string TooManyRedirects { + get { + return ResourceManager.GetString("TooManyRedirects", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The array must not be empty.. + /// </summary> + internal static string UnexpectedEmptyArray { + get { + return ResourceManager.GetString("UnexpectedEmptyArray", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The empty string is not allowed.. + /// </summary> + internal static string UnexpectedEmptyString { + get { + return ResourceManager.GetString("UnexpectedEmptyString", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Message parameter '{0}' had unexpected value '{1}'.. + /// </summary> + internal static string UnexpectedMessagePartValue { + get { + return ResourceManager.GetString("UnexpectedMessagePartValue", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Expected message {0} parameter '{1}' to have value '{2}' but had '{3}' instead.. + /// </summary> + internal static string UnexpectedMessagePartValueForConstant { + get { + return ResourceManager.GetString("UnexpectedMessagePartValueForConstant", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Expected message {0} but received {1} instead.. + /// </summary> + internal static string UnexpectedMessageReceived { + get { + return ResourceManager.GetString("UnexpectedMessageReceived", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Unexpected message type received.. + /// </summary> + internal static string UnexpectedMessageReceivedOfMany { + get { + return ResourceManager.GetString("UnexpectedMessageReceivedOfMany", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to A null value was included and is not allowed.. + /// </summary> + internal static string UnexpectedNullValue { + get { + return ResourceManager.GetString("UnexpectedNullValue", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The type {0} or a derived type was expected, but {1} was given.. + /// </summary> + internal static string UnexpectedType { + get { + return ResourceManager.GetString("UnexpectedType", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to {0} property has unrecognized value {1}.. + /// </summary> + internal static string UnrecognizedEnumValue { + get { + return ResourceManager.GetString("UnrecognizedEnumValue", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to The URL '{0}' is rated unsafe and cannot be requested this way.. + /// </summary> + internal static string UnsafeWebRequestDetected { + get { + return ResourceManager.GetString("UnsafeWebRequestDetected", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Redirects on POST requests that are to untrusted servers is not supported.. + /// </summary> + internal static string UntrustedRedirectsOnPOSTNotSupported { + get { + return ResourceManager.GetString("UntrustedRedirectsOnPOSTNotSupported", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Web request to '{0}' failed.. + /// </summary> + internal static string WebRequestFailed { + get { + return ResourceManager.GetString("WebRequestFailed", resourceCulture); + } + } + } +} diff --git a/src/DotNetOpenAuth/Messaging/MessagingStrings.resx b/src/DotNetOpenAuth/Messaging/MessagingStrings.resx index 2dee0fd..84eeb22 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingStrings.resx +++ b/src/DotNetOpenAuth/Messaging/MessagingStrings.resx @@ -1,270 +1,270 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ArgumentPropertyMissing" xml:space="preserve">
- <value>Argument's {0}.{1} property is required but is empty or null.</value>
- </data>
- <data name="CurrentHttpContextRequired" xml:space="preserve">
- <value>HttpContext.Current is null. There must be an ASP.NET request in process for this operation to succeed.</value>
- </data>
- <data name="DataContractMissingFromMessageType" xml:space="preserve">
- <value>DataContractSerializer could not be initialized on message type {0}. Is it missing a [DataContract] attribute?</value>
- </data>
- <data name="DataContractMissingNamespace" xml:space="preserve">
- <value>DataContractSerializer could not be initialized on message type {0} because the DataContractAttribute.Namespace property is not set.</value>
- </data>
- <data name="DerivedTypeNotExpected" xml:space="preserve">
- <value>An instance of type {0} was expected, but received unexpected derived type {1}.</value>
- </data>
- <data name="DirectedMessageMissingRecipient" xml:space="preserve">
- <value>The directed message's Recipient property must not be null.</value>
- </data>
- <data name="ErrorDeserializingMessage" xml:space="preserve">
- <value>Error while deserializing message {0}.</value>
- </data>
- <data name="ErrorInRequestReplyMessage" xml:space="preserve">
- <value>Error occurred while sending a direct message or getting the response.</value>
- </data>
- <data name="ExceptionNotConstructedForTransit" xml:space="preserve">
- <value>This exception was not constructed with a root request message that caused it.</value>
- </data>
- <data name="ExpectedMessageNotReceived" xml:space="preserve">
- <value>Expected {0} message but received no recognizable message.</value>
- </data>
- <data name="ExpiredMessage" xml:space="preserve">
- <value>The message expired at {0} and it is now {1}.</value>
- </data>
- <data name="GetOrPostFlagsRequired" xml:space="preserve">
- <value>At least one of GET or POST flags must be present.</value>
- </data>
- <data name="HttpContextRequired" xml:space="preserve">
- <value>This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext.</value>
- </data>
- <data name="IndirectMessagesMustImplementIDirectedProtocolMessage" xml:space="preserve">
- <value>Messages that indicate indirect transport must implement the {0} interface.</value>
- </data>
- <data name="InsecureWebRequestWithSslRequired" xml:space="preserve">
- <value>Insecure web request for '{0}' aborted due to security requirements demanding HTTPS.</value>
- </data>
- <data name="InsufficientMessageProtection" xml:space="preserve">
- <value>The {0} message required protections {{{1}}} but the channel could only apply {{{2}}}.</value>
- </data>
- <data name="InvalidCustomBindingElementOrder" xml:space="preserve">
- <value>The customized binding element ordering is invalid.</value>
- </data>
- <data name="InvalidMessageParts" xml:space="preserve">
- <value>Some part(s) of the message have invalid values: {0}</value>
- </data>
- <data name="InvalidNonceReceived" xml:space="preserve">
- <value>The incoming message had an invalid or missing nonce.</value>
- </data>
- <data name="KeyAlreadyExists" xml:space="preserve">
- <value>An item with the same key has already been added.</value>
- </data>
- <data name="MessagePartEncoderWrongType" xml:space="preserve">
- <value>The value for {0}.{1} on member {1} was expected to derive from {2} but was {3}.</value>
- </data>
- <data name="MessagePartReadFailure" xml:space="preserve">
- <value>Error while reading message '{0}' parameter '{1}' with value '{2}'.</value>
- </data>
- <data name="MessagePartValueBase64DecodingFault" xml:space="preserve">
- <value>Message parameter '{0}' with value '{1}' failed to base64 decode.</value>
- </data>
- <data name="MessagePartWriteFailure" xml:space="preserve">
- <value>Error while preparing message '{0}' parameter '{1}' for sending.</value>
- </data>
- <data name="QueuedMessageResponseAlreadyExists" xml:space="preserve">
- <value>A message response is already queued for sending in the response stream.</value>
- </data>
- <data name="ReplayAttackDetected" xml:space="preserve">
- <value>This message has already been processed. This could indicate a replay attack in progress.</value>
- </data>
- <data name="ReplayProtectionNotSupported" xml:space="preserve">
- <value>This channel does not support replay protection.</value>
- </data>
- <data name="RequiredNonEmptyParameterWasEmpty" xml:space="preserve">
- <value>The following required non-empty parameters were empty in the {0} message: {1}</value>
- </data>
- <data name="RequiredParametersMissing" xml:space="preserve">
- <value>The following required parameters were missing from the {0} message: {1}</value>
- </data>
- <data name="RequiredProtectionMissing" xml:space="preserve">
- <value>The binding element offering the {0} protection requires other protection that is not provided.</value>
- </data>
- <data name="SequenceContainsNoElements" xml:space="preserve">
- <value>The list is empty.</value>
- </data>
- <data name="SequenceContainsNullElement" xml:space="preserve">
- <value>The list contains a null element.</value>
- </data>
- <data name="SignatureInvalid" xml:space="preserve">
- <value>Message signature was incorrect.</value>
- </data>
- <data name="SigningNotSupported" xml:space="preserve">
- <value>This channel does not support signing messages. To support signing messages, a derived Channel type must override the Sign and IsSignatureValid methods.</value>
- </data>
- <data name="StreamUnreadable" xml:space="preserve">
- <value>The stream's CanRead property returned false.</value>
- </data>
- <data name="StreamUnwritable" xml:space="preserve">
- <value>The stream's CanWrite property returned false.</value>
- </data>
- <data name="TooManyBindingsOfferingSameProtection" xml:space="preserve">
- <value>Expected at most 1 binding element to apply the {0} protection, but more than one applied.</value>
- </data>
- <data name="TooManyRedirects" xml:space="preserve">
- <value>The maximum allowable number of redirects were exceeded while requesting '{0}'.</value>
- </data>
- <data name="UnexpectedEmptyArray" xml:space="preserve">
- <value>The array must not be empty.</value>
- </data>
- <data name="UnexpectedEmptyString" xml:space="preserve">
- <value>The empty string is not allowed.</value>
- </data>
- <data name="UnexpectedMessagePartValue" xml:space="preserve">
- <value>Message parameter '{0}' had unexpected value '{1}'.</value>
- </data>
- <data name="UnexpectedMessagePartValueForConstant" xml:space="preserve">
- <value>Expected message {0} parameter '{1}' to have value '{2}' but had '{3}' instead.</value>
- </data>
- <data name="UnexpectedMessageReceived" xml:space="preserve">
- <value>Expected message {0} but received {1} instead.</value>
- </data>
- <data name="UnexpectedMessageReceivedOfMany" xml:space="preserve">
- <value>Unexpected message type received.</value>
- </data>
- <data name="UnexpectedNullValue" xml:space="preserve">
- <value>A null value was included and is not allowed.</value>
- </data>
- <data name="UnexpectedType" xml:space="preserve">
- <value>The type {0} or a derived type was expected, but {1} was given.</value>
- </data>
- <data name="UnrecognizedEnumValue" xml:space="preserve">
- <value>{0} property has unrecognized value {1}.</value>
- </data>
- <data name="UnsafeWebRequestDetected" xml:space="preserve">
- <value>The URL '{0}' is rated unsafe and cannot be requested this way.</value>
- </data>
- <data name="UntrustedRedirectsOnPOSTNotSupported" xml:space="preserve">
- <value>Redirects on POST requests that are to untrusted servers is not supported.</value>
- </data>
- <data name="WebRequestFailed" xml:space="preserve">
- <value>Web request to '{0}' failed.</value>
- </data>
-</root>
\ No newline at end of file +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="ArgumentPropertyMissing" xml:space="preserve"> + <value>Argument's {0}.{1} property is required but is empty or null.</value> + </data> + <data name="CurrentHttpContextRequired" xml:space="preserve"> + <value>HttpContext.Current is null. There must be an ASP.NET request in process for this operation to succeed.</value> + </data> + <data name="DataContractMissingFromMessageType" xml:space="preserve"> + <value>DataContractSerializer could not be initialized on message type {0}. Is it missing a [DataContract] attribute?</value> + </data> + <data name="DataContractMissingNamespace" xml:space="preserve"> + <value>DataContractSerializer could not be initialized on message type {0} because the DataContractAttribute.Namespace property is not set.</value> + </data> + <data name="DerivedTypeNotExpected" xml:space="preserve"> + <value>An instance of type {0} was expected, but received unexpected derived type {1}.</value> + </data> + <data name="DirectedMessageMissingRecipient" xml:space="preserve"> + <value>The directed message's Recipient property must not be null.</value> + </data> + <data name="ErrorDeserializingMessage" xml:space="preserve"> + <value>Error while deserializing message {0}.</value> + </data> + <data name="ErrorInRequestReplyMessage" xml:space="preserve"> + <value>Error occurred while sending a direct message or getting the response.</value> + </data> + <data name="ExceptionNotConstructedForTransit" xml:space="preserve"> + <value>This exception was not constructed with a root request message that caused it.</value> + </data> + <data name="ExpectedMessageNotReceived" xml:space="preserve"> + <value>Expected {0} message but received no recognizable message.</value> + </data> + <data name="ExpiredMessage" xml:space="preserve"> + <value>The message expired at {0} and it is now {1}.</value> + </data> + <data name="GetOrPostFlagsRequired" xml:space="preserve"> + <value>At least one of GET or POST flags must be present.</value> + </data> + <data name="HttpContextRequired" xml:space="preserve"> + <value>This method requires a current HttpContext. Alternatively, use an overload of this method that allows you to pass in information without an HttpContext.</value> + </data> + <data name="IndirectMessagesMustImplementIDirectedProtocolMessage" xml:space="preserve"> + <value>Messages that indicate indirect transport must implement the {0} interface.</value> + </data> + <data name="InsecureWebRequestWithSslRequired" xml:space="preserve"> + <value>Insecure web request for '{0}' aborted due to security requirements demanding HTTPS.</value> + </data> + <data name="InsufficientMessageProtection" xml:space="preserve"> + <value>The {0} message required protections {{{1}}} but the channel could only apply {{{2}}}.</value> + </data> + <data name="InvalidCustomBindingElementOrder" xml:space="preserve"> + <value>The customized binding element ordering is invalid.</value> + </data> + <data name="InvalidMessageParts" xml:space="preserve"> + <value>Some part(s) of the message have invalid values: {0}</value> + </data> + <data name="InvalidNonceReceived" xml:space="preserve"> + <value>The incoming message had an invalid or missing nonce.</value> + </data> + <data name="KeyAlreadyExists" xml:space="preserve"> + <value>An item with the same key has already been added.</value> + </data> + <data name="MessagePartEncoderWrongType" xml:space="preserve"> + <value>The value for {0}.{1} on member {1} was expected to derive from {2} but was {3}.</value> + </data> + <data name="MessagePartReadFailure" xml:space="preserve"> + <value>Error while reading message '{0}' parameter '{1}' with value '{2}'.</value> + </data> + <data name="MessagePartValueBase64DecodingFault" xml:space="preserve"> + <value>Message parameter '{0}' with value '{1}' failed to base64 decode.</value> + </data> + <data name="MessagePartWriteFailure" xml:space="preserve"> + <value>Error while preparing message '{0}' parameter '{1}' for sending.</value> + </data> + <data name="QueuedMessageResponseAlreadyExists" xml:space="preserve"> + <value>A message response is already queued for sending in the response stream.</value> + </data> + <data name="ReplayAttackDetected" xml:space="preserve"> + <value>This message has already been processed. This could indicate a replay attack in progress.</value> + </data> + <data name="ReplayProtectionNotSupported" xml:space="preserve"> + <value>This channel does not support replay protection.</value> + </data> + <data name="RequiredNonEmptyParameterWasEmpty" xml:space="preserve"> + <value>The following required non-empty parameters were empty in the {0} message: {1}</value> + </data> + <data name="RequiredParametersMissing" xml:space="preserve"> + <value>The following required parameters were missing from the {0} message: {1}</value> + </data> + <data name="RequiredProtectionMissing" xml:space="preserve"> + <value>The binding element offering the {0} protection requires other protection that is not provided.</value> + </data> + <data name="SequenceContainsNoElements" xml:space="preserve"> + <value>The list is empty.</value> + </data> + <data name="SequenceContainsNullElement" xml:space="preserve"> + <value>The list contains a null element.</value> + </data> + <data name="SignatureInvalid" xml:space="preserve"> + <value>Message signature was incorrect.</value> + </data> + <data name="SigningNotSupported" xml:space="preserve"> + <value>This channel does not support signing messages. To support signing messages, a derived Channel type must override the Sign and IsSignatureValid methods.</value> + </data> + <data name="StreamUnreadable" xml:space="preserve"> + <value>The stream's CanRead property returned false.</value> + </data> + <data name="StreamUnwritable" xml:space="preserve"> + <value>The stream's CanWrite property returned false.</value> + </data> + <data name="TooManyBindingsOfferingSameProtection" xml:space="preserve"> + <value>Expected at most 1 binding element to apply the {0} protection, but more than one applied.</value> + </data> + <data name="TooManyRedirects" xml:space="preserve"> + <value>The maximum allowable number of redirects were exceeded while requesting '{0}'.</value> + </data> + <data name="UnexpectedEmptyArray" xml:space="preserve"> + <value>The array must not be empty.</value> + </data> + <data name="UnexpectedEmptyString" xml:space="preserve"> + <value>The empty string is not allowed.</value> + </data> + <data name="UnexpectedMessagePartValue" xml:space="preserve"> + <value>Message parameter '{0}' had unexpected value '{1}'.</value> + </data> + <data name="UnexpectedMessagePartValueForConstant" xml:space="preserve"> + <value>Expected message {0} parameter '{1}' to have value '{2}' but had '{3}' instead.</value> + </data> + <data name="UnexpectedMessageReceived" xml:space="preserve"> + <value>Expected message {0} but received {1} instead.</value> + </data> + <data name="UnexpectedMessageReceivedOfMany" xml:space="preserve"> + <value>Unexpected message type received.</value> + </data> + <data name="UnexpectedNullValue" xml:space="preserve"> + <value>A null value was included and is not allowed.</value> + </data> + <data name="UnexpectedType" xml:space="preserve"> + <value>The type {0} or a derived type was expected, but {1} was given.</value> + </data> + <data name="UnrecognizedEnumValue" xml:space="preserve"> + <value>{0} property has unrecognized value {1}.</value> + </data> + <data name="UnsafeWebRequestDetected" xml:space="preserve"> + <value>The URL '{0}' is rated unsafe and cannot be requested this way.</value> + </data> + <data name="UntrustedRedirectsOnPOSTNotSupported" xml:space="preserve"> + <value>Redirects on POST requests that are to untrusted servers is not supported.</value> + </data> + <data name="WebRequestFailed" xml:space="preserve"> + <value>Web request to '{0}' failed.</value> + </data> +</root> diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs index b66c7ca..aa80f96 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs @@ -295,6 +295,10 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// Tests two sequences for same contents and ordering. /// </summary> + /// <typeparam name="T">The type of elements in the arrays.</typeparam> + /// <param name="sequence1">The first sequence in the comparison. May not be null.</param> + /// <param name="sequence2">The second sequence in the comparison. May not be null.</param> + /// <returns>True if the arrays equal; false otherwise.</returns> internal static bool AreEquivalent<T>(IEnumerable<T> sequence1, IEnumerable<T> sequence2) { if (sequence1 == null && sequence2 == null) { return true; diff --git a/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs b/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs index b71d644..cf9331e 100644 --- a/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs +++ b/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using System; using System.Collections.Generic; + using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -136,6 +137,21 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { } else { base.VerifyMessageAfterReceiving(message); } + + // Convert an OpenID indirect error message, which we never expect + // between two good OpenID implementations, into an exception. + // We don't process DirectErrorResponse because associate negotiations + // commonly get a derivative of that message type and handle it. + var errorMessage = message as IndirectErrorResponse; + if (errorMessage != null) { + string exceptionMessage = string.Format( + CultureInfo.CurrentCulture, + OpenIdStrings.IndirectErrorFormattedMessage, + errorMessage.ErrorMessage, + errorMessage.Contact, + errorMessage.Reference); + throw new ProtocolException(exceptionMessage, message); + } } /// <summary> diff --git a/src/DotNetOpenAuth/OpenId/Messages/IndirectSignedResponse.cs b/src/DotNetOpenAuth/OpenId/Messages/IndirectSignedResponse.cs index 7c0015f..56dc38e 100644 --- a/src/DotNetOpenAuth/OpenId/Messages/IndirectSignedResponse.cs +++ b/src/DotNetOpenAuth/OpenId/Messages/IndirectSignedResponse.cs @@ -322,6 +322,10 @@ namespace DotNetOpenAuth.OpenId.Messages { return value; } + internal IEnumerable<string> GetReturnToParameterNames() { + return this.ReturnToParameters.Keys; + } + /// <summary> /// Verifies that the openid.return_to field matches the URL of the actual HTTP request. /// </summary> diff --git a/src/DotNetOpenAuth/OpenId/Messages/SignedResponseRequest.cs b/src/DotNetOpenAuth/OpenId/Messages/SignedResponseRequest.cs index 64aaa89..0e21807 100644 --- a/src/DotNetOpenAuth/OpenId/Messages/SignedResponseRequest.cs +++ b/src/DotNetOpenAuth/OpenId/Messages/SignedResponseRequest.cs @@ -162,9 +162,9 @@ namespace DotNetOpenAuth.OpenId.Messages { /// Gets the value of the openid.mode parameter based on the protocol version and immediate flag. /// </summary> /// <param name="version">The OpenID version to use.</param> - /// <param name="immediate"> - /// <c>true</c> for asynchronous javascript clients; - /// <c>false</c> to allow the Provider to interact with the user in order to complete authentication. + /// <param name="mode"> + /// <see cref="AuthenticationRequestMode.Immediate"/> for asynchronous javascript clients; + /// <see cref="AuthenticationRequestMode.Setup"/> to allow the Provider to interact with the user in order to complete authentication. /// </param> /// <returns>checkid_immediate or checkid_setup</returns> private static string GetMode(Version version, AuthenticationRequestMode mode) { diff --git a/src/DotNetOpenAuth/OpenId/OpenIdStrings.Designer.cs b/src/DotNetOpenAuth/OpenId/OpenIdStrings.Designer.cs index 582eb90..16007d5 100644 --- a/src/DotNetOpenAuth/OpenId/OpenIdStrings.Designer.cs +++ b/src/DotNetOpenAuth/OpenId/OpenIdStrings.Designer.cs @@ -142,6 +142,15 @@ namespace DotNetOpenAuth.OpenId { } /// <summary> + /// Looks up a localized string similar to {0} (Contact: {1}, Reference: {2}). + /// </summary> + internal static string IndirectErrorFormattedMessage { + get { + return ResourceManager.GetString("IndirectErrorFormattedMessage", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to Cannot encode '{0}' because it contains an illegal character for Key-Value Form encoding. (line {1}: '{2}'). /// </summary> internal static string InvalidCharacterInKeyValueFormInput { @@ -187,6 +196,19 @@ namespace DotNetOpenAuth.OpenId { } /// <summary> + /// Looks up a localized string similar to The OpenId Provider issued an assertion for an Identifier whose discovery information did not match. + ///Assertion endpoint info: + ///{0} + ///Discovered endpoint info: + ///{1}. + /// </summary> + internal static string IssuedAssertionFailsIdentifierDiscovery { + get { + return ResourceManager.GetString("IssuedAssertionFailsIdentifierDiscovery", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to The list of keys do not match the provided dictionary.. /// </summary> internal static string KeysListAndDictionaryDoNotMatch { @@ -241,6 +263,15 @@ namespace DotNetOpenAuth.OpenId { } /// <summary> + /// Looks up a localized string similar to This operation is only allowed when IAuthenticationResponse.State == AuthenticationStatus.SetupRequired.. + /// </summary> + internal static string OperationOnlyValidForSetupRequiredState { + get { + return ResourceManager.GetString("OperationOnlyValidForSetupRequiredState", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to Unable to determine the version of the OpenID protocol implemented by the Provider at endpoint '{0}'.. /// </summary> internal static string ProviderVersionUnrecognized { diff --git a/src/DotNetOpenAuth/OpenId/OpenIdStrings.resx b/src/DotNetOpenAuth/OpenId/OpenIdStrings.resx index 8b5e09f..4137c90 100644 --- a/src/DotNetOpenAuth/OpenId/OpenIdStrings.resx +++ b/src/DotNetOpenAuth/OpenId/OpenIdStrings.resx @@ -144,6 +144,9 @@ <data name="ExtensionAlreadyAddedWithSameTypeURI" xml:space="preserve"> <value>An extension sharing namespace '{0}' has already been added. Only one extension per namespace is allowed in a given request.</value> </data> + <data name="IndirectErrorFormattedMessage" xml:space="preserve"> + <value>{0} (Contact: {1}, Reference: {2})</value> + </data> <data name="InvalidCharacterInKeyValueFormInput" xml:space="preserve"> <value>Cannot encode '{0}' because it contains an illegal character for Key-Value Form encoding. (line {1}: '{2}')</value> </data> @@ -159,6 +162,13 @@ <data name="InvalidXri" xml:space="preserve"> <value>Not a recognized XRI format: '{0}'.</value> </data> + <data name="IssuedAssertionFailsIdentifierDiscovery" xml:space="preserve"> + <value>The OpenId Provider issued an assertion for an Identifier whose discovery information did not match. +Assertion endpoint info: +{0} +Discovered endpoint info: +{1}</value> + </data> <data name="KeysListAndDictionaryDoNotMatch" xml:space="preserve"> <value>The list of keys do not match the provided dictionary.</value> </data> @@ -174,6 +184,12 @@ <data name="NoSessionTypeFound" xml:space="preserve"> <value>Diffie-Hellman session type '{0}' not found for OpenID {1}.</value> </data> + <data name="OpenIdEndpointNotFound" xml:space="preserve"> + <value>No OpenId endpoint found.</value> + </data> + <data name="OperationOnlyValidForSetupRequiredState" xml:space="preserve"> + <value>This operation is only allowed when IAuthenticationResponse.State == AuthenticationStatus.SetupRequired.</value> + </data> <data name="ProviderVersionUnrecognized" xml:space="preserve"> <value>Unable to determine the version of the OpenID protocol implemented by the Provider at endpoint '{0}'.</value> </data> diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs index 968066b..e2e959c 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs @@ -17,6 +17,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { internal class AuthenticationRequest : IAuthenticationRequest { internal OpenIdRelyingParty RelyingParty; internal AssociationPreference associationPreference = AssociationPreference.IfPossible; + internal const string UserSuppliedIdentifierParameterName = "dnoi.userSuppliedIdentifier"; private readonly ServiceEndpoint endpoint; private readonly Protocol protocol; private List<IOpenIdMessageExtension> extensions = new List<IOpenIdMessageExtension>(); @@ -113,7 +114,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { if (Logger.IsWarnEnabled && returnToUrl.Query != null) { NameValueCollection returnToArgs = HttpUtility.ParseQueryString(returnToUrl.Query); foreach (string key in returnToArgs) { - if (OpenIdRelyingParty.ShouldParameterBeStrippedFromReturnToUrl(key)) { + if (OpenIdRelyingParty.IsOpenIdSupportingParameter(key)) { Logger.WarnFormat("OpenId argument \"{0}\" found in return_to URL. This can corrupt an OpenID response.", key); break; } @@ -243,6 +244,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { request.ReturnTo = this.ReturnToUrl; request.AssociationHandle = association != null ? association.Handle : null; request.AddReturnToArguments(this.returnToArgs); + request.AddReturnToArguments(UserSuppliedIdentifierParameterName, this.endpoint.UserSuppliedIdentifier); foreach (IOpenIdMessageExtension extension in this.extensions) { request.Extensions.Add(extension); } diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/FailedAuthenticationResponse.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/FailedAuthenticationResponse.cs new file mode 100644 index 0000000..92fd532 --- /dev/null +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/FailedAuthenticationResponse.cs @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------- +// <copyright file="FailedAuthenticationResponse.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OpenId.RelyingParty { + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Globalization; + using System.Text; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId; + using DotNetOpenAuth.OpenId.Messages; + using DotNetOpenAuth.OpenId.RelyingParty; + + [DebuggerDisplay("{Exception.Message}")] + internal class FailedAuthenticationResponse : IAuthenticationResponse { + /// <summary> + /// Initializes a new instance of the <see cref="FailedAuthenticationResponse"/> class. + /// </summary> + /// <param name="exception">The exception that resulted in the failed authentication.</param> + internal FailedAuthenticationResponse(Exception exception) { + this.Exception = exception; + } + + #region IAuthenticationResponse Members + + public Identifier ClaimedIdentifier { + get { return null; } + } + + public string FriendlyIdentifierForDisplay { + get { return null; } + } + + public AuthenticationStatus Status { + get { return AuthenticationStatus.Failed; } + } + + public Exception Exception { get; private set; } + + public IDictionary<string, string> GetCallbackArguments() { + return new Dictionary<string, string>(); + } + + public string GetCallbackArgument(string key) { + return null; + } + + public T GetExtension<T>() where T : IOpenIdMessageExtension, new() { + return default(T); + } + + public IOpenIdMessageExtension GetExtension(Type extensionType) { + return null; + } + + #endregion + } +} diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs index 3d5e55a..9cfdf7b 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs @@ -18,7 +18,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> public interface IAuthenticationRequest { /// <summary> - /// Gets/sets the mode the Provider should use during authentication. + /// Gets or sets the mode the Provider should use during authentication. /// </summary> AuthenticationRequestMode Mode { get; set; } diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs index bf21280..e4f220f 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs @@ -15,10 +15,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// Gets the <see cref="Identifier"/> to pass to <see cref="OpenIdRelyingParty.CreateRequest(Identifier)"/> /// in a subsequent authentication attempt. /// </summary> - /// <remarks> - /// When directed identity is used, this will be the Provider Identifier given by the user. - /// Otherwise it will be the Claimed Identifier derived from the user-supplied identifier. - /// </remarks> - Identifier ClaimedOrProviderIdentifier { get; } + Identifier UserSuppliedIdentifier { get; } } } diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/NegativeAuthenticationResponse.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/NegativeAuthenticationResponse.cs new file mode 100644 index 0000000..9d1cffc --- /dev/null +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/NegativeAuthenticationResponse.cs @@ -0,0 +1,73 @@ +//----------------------------------------------------------------------- +// <copyright file="NegativeAuthenticationResponse.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OpenId.RelyingParty { + using System; + using System.Collections.Generic; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Messages; + + internal class NegativeAuthenticationResponse : IAuthenticationResponse, ISetupRequiredAuthenticationResponse { + private readonly NegativeAssertionResponse response; + + internal NegativeAuthenticationResponse(NegativeAssertionResponse response) { + ErrorUtilities.VerifyArgumentNotNull(response, "response"); + this.response = response; + } + + #region IAuthenticationResponse Members + + public Identifier ClaimedIdentifier { + get { return null; } + } + + public string FriendlyIdentifierForDisplay { + get { return null; } + } + + public AuthenticationStatus Status { + get { return this.response.Immediate ? AuthenticationStatus.SetupRequired : AuthenticationStatus.Canceled; } + } + + public Exception Exception { + get { return null; } + } + + public string GetCallbackArgument(string key) { + return null; + } + + public IDictionary<string, string> GetCallbackArguments() { + return EmptyDictionary<string, string>.Instance; + } + + public T GetExtension<T>() where T : IOpenIdMessageExtension, new() { + return default(T); + } + + public IOpenIdMessageExtension GetExtension(Type extensionType) { + return null; + } + + #endregion + + #region ISetupRequiredAuthenticationResponse Members + + public Identifier UserSuppliedIdentifier { + get { + if (this.Status != AuthenticationStatus.SetupRequired) { + throw new InvalidOperationException(OpenIdStrings.OperationOnlyValidForSetupRequiredState); + } + + string userSuppliedIdentifier; + this.response.ExtraData.TryGetValue(AuthenticationRequest.UserSuppliedIdentifierParameterName, out userSuppliedIdentifier); + return userSuppliedIdentifier; + } + } + + #endregion + } +} diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs index 820a58a..ab2385f 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs @@ -188,7 +188,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// An authentication request object that describes the HTTP response to /// send to the user agent to initiate the authentication. /// </returns> - /// <exception cref="OpenIdException">Thrown if no OpenID endpoint could be found.</exception> + /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl) { try { return this.CreateRequests(userSuppliedIdentifier, realm, returnToUrl).First(); @@ -216,7 +216,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <remarks> /// This method requires an ASP.NET HttpContext. /// </remarks> - /// <exception cref="OpenIdException">Thrown if no OpenID endpoint could be found.</exception> + /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm) { try { return this.CreateRequests(userSuppliedIdentifier, realm).First(); @@ -239,7 +239,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <remarks> /// This method requires an ASP.NET HttpContext. /// </remarks> - /// <exception cref="OpenIdException">Thrown if no OpenID endpoint could be found.</exception> + /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier) { try { return this.CreateRequests(userSuppliedIdentifier).First(); @@ -248,7 +248,42 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } } - internal static bool ShouldParameterBeStrippedFromReturnToUrl(string parameterName) { + /// <summary> + /// Gets an authentication response from a Provider. + /// </summary> + /// <returns>The processed authentication response if there is any; <c>null</c> otherwise.</returns> + /// <remarks> + /// This method requires an ASP.NET HttpContext. + /// </remarks> + public IAuthenticationResponse GetResponse() { + return this.GetResponse(this.Channel.GetRequestFromContext()); + } + + /// <summary> + /// Gets an authentication response from a Provider. + /// </summary> + /// <param name="httpRequestInfo">The HTTP request that may be carrying an authentication response from the Provider.</param> + /// <returns>The processed authentication response if there is any; <c>null</c> otherwise.</returns> + public IAuthenticationResponse GetResponse(HttpRequestInfo httpRequestInfo) { + try { + var message = this.Channel.ReadFromRequest(); + PositiveAssertionResponse positiveAssertion; + NegativeAssertionResponse negativeAssertion; + if ((positiveAssertion = message as PositiveAssertionResponse) != null) { + return new PositiveAuthenticationResponse(positiveAssertion, this); + } else if ((negativeAssertion = message as NegativeAssertionResponse) != null) { + return new NegativeAuthenticationResponse(negativeAssertion); + } else if (message != null) { + Logger.WarnFormat("Received unexpected message type {0} when expecting an assertion message.", message.GetType().Name); + } + + return null; + } catch (ProtocolException ex) { + return new FailedAuthenticationResponse(ex); + } + } + + internal static bool IsOpenIdSupportingParameter(string parameterName) { Protocol protocol = Protocol.Default; return parameterName.StartsWith(protocol.openid.Prefix, StringComparison.OrdinalIgnoreCase) || parameterName.StartsWith("dnoi.", StringComparison.Ordinal); @@ -334,7 +369,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { NameValueCollection queryParams = MessagingUtilities.GetQueryFromContextNVC(); var returnToParams = new Dictionary<string, string>(queryParams.Count); foreach (string key in queryParams) { - if (!ShouldParameterBeStrippedFromReturnToUrl(key)) { + if (!IsOpenIdSupportingParameter(key)) { returnToParams.Add(key, queryParams[key]); } } diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/PositiveAuthenticationResponse.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/PositiveAuthenticationResponse.cs new file mode 100644 index 0000000..1d9dbdf --- /dev/null +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/PositiveAuthenticationResponse.cs @@ -0,0 +1,118 @@ +//----------------------------------------------------------------------- +// <copyright file="PositiveAuthenticationResponse.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OpenId.RelyingParty { + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + using System.Text; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Messages; + + [DebuggerDisplay("Status: {Status}, ClaimedIdentifier: {ClaimedIdentifier}")] + internal class PositiveAuthenticationResponse : IAuthenticationResponse { + private readonly PositiveAssertionResponse response; + private readonly OpenIdRelyingParty relyingParty; + + /// <summary> + /// The OpenID service endpoint reconstructed from the assertion message. + /// </summary> + /// <remarks> + /// This information is straight from the Provider, and therefore must not + /// be trusted until verified as matching the discovery information for + /// the claimed identifier to avoid a Provider asserting an Identifier + /// for which it has no authority. + /// </remarks> + private readonly ServiceEndpoint endpoint; + + internal PositiveAuthenticationResponse(PositiveAssertionResponse response, OpenIdRelyingParty relyingParty) { + ErrorUtilities.VerifyArgumentNotNull(response, "response"); + ErrorUtilities.VerifyArgumentNotNull(relyingParty, "relyingParty"); + + this.response = response; + this.relyingParty = relyingParty; + + this.endpoint = ServiceEndpoint.CreateForClaimedIdentifier( + this.response.ClaimedIdentifier, + this.response.GetReturnToArgument(AuthenticationRequest.UserSuppliedIdentifierParameterName), + this.response.LocalIdentifier, + new ProviderEndpointDescription(this.response.ProviderEndpoint, this.response.Version), + null, + null); + + this.VerifyDiscoveryMatchesAssertion(); + } + + #region IAuthenticationResponse Members + + public Identifier ClaimedIdentifier { + get { return this.endpoint.ClaimedIdentifier; } + } + + public string FriendlyIdentifierForDisplay { + get { return this.endpoint.FriendlyIdentifierForDisplay; } + } + + public AuthenticationStatus Status { + get { return AuthenticationStatus.Authenticated; } + } + + public Exception Exception { + get { return null; } + } + + public string GetCallbackArgument(string key) { + return this.response.GetReturnToArgument(key); + } + + public IDictionary<string, string> GetCallbackArguments() { + var args = new Dictionary<string, string>(); + + // Return all the return_to arguments, except for the OpenID-supporting ones. + // The only arguments that should be returned here are the ones that the host + // web site adds explicitly. + foreach (string key in this.response.GetReturnToParameterNames().Where(key => !OpenIdRelyingParty.IsOpenIdSupportingParameter(key))) { + args[key] = this.response.GetReturnToArgument(key); + } + + return args; + } + + public T GetExtension<T>() where T : IOpenIdMessageExtension, new() { + return this.response.Extensions.OfType<T>().FirstOrDefault(); + } + + public IOpenIdMessageExtension GetExtension(Type extensionType) { + ErrorUtilities.VerifyArgumentNotNull(extensionType, "extensionType"); + return this.response.Extensions.OfType<IOpenIdMessageExtension>().Where(ext => extensionType.IsInstanceOfType(ext)).FirstOrDefault(); + } + + #endregion + + /// <summary> + /// Verifies that the positive assertion data matches the results of + /// discovery on the Claimed Identifier. + /// </summary> + /// <exception cref="ProtocolException"> + /// Thrown when the Provider is asserting that a user controls an Identifier + /// when discovery on that Identifier contradicts what the Provider says. + /// This would be an indication of either a misconfigured Provider or + /// an attempt by someone to spoof another user's identity with a rogue Provider. + /// </exception> + private void VerifyDiscoveryMatchesAssertion() { + Logger.Debug("Verifying assertion matches identifier discovery results..."); + + // TODO: optimize this to not perform a second discovery when we could cache it + // either through the return_to URL or application state. + // PROPOSAL: sign the discovered information in the request so that when it + // comes back in the assertion we can verify that it hasn't changed, without + // sending two copies of all the data in the request. + var discoveryResults = this.response.ClaimedIdentifier.Discover(this.relyingParty.WebRequestHandler); + ErrorUtilities.VerifyProtocol(discoveryResults.Contains(this.endpoint), OpenIdStrings.IssuedAssertionFailsIdentifierDiscovery); + } + } +} |