OpenID error direct response messages are now sent with HTTP status codes of 400.
[dotnetoauth.git] / src / DotNetOpenAuth / OpenId / Messages / DirectErrorResponse.cs
blobed272d3ee530e10f2a3c4b47234bccce54e46acf
1 //-----------------------------------------------------------------------
2 // <copyright file="DirectErrorResponse.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
4 // </copyright>
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenAuth.OpenId.Messages {
8 using DotNetOpenAuth.Messaging;
10 /// <summary>
11 /// A message sent from a Provider to a Relying Party in response to a direct message request that resulted in an error.
12 /// </summary>
13 /// <remarks>
14 /// This message must be sent with an HTTP status code of 400.
15 /// This class satisfies OpenID 2.0 section 5.1.2.2.
16 /// </remarks>
17 internal class DirectErrorResponse : DirectResponseBase, IHttpDirectResponse {
18 /// <summary>
19 /// Initializes a new instance of the <see cref="DirectErrorResponse"/> class.
20 /// </summary>
21 /// <param name="originatingRequest">The originating request.</param>
22 internal DirectErrorResponse(IDirectedProtocolMessage originatingRequest)
23 : base(originatingRequest) {
26 #region IHttpDirectResponse Members
28 /// <summary>
29 /// Gets the HTTP status code that the direct respones should be sent with.
30 /// </summary>
31 /// <value><see cref="System.Net.HttpStatusCode.BadRequest"/></value>
32 public System.Net.HttpStatusCode HttpStatusCode {
33 get { return System.Net.HttpStatusCode.BadRequest; }
36 #endregion
38 /// <summary>
39 /// Gets or sets a human-readable message indicating why the request failed.
40 /// </summary>
41 [MessagePart("error", IsRequired = true, AllowEmpty = true)]
42 internal string ErrorMessage { get; set; }
44 /// <summary>
45 /// Gets or sets the contact address for the administrator of the server.
46 /// </summary>
47 /// <value>The contact address may take any form, as it is intended to be displayed to a person. </value>
48 [MessagePart("contact", IsRequired = false, AllowEmpty = true)]
49 internal string Contact { get; set; }
51 /// <summary>
52 /// Gets or sets a reference token, such as a support ticket number or a URL to a news blog, etc.
53 /// </summary>
54 [MessagePart("reference", IsRequired = false, AllowEmpty = true)]
55 internal string Reference { get; set; }