The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix SAML_ENABLED not getting sent as boolean
Joshen Lim02b4ab215fa9
diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/AuthProvidersForm.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/AuthProvidersForm.tsxindex f9ab8236697..c6a81838aad 100644--- a/studio/components/interfaces/Auth/AuthProvidersForm/AuthProvidersForm.tsx+++ b/studio/components/interfaces/Auth/AuthProvidersForm/AuthProvidersForm.tsx@@ -9,9 +9,10 @@ import { ProviderCollapsibleClasses } from './AuthProvidersForm.constants'const AuthProvidersForm = () => {const { authConfig } = useStore()const isSamlEnabled = useFlag('isSamlEnabled')- const providers = isSamlEnabled- ? PROVIDERS_SCHEMAS- : PROVIDERS_SCHEMAS.filter((provider) => provider !== PROVIDER_SAML)+ const providers = PROVIDERS_SCHEMAS+ // const providers = isSamlEnabled+ // ? PROVIDERS_SCHEMAS+ // : PROVIDERS_SCHEMAS.filter((provider) => provider !== PROVIDER_SAML)return (<div>diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsxindex f2909a7f4de..3a703ca2939 100644--- a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx+++ b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx@@ -26,12 +26,23 @@ const ProviderForm: FC<Props> = ({ provider }) => {Object.keys(provider.properties).forEach((key) => {// When the key is a 'double negative' key, we must reverse the boolean before adding it to the formconst isDoubleNegative = doubleNegativeKeys.includes(key)- initialValues[key] = isDoubleNegative ? !authConfig.config[key] : authConfig.config[key] ?? ''++ if (provider.title === 'SAML 2.0') {+ initialValues[key] = authConfig.config[key] ?? false+ } else {+ initialValues[key] = isDoubleNegative+ ? !authConfig.config[key]+ : authConfig.config[key] ?? ''+ }})return initialValues}- const isActive = authConfig.config[`EXTERNAL_${provider?.title?.toUpperCase()}_ENABLED`]+ // [Joshen] Doing this check as SAML doesn't follow the same naming structure as the other provider options+ const isActive =+ provider.title === 'SAML 2.0'+ ? authConfig.config['SAML_ENABLED'] || false+ : authConfig.config[`EXTERNAL_${provider?.title?.toUpperCase()}_ENABLED`]const INITIAL_VALUES = generateInitialValues()const onSubmit = async (values: any, { setSubmitting, resetForm }: any) => {diff --git a/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx b/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsxindex 1b142e8635f..781f44b6690 100644--- a/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx+++ b/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx@@ -1004,11 +1004,14 @@ export const PROVIDER_SAML = {title: 'SAML 2.0',properties: {SAML_ENABLED: {- type: 'boolean',title: 'Enabled',- help: 'Allows the use of SAML 2.0 Single Sign-On',+ description: 'Allows the use of SAML 2.0 Single Sign-On',+ type: 'boolean',},},+ validationSchema: object().shape({+ SAML_ENABLED: boolean().required(),+ }),misc: {iconKey: 'saml-icon',},