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

Commit

Permalink
Fixes escaping issues with OAuth 1.0 request tokens and cookies.
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Jun 10, 2013
1 parent c4f656a commit c645128
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public void SaveTemporaryCredential(string identifier, string secret) {
}

var encryptedToken = ProtectAndEncodeToken(identifier, secret);
cookie.Values[identifier] = encryptedToken;
var escapedIdentifier = Uri.EscapeDataString(identifier);
cookie.Values[escapedIdentifier] = encryptedToken;

this.httpContext.Response.Cookies.Set(cookie);
}
Expand All @@ -81,8 +82,9 @@ public KeyValuePair<string, string> RetrieveTemporaryCredential() {
return new KeyValuePair<string, string>();
}

string identifier = cookie.Values.GetKey(0);
string secret = DecodeAndUnprotectToken(identifier, cookie.Values[identifier]);
string escapedIdentifier = cookie.Values.GetKey(0);
string identifier = Uri.UnescapeDataString(escapedIdentifier);
string secret = DecodeAndUnprotectToken(identifier, cookie.Values[escapedIdentifier]);
return new KeyValuePair<string, string>(identifier, secret);
}

Expand Down

0 comments on commit c645128

Please sign in to comment.