From 4149323ee3acc6506afd7316a49c18ca250365e8 Mon Sep 17 00:00:00 2001 From: Etienne Stalmans Date: Sun, 19 Jan 2025 17:54:42 +0100 Subject: [PATCH] feat: keep backwards compatibility through default claims --- internal/conf/configuration.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/conf/configuration.go b/internal/conf/configuration.go index 6eaf82aa8..f6a416e89 100644 --- a/internal/conf/configuration.go +++ b/internal/conf/configuration.go @@ -887,6 +887,13 @@ func (config *GlobalConfiguration) ApplyDefaults() error { config.JWT.AdminRoles = []string{"service_role", "supabase_admin"} } + // default to all claims that were / are available at the time of this change + // to ensure backwards compatibility. To exclude all these claims, the value + // of jwt.additional_claims can be set to an invalid claim, such as "none", "empty", "null" + if len(config.JWT.AdditionalClaims) == 0 { + config.JWT.AdditionalClaims = []string{"email", "phone", "app_metadata", "user_metadata", "amr", "is_anonymous"} + } + if config.JWT.Exp == 0 { config.JWT.Exp = 3600 }