//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Net;
using DotNetOpenAuth.Messaging;
///
/// A message sent from a Provider to a Relying Party in response to a direct message request that resulted in an error.
///
///
/// This message must be sent with an HTTP status code of 400.
/// This class satisfies OpenID 2.0 section 5.1.2.2.
///
internal class DirectErrorResponse : DirectResponseBase, IErrorMessage, IHttpDirectResponse {
///
/// Initializes a new instance of the class.
///
/// The OpenID version of the response message.
/// The originating request.
internal DirectErrorResponse(Version responseVersion, IDirectedProtocolMessage originatingRequest)
: base(responseVersion, originatingRequest) {
}
#region IHttpDirectResponse Members
///
/// Gets the HTTP status code that the direct respones should be sent with.
///
///
HttpStatusCode IHttpDirectResponse.HttpStatusCode {
get { return HttpStatusCode.BadRequest; }
}
///
/// Gets the HTTP headers to add to the response.
///
/// May be an empty collection, but must not be null.
WebHeaderCollection IHttpDirectResponse.Headers {
get { return new WebHeaderCollection(); }
}
#endregion
///
/// Gets or sets a human-readable message indicating why the request failed.
///
[MessagePart("error", IsRequired = true, AllowEmpty = true)]
public string ErrorMessage { get; set; }
///
/// Gets or sets the contact address for the administrator of the server.
///
/// The contact address may take any form, as it is intended to be displayed to a person.
[MessagePart("contact", IsRequired = false, AllowEmpty = true)]
public string Contact { get; set; }
///
/// Gets or sets a reference token, such as a support ticket number or a URL to a news blog, etc.
///
[MessagePart("reference", IsRequired = false, AllowEmpty = true)]
public string Reference { get; set; }
}
}