-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels

Description
We need to refactor the auth API so as to:
- Provide a simple, synchronous API
- Avoid using closures/callbacks for simple computations
- Avoid depending on any HTTP framework (remove any reference to http.request, keep only required bits of data)
- Provide an 'AwsServiceName' to the signing requests, as this may be included depending on the service.
The planned API is as follows:
auth: {
client: {
generateV4Headers: function (query, method, uri, payload, secretKey) -> { headersDict, errorObject },
},
server: {
prepareV2: function (QueryString, Headers) -> { authParamsObject, errorObject },
prepareV4: function (QueryString, Headers) -> { authParamsObject, errorObject },
checkV2Signature: function(authParamsObject, secretKeyValue) -> bool,
checkV4Signature: function(authParamsObject, secretKeyValue) -> bool,
},
}
This is the general feeling. The Client would use the client API, and the server could use the server API in two steps:
- prepare auth params for actual auth
- retrieve auth information from whatever storage is used
- compute and check signature using results from step 1+2
Admitedly, the current API is missing a potential options object, or at least an AWSServiceName to use.