diff --git a/examples/jwt/Cargo.toml b/examples/jwt/Cargo.toml index 54378fe3..c36511a2 100644 --- a/examples/jwt/Cargo.toml +++ b/examples/jwt/Cargo.toml @@ -8,7 +8,6 @@ publish = false axum = { path = "../../axum" } axum-extra = { path = "../../axum-extra", features = ["typed-header"] } jsonwebtoken = "9.3" -once_cell = "1.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.0", features = ["full"] } diff --git a/examples/jwt/src/main.rs b/examples/jwt/src/main.rs index 8b7a7cbe..f7877d74 100644 --- a/examples/jwt/src/main.rs +++ b/examples/jwt/src/main.rs @@ -18,10 +18,10 @@ use axum_extra::{ TypedHeader, }; use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation}; -use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use serde_json::json; use std::fmt::Display; +use std::sync::LazyLock; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; // Quick instructions @@ -50,7 +50,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; // -H 'Authorization: Bearer blahblahblah' \ // http://localhost:3000/protected -static KEYS: Lazy = Lazy::new(|| { +static KEYS: LazyLock = LazyLock::new(|| { let secret = std::env::var("JWT_SECRET").expect("JWT_SECRET must be set"); Keys::new(secret.as_bytes()) });