-
Notifications
You must be signed in to change notification settings - Fork 20
Description
From the Hawk spec:
However, if the payload is not available at authentication time (e.g. too large to fit in memory, streamed elsewhere, or processed at a different stage in the application), the server may choose to defer payload validation for later by retaining the hash value provided by the client after validating the MAC.
This is currently not an option with Mohawk, as if a content hash is provided by the client, Receiver will attempt to validate it during instantiation. I propose a new keyword argument to Receiver(), defer_content_hash, which will only validate the MAC, timestamp, and nonce of the request, but not generate the content hash.
This would also require an additional method of Resource, perhaps .check_hash(content, content_type) which would then generate the hash and compare it to the value from Resource.parsed_header. This new method would also be called from inside Resource._authorize() (see here).