VanGoH - Vanilla Go HMAC - An AWS-style HMAC authentication middleware for Go web servers
VanGoH - Vanilla Go HMAC - An AWS-style HMAC authentication middleware for Go web servers
Vangoh implements the HMAC authentication scheme popularized by Amazon's AWS.
In order to compute and check the HMAC signature, it checks the details included in a request's Authorization header. It expects them to be in the form
Authorization: [ORG] [KEY]:[HMAC_SIGNATURE]Where:
[ORG] is the organization tag, e.g., AWS.[KEY] is the unique, public identifier of the user or service, such as a username or API key, e.g., EKsZs7eRe9z3q79KsZmoK1plHAB0UC.[HMACSignature] is the base64-encoded HMAC signature of various details of the request, e.g., 44IVL7XT3zqe2+/6tUbe39Da4Hq2MK==.Much like the AWS HMAC implementation, Vangoh allows for specifying additional headers to be used when calculating the hash, and incorporates the Date header to assist in identifying duplicate requests. Read the AWS documentation and the code to see the details of constructing the signature.
There is also support of separate authentication sources for multiple organizational tags, permitting varying authentication for standard users vs. privileged API access. An internal service making several requests may authenticate through an in-memory map, for instance, while a standard user request may authenticate through a less performant but more scalable database lookup of their private key.
Vangoh was designed to conform to the net/http package, and includes two "middleware"-esque functions (vangoh.Handler, vangoh.NegroniHandler) for easy integration with your existing code.
Full documentation is hosted at Godoc.
…And with that we have replicated the core authentication procedure used by AWS!
No open issues yet, or sync has not completed.