Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RS256 JWTs #177

Merged
merged 26 commits into from
Oct 5, 2024
Merged

Support RS256 JWTs #177

merged 26 commits into from
Oct 5, 2024

Conversation

zhaofengli
Copy link
Owner

@zhaofengli zhaofengli commented Oct 5, 2024

Continuation of #99.

Diff apart from merging main: 5d6560e...d2363b5


I'll be adding support for pluggable authentication layers (namely for Biscuit) and a client-server contract to bootstrap authentication (e.g., OIDC with refresh tokens), to be rebased.


Migrating existing HS256 setups

Existing configs with token-hs256-secret-base64 will result in an error describing the migration path. As a reference, for an existing config like the following:

token-hs256-secret-base64 = "your secret"

Move it to the bottom of the config, then add [jwt.signing] like so:

[jwt.signing]
token-hs256-secret-base64 = "your secret"

cole-h and others added 26 commits November 11, 2023 12:58
There are some 2021-edition crates that Cargo was warning about.
So it's Base64<PEM bytes>, not just PEM bytes.
The JWT spec [1] basically says that JWTs must validate the `aud` claim
if its specified:

> If the principal
> processing the claim does not identify itself with a value in the
> "aud" claim when this claim is present, then the JWT MUST be
> rejected.

[1]: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3
Since we now validate the `sub` and `nbf` claims, they need to be set
when atticadm generates them.
This effectively reverts commit 3e0b65a.

Because jwt_simple doesn't have a unified type / trait that allows
signature and verification, I had to add a SignatureType enum to
approximate that.
This does make it decode the keys every iteration in the stability
test, which isn't too much of an issue and can be fixed later.
@zhaofengli zhaofengli mentioned this pull request Oct 5, 2024
@zhaofengli zhaofengli merged commit 858120c into main Oct 5, 2024
26 checks passed
@zhaofengli zhaofengli deleted the rs256-support branch October 5, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants