public void WhenCredentialsHasTwoSeparetorsThenRecognize() { var request = new HttpRequestMessage(HttpMethod.Get, "http://www.acme.com/something"); request.Headers.Authorization = new AuthenticationHeaderValue("ABS-H", "APP-KEY:Signature:pepe"); var hmacBuilder = new ABServiciosHmacBuilder(); KeyValuePair <string, string> appSignature = hmacBuilder.GetCredentials(request.Headers.Authorization); appSignature.Key.Should().Be("APP-KEY"); appSignature.Value.Should().Be("Signature:pepe"); }
public void WhenCredentialHasOnePartsThenNotRecognize() { var request = new HttpRequestMessage(HttpMethod.Get, "http://www.acme.com/something"); request.Headers.Authorization = new AuthenticationHeaderValue("ABS-H", "pizza"); var hmacBuilder = new ABServiciosHmacBuilder(); KeyValuePair <string, string> appSignature = hmacBuilder.GetCredentials(request.Headers.Authorization); appSignature.Key.Should().Be.NullOrEmpty(); appSignature.Value.Should().Be.NullOrEmpty(); }