To be RESTful, an API should respect the 5.1.3 article:
5.1.3 Stateless
[…] each request from client to server must contain all of the
information necessary to understand the request, and cannot take
advantage of any stored context on the server. Session state is
therefore kept entirely on the client. […]
We want to use SRP challenge for authentication and we also want to sign each request (method + URL + arguments + headers) from the browser with ECDSA P-256 keys, the server already known the public key of each authorized device.
We have 2 ideas, after the user successfully sign in:
1) Returning an « authorizationToken » (256 bits) to add in request header « Authorization: lakano (authorizationToken) ». On the server side, we save in Redis this authorization token with all user details (userID, ACL, timestamp, deviceECDSAPublicKey). Then for next received requests, we extract the authorization token, look in the Redis DB, verify the request signature, and get all the user details. When a request ask for updating the connected user’s profile, we also need to give in the request’s parameters the userID (even if we already known who is it, to respect the 5.1.3 article).
Do you think this fully respect the 5.1.3 article please?
2) Returning all users details (userID, ACL, timestamp, devicePublicKey…) but encrypted by the server with a strong AES-GCM password. For each request, the browser need to put this encrypted information in « Autorization: lakano base64(encryptedUserDetails) ». So, there is nothing stored in the Redis/DB, this should respect the RESTful 5.1.3 article, but this also need more power/time to decrypt each time the user details.
For each idea, there is also a « X-Signature: (signature) » header with the client signature.
Could you tell me if the 1st idea is really RESTful, and which one is the best choice from a security point of view please?
PS: we know we could also use JWT, but we would like to see if these alternative are RESTful and secure enough.
Continue reading Do we need an Authorization header encrypted to keep an API RESTful?→