Crates.io | iap-jwt |
lib.rs | iap-jwt |
version | 0.1.0 |
source | src |
created_at | 2024-08-09 13:01:43.819867 |
updated_at | 2024-08-09 13:01:43.819867 |
description | Validate and decode Google Cloud Identity-Aware Proxy (IAP) JWTs |
homepage | |
repository | https://github.com/ryo33/iap-jwt |
max_upload_size | |
id | 1330844 |
size | 30,328 |
Validate and decode Google Cloud Identity-Aware Proxy (IAP) JWTs
exp
, iat
, aud
, iss
hd
(hosted domain) and access levelscargo add iap-jwt
use iap_jwt::{ValidationConfig};
let token = "..."; // JWT token from IAP
// reqwest Client implements iap_jwt::PublicKeySource with `reqwest` feature enabled (enabled by default)
let client = reqwest::Client::new();
let config = ValidationConfig::new(["/projects/1234567890/global/backendServices/test-service-id"])
.with_google_hosted_domain(["example.com"])
.with_access_levels(["ADMIN"]);
let claims = config.decode_and_validate(token, &client).await?;
println!("Authenticated user: {}", claims.sub);
This project is licensed under either of the following licenses, at your option: