From 4dd8d0a88053977ca4b4cdbc518915036d94f765 Mon Sep 17 00:00:00 2001 From: Zack Fu Zi Xiang Date: Tue, 27 Aug 2024 15:01:12 +0800 Subject: [PATCH] chore: preserve login backward compatibility --- docker/gotrue.Dockerfile | 2 +- docker/gotrue.patch | 35 +++++++++++------------------------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/docker/gotrue.Dockerfile b/docker/gotrue.Dockerfile index 4831b37f..193f5d63 100644 --- a/docker/gotrue.Dockerfile +++ b/docker/gotrue.Dockerfile @@ -1,6 +1,6 @@ FROM golang as base WORKDIR /go/src/supabase -RUN git clone https://github.com/supabase/gotrue.git --depth 1 --branch v2.117.0 +RUN git clone https://github.com/supabase/gotrue.git --depth 1 --branch v2.159.1 WORKDIR /go/src/supabase/gotrue COPY docker/gotrue.patch . RUN git apply gotrue.patch diff --git a/docker/gotrue.patch b/docker/gotrue.patch index 45d30103..651e62b8 100644 --- a/docker/gotrue.patch +++ b/docker/gotrue.patch @@ -1,25 +1,12 @@ -diff --git a/internal/api/api.go b/internal/api/api.go -index d9016fd0..924ce018 100644 ---- a/internal/api/api.go -+++ b/internal/api/api.go -@@ -175,7 +175,7 @@ func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfigurati - }) +diff --git a/internal/api/settings.go b/internal/api/settings.go +index bc2f3869..c0025f48 100644 +--- a/internal/api/settings.go ++++ b/internal/api/settings.go +@@ -36,6 +36,7 @@ type Settings struct { + MailerAutoconfirm bool `json:"mailer_autoconfirm"` + PhoneAutoconfirm bool `json:"phone_autoconfirm"` + SmsProvider string `json:"sms_provider"` ++ MFAEnabled bool `json:"mfa_enabled"` // preserve for backwards compatibility + SAMLEnabled bool `json:"saml_enabled"` + } - r.Route("/sso", func(r *router) { -- r.Use(api.requireSAMLEnabled) -+ // r.Use(api.requireSAMLEnabled) - r.With(api.limitHandler( - // Allow requests at the specified rate per 5 minutes. - tollbooth.NewLimiter(api.config.RateLimitSso/(60*5), &limiter.ExpirableOptions{ -diff --git a/internal/api/saml.go b/internal/api/saml.go -index d936ff2f..011d098c 100644 ---- a/internal/api/saml.go -+++ b/internal/api/saml.go -@@ -24,6 +24,7 @@ func (a *API) getSAMLServiceProvider(identityProvider *saml.EntityDescriptor, id - externalURL.Path += "/" - } - -+ externalURL.Path += "gotrue/" - externalURL.Path += "sso/" - - provider := samlsp.DefaultServiceProvider(samlsp.Options{