cf-auth-middleware
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,3 @@ { | ||
"description": "Authentication middleware for APIs using cf-auth-provider", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"tags": [], | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -25,4 +25,23 @@ # cf-auth-middleware | ||
`@todo` explain how the client must sign the request, and what headers are required. | ||
An authenticated request contains the following headers: | ||
``` | ||
Content-Type: 'application/json' | ||
x-cf-date: 'Tue, 05 Nov 2013 12:22:23 GMT' | ||
authorization: 'Catfish {authorizing entity id}:{signed request}' | ||
``` | ||
The client must sign the request with the following algorithm: | ||
```js | ||
var crypto = require('crypto') | ||
function createSignature(key, method, contentType, date, path) { | ||
var hmac = crypto.createHmac('sha1', key) | ||
, packet = method + '\n\n' + (contentType || '') + '\n' + date + '\n\n' + path | ||
return hmac.update(packet).digest('base64') | ||
} | ||
``` | ||
## Credits | ||
@@ -29,0 +48,0 @@ Built by developers at [Clock](http://clock.co.uk). |
12952
51