#validation #jwt #tags #name

cf-access

Super simple library for validating Cloudflare Access JWTs

1 unstable release

new 0.1.0 Mar 30, 2025

#218 in #jwt

MIT license

17KB
94 lines

cf-access

Simple Cloudflare Access JWT validator.

Usage

You will need:

  • Your team name
  • Your application's AUD tag
# #[tokio::main]
# async fn main() {
use cf_access::Validator;

let validator = Validator::new("team_name", "aud_tag");

# let mut headers = std::collections::HashMap::new();
# headers.insert("cf-access-jwt-assertion", "...");
if let Some(jwt) = headers.get("cf-access-jwt-assertion") {
    if let Ok(claims) = validator.validate(jwt).await {
        println!("{claims:?}");
    }
}
# }

License

MIT

Dependencies

~6–18MB
~257K SLoC