Skip to content

Commit

Permalink
Fixes #1126
Browse files Browse the repository at this point in the history
  • Loading branch information
m.scharrig committed Jun 8, 2018
1 parent c3e0e2f commit 1e06bc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions RestSharp.Tests/OAuthTests.cs
Expand Up @@ -46,13 +46,13 @@ public void PercentEncode_Encodes_Correctly(string value, string expected)
}

[Test]
[TestCase("The quick brown fox jumps over the lazy dog", "rVL90tHhGt0eQ0TCITY74nVL22P%2FltlWS7WvJXpECPs%3D")]
[TestCase("The quick\tbrown\nfox\rjumps\r\nover\t\tthe\n\nlazy\r\n\r\ndog", "C%2B2RY0Hna6VrfK1crCkU%2FV1e0ECoxoDh41iOOdmEMx8%3D")]
[TestCase("", "%2BnkCwZfv%2FQVmBbNZsPKbBT3kAg3JtVn3f3YMBtV83L8%3D")]
[TestCase(" !\"#$%&'()*+,", "xcTgWGBVZaw%2Bilg6kjWAGt%2FhCcsVBMMe1CcDEnxnh8Y%3D")]
public void HmacSha256_Hashes_Correctly(string value, string expected)
[TestCase("The quick brown fox jumps over the lazy dog", "rVL90tHhGt0eQ0TCITY74nVL22P%2FltlWS7WvJXpECPs%3D", "12345678")]
[TestCase("The quick\tbrown\nfox\rjumps\r\nover\t\tthe\n\nlazy\r\n\r\ndog", "C%2B2RY0Hna6VrfK1crCkU%2FV1e0ECoxoDh41iOOdmEMx8%3D", "12345678")]
[TestCase("", "%2BnkCwZfv%2FQVmBbNZsPKbBT3kAg3JtVn3f3YMBtV83L8%3D", "12345678")]
[TestCase(" !\"#$%&'()*+,", "xcTgWGBVZaw%2Bilg6kjWAGt%2FhCcsVBMMe1CcDEnxnh8Y%3D", "12345678")]
[TestCase("AB", "JJgraAxzpO2Q6wiC3blM4eiQeA9WmkALaZI8yGRH4qM%3D", "CD!")]
public void HmacSha256_Hashes_Correctly(string value, string expected, string consumerSecret)
{
string consumerSecret = "12345678";
string actual = OAuthTools.GetSignature(OAuthSignatureMethod.HmacSha256, value, consumerSecret);

Assert.AreEqual(expected, actual);
Expand Down
4 changes: 2 additions & 2 deletions RestSharp/Authenticators/OAuth/OAuthTools.cs
Expand Up @@ -313,8 +313,8 @@ public static string ConcatenateRequestElements(string method, string url, WebPa
tokenSecret = string.Empty;

var unencodedConsumerSecret = consumerSecret;
consumerSecret = UrlEncodeRelaxed(consumerSecret);
tokenSecret = UrlEncodeRelaxed(tokenSecret);
consumerSecret = Uri.EscapeDataString(consumerSecret);
tokenSecret = Uri.EscapeDataString(tokenSecret);

string signature;

Expand Down

0 comments on commit 1e06bc7

Please sign in to comment.