chore: preserve login backward compatibility

This commit is contained in:
Zack Fu Zi Xiang 2024-08-27 15:01:12 +08:00
parent 63b23f0927
commit 4dd8d0a880
No known key found for this signature in database
2 changed files with 12 additions and 25 deletions

View File

@ -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

View File

@ -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{