Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Commit

Permalink
Added no-cache headers to all outgoing response messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Oct 21, 2010
1 parent 4cb6cae commit 2a57d2b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/DotNetOpenAuth/Messaging/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,22 @@ public OutgoingWebResponse PrepareResponse(IProtocolMessage message) {
directedMessage.Recipient != null,
"message",
MessagingStrings.DirectedMessageMissingRecipient);
return this.PrepareIndirectResponse(directedMessage);
result = this.PrepareIndirectResponse(directedMessage);
break;
default:
throw ErrorUtilities.ThrowArgumentNamed(
"message",
MessagingStrings.UnrecognizedEnumValue,
"Transport",
message.Transport);
}

// Apply caching policy to any response. We want to disable all caching because in auth* protocols,
// caching can be utilized in identity spoofing attacks.
result.Headers[HttpResponseHeader.CacheControl] = "no-cache, no-store, max-age=0, must-revalidate";
result.Headers[HttpResponseHeader.Pragma] = "no-cache";

return result;
}

/// <summary>
Expand Down

0 comments on commit 2a57d2b

Please sign in to comment.