From de7c5dcbc896b7ad21e87b58e34522fa8309f2b4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 9 Sep 2025 03:03:53 +0000 Subject: [PATCH] Make iss and aud args optional to debug create-jwt command. Signed-off-by: Jason Volk --- src/admin/debug/commands.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/admin/debug/commands.rs b/src/admin/debug/commands.rs index 123f38dd..bb6108b7 100644 --- a/src/admin/debug/commands.rs +++ b/src/admin/debug/commands.rs @@ -974,10 +974,10 @@ pub(super) async fn create_jwt( #[derive(Serialize)] struct Claim { sub: String, - iss: String, - aud: String, - exp: usize, - nbf: usize, + iss: Option, + aud: Option, + exp: Option, + nbf: Option, } let config = &self.services.config.jwt; @@ -994,21 +994,19 @@ pub(super) async fn create_jwt( let claim = Claim { sub: user, - iss: issuer.unwrap_or_default(), + iss: issuer, - aud: audience.unwrap_or_default(), + aud: audience, exp: exp_from_now .and_then(|val| now_secs().checked_add(val)) .map(TryInto::try_into) - .and_then(Result::ok) - .unwrap_or(usize::MAX), + .and_then(Result::ok), nbf: nbf_from_now .and_then(|val| now_secs().checked_add(val)) .map(TryInto::try_into) - .and_then(Result::ok) - .unwrap_or(0), + .and_then(Result::ok), }; encode(&header, &claim, &key)