diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-22 08:00:42 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-22 08:00:42 -0700 |
commit | 94d1c68291865dc4557c599ce19cbec3c10541ff (patch) | |
tree | f4037266b384f92435b8132a80ea917befa92c32 /src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs | |
parent | 1b6d8c2a40a019b43b252102353170380872da45 (diff) | |
download | DotNetOpenAuth-94d1c68291865dc4557c599ce19cbec3c10541ff.zip DotNetOpenAuth-94d1c68291865dc4557c599ce19cbec3c10541ff.tar.gz DotNetOpenAuth-94d1c68291865dc4557c599ce19cbec3c10541ff.tar.bz2 |
Fixes access denial errors from OAuth 2 resource servers so they include the required parameters in their WWW-Authenticate headers.
Fixes #124
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs')
-rw-r--r-- | src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs index 67eccce..9ef89e9 100644 --- a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs +++ b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.Messaging { using System.IO; using System.Net; using System.Net.Mime; + using System.ServiceModel.Web; using System.Text; using System.Threading; using System.Web; @@ -213,6 +214,23 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> + /// Submits this response to a WCF response context. Only available when no response body is included. + /// </summary> + /// <param name="responseContext">The response context to apply the response to.</param> + public virtual void Respond(OutgoingWebResponseContext responseContext) { + Requires.NotNull(responseContext, "responseContext"); + if (this.ResponseStream != null) { + throw new NotSupportedException(Strings.ResponseBodyNotSupported); + } + + responseContext.StatusCode = this.Status; + responseContext.SuppressEntityBody = true; + foreach (string header in this.Headers) { + responseContext.Headers[header] = this.Headers[header]; + } + } + + /// <summary> /// Automatically sends the appropriate response to the user agent. /// </summary> /// <param name="response">The response to set to this message.</param> |