2 ms·
> But the server and the client should support only a single algorithm, probably HMAC with SHA-256, and reject all of the others. If you have a centralized sys
by deathanatos 10y ago
> But the server and the client should support only a single algorithm, probably HMAC with SHA-256, and reject all of the others.
If you have a centralized system dealing w/ authentication, this doesn't work, as now everything that needs to verify JWTs needs the secret. The support for RSA, instead of HMAC, is there to meet a different set of requirement.
What people fail to remember is that JWTs — and the libraries that work w/ them — do not just wrap data to be authenticated. They also handle verifying the various claims on a token — is this token applicable here? is this token expired? — things relevant to an authentication token, not just a mere signed blob of data. The suggestion to leave those to be reimplemented by every single end-user is bad advice.
- kevinburke 10y agoMaybe not a great time to mention I also found errors in the claims verification in the one library I tested, and ended up ripping that code out as well