summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2/OAuth2
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-02-19 20:21:31 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-02-19 20:21:31 -0800
commit061794ec18d2e3286194f6db849d9b3b0bedb7b3 (patch)
tree650eb0450a9540d77aec72d669761bd8be7bdb66 /src/DotNetOpenAuth.OAuth2/OAuth2
parent4ae2b7675f436906c19c91e3d9605eae247d37f1 (diff)
downloadDotNetOpenAuth-061794ec18d2e3286194f6db849d9b3b0bedb7b3.zip
DotNetOpenAuth-061794ec18d2e3286194f6db849d9b3b0bedb7b3.tar.gz
DotNetOpenAuth-061794ec18d2e3286194f6db849d9b3b0bedb7b3.tar.bz2
Fixed up the various protocol channels to correctly apply HTTP headers prescribed by the messages.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2')
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs9
2 files changed, 3 insertions, 7 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs
index 1026018..295ee86 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs
@@ -56,6 +56,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// </remarks>
protected override OutgoingWebResponse PrepareDirectResponse(IProtocolMessage response) {
var webResponse = new OutgoingWebResponse();
+ this.ApplyMessageTemplate(response, webResponse);
string json = this.SerializeAsJson(response);
webResponse.SetResponse(json, new ContentType(JsonEncoded));
return webResponse;
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
index 7ea6542..1c2a080 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
@@ -106,13 +106,8 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
ErrorUtilities.VerifyInternal(unauthorizedResponse != null, "Only unauthorized responses are expected.");
// First initialize based on the specifics within the message.
- var httpResponse = response as IHttpDirectResponse;
- if (httpResponse != null) {
- webResponse.Status = httpResponse.HttpStatusCode;
- foreach (string headerName in httpResponse.Headers) {
- webResponse.Headers.Add(headerName, httpResponse.Headers[headerName]);
- }
- } else {
+ this.ApplyMessageTemplate(response, webResponse);
+ if (!(response is IHttpDirectResponse)) {
webResponse.Status = HttpStatusCode.Unauthorized;
}