1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00
Commit graph

29 commits

Author SHA1 Message Date
Zhaofeng Li
dcadbec66b token: Don't require valid UTF-8 for HS256 secrets 2024-10-06 11:19:03 -06:00
Zhaofeng Li
0d2b20025e token: Bring back HS256 test
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.
2024-10-05 11:50:48 -06:00
Cole Helbling
119598d064 fixup: regenerate test token 2024-07-26 07:45:05 -07:00
Cole Helbling
858e5bec13 Merge remote-tracking branch 'upstream/main' into rs256-support 2024-07-26 07:25:11 -07:00
Zhaofeng Li
14cb5f9e46 Trivial semver-incompatible upgrades 2024-06-01 13:47:27 -06:00
Cole Helbling
18dedcc30b token: switch to using IndexMap for consistent ordering of entries
Because of the random ordering of HashMap, if you have
overlapping token permissions, it is possible to randomly pick
one that leads to some operation working intermittently (see
https://github.com/zhaofengli/attic/issues/133 for an example of this).

By using an IndexMap instead, we make "iteration order of the key-value
pairs [...] independent of the hash values of the keys" (from the
indexmap crate docs [1]), which leads to more predictable behavior.

[1]: https://docs.rs/indexmap/latest/indexmap/
2024-05-25 11:26:40 -07:00
Cole Helbling
f18f581188 token: test that permissions iteration order is consistent 2024-05-25 11:26:40 -07:00
Cole Helbling
c943b5230f fixup: missing field 2024-02-26 11:48:26 -08:00
Cole Helbling
756fef8d5f Support pubkey-only JWT configuration 2024-02-26 11:44:04 -08:00
Cole Helbling
0a9d4938ef Move back to jwt_simple
This effectively reverts commit 3e0b65a4c3.

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.
2023-11-12 12:19:22 -08:00
Cole Helbling
bd30211ac5 attic-token: use Not trait instead of is_false function for skipping serializing false permissions 2023-11-12 11:19:34 -08:00
Cole Helbling
427ae4550b server: support HS256, RS256 JWT secrets 2023-11-12 11:19:34 -08:00
Cole Helbling
9e23916e02 token: fixup JWT creation
Since we now validate the `sub` and `nbf` claims, they need to be set
when atticadm generates them.
2023-11-12 11:19:34 -08:00
Cole Helbling
17b2ed7538 cargo fmt 2023-11-12 11:19:34 -08:00
Cole Helbling
20e0a2b3a7 server: support configuring the iss, aud claim validation
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
2023-11-12 11:19:34 -08:00
Cole Helbling
7ed3f92d40 token: aud claim is a list-or-string 2023-11-12 11:19:34 -08:00
Cole Helbling
d0dfdde35a server: rename RS256 secret stuff to note that it's base64 encoded
So it's Base64<PEM bytes>, not just PEM bytes.
2023-11-11 12:59:03 -08:00
Graham Christensen
d49cd3383b Make the nix flake check tests pass 2023-11-11 12:58:59 -08:00
Graham Christensen
9511afde4b server: HS256 -> RS256 secrets 2023-11-11 12:58:57 -08:00
Graham Christensen
3e0b65a4c3 Migrate to jsonwebtoken 2023-11-11 12:58:55 -08:00
Zhaofeng Li
2d0aeefd2f Trivial semver-incompatible upgrades 2023-05-28 15:23:45 -06:00
Zhaofeng Li
6489d775ae Update deps 2023-05-28 15:23:45 -06:00
Zhaofeng Li
ba8bd5d66c Thanks clippy 2023-03-21 18:45:34 -06:00
Zhaofeng Li
2e68228fee token: Enforce the same lint configs 2023-03-21 18:45:34 -06:00
Zhaofeng Li
97285de54f Upgrade base64 2023-03-05 11:05:11 -07:00
Zhaofeng Li
18ca2cf29a Update deps 2023-03-05 11:05:11 -07:00
Zhaofeng Li
6c4d04da74 Migrate to jwt-simple 2023-01-08 00:57:22 -07:00
Zhaofeng Li
1c2173caac token: Update comments to reflect actual implementation 2023-01-08 00:57:22 -07:00
Zhaofeng Li
77070b9895 Refactor token into a separate crate 2023-01-08 00:57:22 -07:00