//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using DotNetOpenAuth.Messaging;
///
/// The Provider's response to a Relying Party that requested an association that the Provider does not support.
///
///
/// This message type described in OpenID 2.0 section 8.2.4.
///
[DebuggerDisplay("OpenID {Version} associate (failed) response")]
internal class AssociateUnsuccessfulResponse : DirectErrorResponse {
///
/// A hard-coded string indicating an error occurred.
///
/// "unsupported-type"
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Read by reflection")]
[MessagePart("error_code", IsRequired = true, AllowEmpty = false)]
#pragma warning disable 0414 // read by reflection
private readonly string Error = "unsupported-type";
#pragma warning restore 0414
///
/// Initializes a new instance of the class.
///
/// The OpenID version of the response message.
/// The originating request.
internal AssociateUnsuccessfulResponse(Version responseVersion, AssociateRequest originatingRequest)
: base(responseVersion, originatingRequest) {
this.ErrorMessage = string.Format(CultureInfo.CurrentCulture, OpenIdStrings.AssociationOrSessionTypeUnrecognizedOrNotSupported, originatingRequest.AssociationType, originatingRequest.SessionType);
}
///
/// Gets or sets an association type supported by the OP from Section 8.3 (Association Types).
///
[MessagePart("assoc_type", IsRequired = false, AllowEmpty = false)]
internal string AssociationType { get; set; }
///
/// Gets or sets a valid association session type from Section 8.4 (Association Session Types) that the OP supports.
///
[MessagePart("session_type", IsRequired = false, AllowEmpty = false)]
internal string SessionType { get; set; }
}
}