From 92c85db30661720e09643895680b2a579de09791 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Mon, 25 Nov 2024 14:54:08 +0100 Subject: [PATCH] fix: added error if no tokens are valid when starting in strict mode (#587) --- server/src/builder.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/builder.rs b/server/src/builder.rs index dfe0dae3..b5b0f773 100644 --- a/server/src/builder.rs +++ b/server/src/builder.rs @@ -285,6 +285,10 @@ async fn build_edge(args: &EdgeArgs, app_name: &str) -> EdgeResult { .await; } + if args.strict && token_cache.is_empty() { + error!("You started Edge in strict mode, but Edge was not able to validate any of the tokens configured at startup"); + return Err(EdgeError::NoTokens("No valid tokens was provided on startup. At least one valid token must be specified at startup when running in Strict mode".into())); + } for validated_token in token_cache .iter() .filter(|candidate| candidate.value().token_type == Some(TokenType::Client))