Fix ToHeaderDictionary in HttpSignature

This commit is contained in:
Laura Hausmann 2024-01-23 02:04:10 +01:00
parent 6a80e503d9
commit c207d77d51
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -11,7 +11,7 @@ public static class HttpSignature {
IEnumerable<string> requiredHeaders, string key) {
if (!requiredHeaders.All(signature.Headers.Contains))
throw new ConstraintException("Request is missing required headers");
//TODO: verify date header exists and is set to something the last 12 hours
var signingString = GenerateSigningString(signature.Headers, request.Method,
@ -86,7 +86,8 @@ public static class HttpSignature {
}
private static HeaderDictionary ToHeaderDictionary(this HttpRequestHeaders headers) {
return new HeaderDictionary(headers.ToDictionary(p => p.Key, p => new StringValues(p.Value.ToArray())));
return new HeaderDictionary(headers.ToDictionary(p => p.Key.ToLowerInvariant(),
p => new StringValues(p.Value.ToArray())));
}
public static HttpSignatureHeader Parse(string header) {