Rust service that validates JWT tokens from Auth0.
The service:
- Retrieves the JWKS and filter for potential signature verification keys.
- Extracts the JWT from the request's authorization header.
- Decodes the JWT and grab the kid property from the header.
- Finds the signature verification key in the filtered JWKS with a matching kid property.
- Using the x5c property build a certificate which will be used to verify the JWT signature.
- Ensures the JWT contains the expected audience, issuer, expiration, etc.
- Returns the verification result and pass Audience, Issuer and Sub to the lambda.
Name | Description |
---|---|
JWTAUTH_KEYS_REPO | Repo where the keys to validate the token reside (Example: https://xxx.eu.auth0.com/.well-known/jwks.json) |
JWTAUTH_TOKEN_AUDIENCE | Token audience |
JWTAUTH_TOKEN_ISSUER | Token issuer |
This service extracts the value of the custom claim (ID) to the downstream services.
cargo run
cargo build
cd tests && docker-compose up
cargo test -- --nocapture
cargo test --test '*' -- --nocapture
- Retrieve from the Redis cache the JWKS.