The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add advanced teams / enterprise auth settings (#23418)
Stojan Dimitrovski855a117f5c97
diff --git a/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsxindex 81079e9f98a..abea3607806 100644--- a/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsx@@ -22,8 +22,11 @@ import {FormSectionLabel,} from 'components/ui/Forms'import { useAuthConfigQuery } from 'data/auth/auth-config-query'+import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'-import { useCheckPermissions } from 'hooks'+import { useCheckPermissions, useSelectedOrganization } from 'hooks'+import { IS_PLATFORM } from 'lib/constants'+import UpgradeToPro from 'components/ui/UpgradeToPro'const schema = object({JWT_EXP: number()@@ -35,7 +38,13 @@ const schema = object({.required('Must have a Reuse Interval value'),MFA_MAX_ENROLLED_FACTORS: number().min(0, 'Must be be a value more than 0')- .max(30, 'Must be a value less than 30'),+ .max(30, 'Must be a value no greater than 30'),+ DB_MAX_POOL_SIZE: number()+ .min(1, 'Must be 1 or larger')+ .max(200, 'Must be a value no greater than 200'),+ API_MAX_REQUEST_DURATION: number()+ .min(5, 'Must be 5 or larger')+ .max(30, 'Must be a value no greater than 30'),})const AdvancedAuthSettingsForm = () => {@@ -52,17 +61,33 @@ const AdvancedAuthSettingsForm = () => {const formId = 'auth-config-advanced-form'const canUpdateConfig = useCheckPermissions(PermissionAction.UPDATE, 'custom_config_gotrue')+ const organization = useSelectedOrganization()+ const { data: subscription, isSuccess: isSuccessSubscription } = useOrgSubscriptionQuery({+ orgSlug: organization?.slug,+ })++ const isTeamsEnterprisePlan =+ isSuccessSubscription && subscription.plan.id !== 'free' && subscription.plan.id !== 'pro'+ const promptTeamsEnterpriseUpgrade = IS_PLATFORM && !isTeamsEnterprisePlan+const INITIAL_VALUES = {SITE_URL: authConfig?.SITE_URL,JWT_EXP: authConfig?.JWT_EXP,REFRESH_TOKEN_ROTATION_ENABLED: authConfig?.REFRESH_TOKEN_ROTATION_ENABLED || false,SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: authConfig?.SECURITY_REFRESH_TOKEN_REUSE_INTERVAL,MFA_MAX_ENROLLED_FACTORS: authConfig?.MFA_MAX_ENROLLED_FACTORS || 10,+ DB_MAX_POOL_SIZE: authConfig?.DB_MAX_POOL_SIZE || 10,+ API_MAX_REQUEST_DURATION: authConfig?.API_MAX_REQUEST_DURATION || 10,}const onSubmit = (values: any, { resetForm }: any) => {const payload = { ...values }+ if (!isTeamsEnterprisePlan) {+ delete payload.DB_MAX_POOL_SIZE+ delete payload.API_MAX_REQUEST_DURATION+ }+updateAuthConfig({ projectRef: projectRef!, config: payload },{@@ -167,10 +192,59 @@ const AdvancedAuthSettingsForm = () => {size="small"label="Maximum number of per-user MFA factors"descriptionText="How many MFA factors can be enrolled at once per user."+ actions={<span className="mr-3 text-foreground-lighter">factors</span>}disabled={!canUpdateConfig}/></FormSectionContent></FormSection>++ <FormSection+ header={<FormSectionLabel>Max Direct Database Connections</FormSectionLabel>}+ >+ <FormSectionContent loading={isLoading}>+ {promptTeamsEnterpriseUpgrade && (+ <UpgradeToPro+ primaryText="Upgrade to Teams or Enterprise"+ secondaryText="Max Direct Database Connections settings are only available on the Teams plan and up."+ buttonText="Upgrade to Teams"+ projectRef={projectRef!}+ organizationSlug={organization!.slug}+ />+ )}++ <InputNumber+ id="DB_MAX_POOL_SIZE"+ size="small"+ label="Max direct database connections used by Auth"+ descriptionText="Auth will take up no more than this number of connections from the total number of available connections to serve requests. These connections are not reserved, so when unused they are released."+ actions={<span className="mr-3 text-foreground-lighter">connections</span>}+ disabled={!canUpdateConfig || !isTeamsEnterprisePlan}+ />+ </FormSectionContent>+ </FormSection>++ <FormSection header={<FormSectionLabel>Max Request Duration</FormSectionLabel>}>+ <FormSectionContent loading={isLoading}>+ {promptTeamsEnterpriseUpgrade && (+ <UpgradeToPro+ primaryText="Upgrade to Teams or Enterprise"+ secondaryText="Max Request Duration settings are only available on the Teams plan and up."+ buttonText="Upgrade to Teams"+ projectRef={projectRef!}+ organizationSlug={organization!.slug}+ />+ )}++ <InputNumber+ id="API_MAX_REQUEST_DURATION"+ size="small"+ label="Maximum time allowed for an Auth request to last"+ descriptionText="Number of seconds to wait for an Auth request to complete before canceling it. In certain high-load situations setting a larger or smaller value can be used to control load-shedding. Recommended: 10 seconds."+ actions={<span className="mr-3 text-foreground-lighter">seconds</span>}+ disabled={!canUpdateConfig || !isTeamsEnterprisePlan}+ />+ </FormSectionContent>+ </FormSection></FormPanel></>)diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.tsindex b338381e479..4181f308eb8 100644--- a/packages/api-types/types/api.d.ts+++ b/packages/api-types/types/api.d.ts@@ -2127,14 +2127,19 @@ export interface components {SMS_TEST_OTP_VALID_UNTIL: stringHOOK_MFA_VERIFICATION_ATTEMPT_ENABLED: booleanHOOK_MFA_VERIFICATION_ATTEMPT_URI: string+ HOOK_MFA_VERIFICATION_ATTEMPT_SECRETS: stringHOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED: booleanHOOK_PASSWORD_VERIFICATION_ATTEMPT_URI: string+ HOOK_PASSWORD_VERIFICATION_ATTEMPT_SECRETS: stringHOOK_CUSTOM_ACCESS_TOKEN_ENABLED: booleanHOOK_CUSTOM_ACCESS_TOKEN_URI: string+ HOOK_CUSTOM_ACCESS_TOKEN_SECRETS: stringHOOK_SEND_SMS_ENABLED: booleanHOOK_SEND_SMS_URI: string+ HOOK_SEND_SMS_SECRETS: stringHOOK_SEND_EMAIL_ENABLED: booleanHOOK_SEND_EMAIL_URI: string+ HOOK_SEND_EMAIL_SECRETS: stringEXTERNAL_APPLE_ENABLED: booleanEXTERNAL_APPLE_CLIENT_ID: stringEXTERNAL_APPLE_SECRET: string@@ -2199,6 +2204,8 @@ export interface components {EXTERNAL_ZOOM_ENABLED: booleanEXTERNAL_ZOOM_CLIENT_ID: stringEXTERNAL_ZOOM_SECRET: string+ DB_MAX_POOL_SIZE: number | null+ API_MAX_REQUEST_DURATION: number | null}UpdateGoTrueConfigBody: {SITE_URL?: string@@ -2282,14 +2289,19 @@ export interface components {SMS_TEMPLATE?: stringHOOK_MFA_VERIFICATION_ATTEMPT_ENABLED?: booleanHOOK_MFA_VERIFICATION_ATTEMPT_URI?: string+ HOOK_MFA_VERIFICATION_ATTEMPT_SECRETS?: stringHOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED?: booleanHOOK_PASSWORD_VERIFICATION_ATTEMPT_URI?: string+ HOOK_PASSWORD_VERIFICATION_ATTEMPT_SECRETS?: stringHOOK_CUSTOM_ACCESS_TOKEN_ENABLED?: booleanHOOK_CUSTOM_ACCESS_TOKEN_URI?: string+ HOOK_CUSTOM_ACCESS_TOKEN_SECRETS?: stringHOOK_SEND_SMS_ENABLED?: booleanHOOK_SEND_SMS_URI?: string+ HOOK_SEND_SMS_SECRETS?: stringHOOK_SEND_EMAIL_ENABLED?: booleanHOOK_SEND_EMAIL_URI?: string+ HOOK_SEND_EMAIL_SECRETS?: stringEXTERNAL_APPLE_ENABLED?: booleanEXTERNAL_APPLE_CLIENT_ID?: stringEXTERNAL_APPLE_SECRET?: string@@ -2354,6 +2366,8 @@ export interface components {EXTERNAL_ZOOM_ENABLED?: booleanEXTERNAL_ZOOM_CLIENT_ID?: stringEXTERNAL_ZOOM_SECRET?: string+ DB_MAX_POOL_SIZE?: number+ API_MAX_REQUEST_DURATION?: number}UserBody: {id?: string@@ -2679,8 +2693,8 @@ export interface components {InviteResponse: {organization_name: stringinvite_id: string- sso_mismatch: booleantoken_does_not_exist: boolean+ sso_mismatch: booleanemail_match: booleanauthorized_user: booleanexpired_token: boolean@@ -5138,6 +5152,8 @@ export interface components {connection_string?: string}AuthConfigResponse: {+ api_max_request_duration: number | null+ db_max_pool_size: number | nulldisable_signup: boolean | nullexternal_anonymous_users_enabled: boolean | nullexternal_apple_additional_client_ids: string | null@@ -5208,10 +5224,19 @@ export interface components {external_zoom_secret: string | nullhook_custom_access_token_enabled: boolean | nullhook_custom_access_token_uri: string | null+ hook_custom_access_token_secrets: string | nullhook_mfa_verification_attempt_enabled: boolean | nullhook_mfa_verification_attempt_uri: string | null+ hook_mfa_verification_attempt_secrets: string | nullhook_password_verification_attempt_enabled: boolean | nullhook_password_verification_attempt_uri: string | null+ hook_password_verification_attempt_secrets: string | null+ hook_send_sms_enabled: boolean | null+ hook_send_sms_uri: string | null+ hook_send_sms_secrets: string | null+ hook_send_email_enabled: boolean | null+ hook_send_email_uri: string | null+ hook_send_email_secrets: string | nulljwt_exp: number | nullmailer_allow_unverified_email_sign_ins: boolean | nullmailer_autoconfirm: boolean | null@@ -5222,14 +5247,14 @@ export interface components {mailer_subjects_email_change: string | nullmailer_subjects_invite: string | nullmailer_subjects_magic_link: string | null- mailer_subjects_recovery: string | nullmailer_subjects_reauthentication: string | null+ mailer_subjects_recovery: string | nullmailer_templates_confirmation_content: string | nullmailer_templates_email_change_content: string | nullmailer_templates_invite_content: string | nullmailer_templates_magic_link_content: string | null- mailer_templates_recovery_content: string | nullmailer_templates_reauthentication_content: string | null+ mailer_templates_recovery_content: string | nullmfa_max_enrolled_factors: number | nullpassword_hibp_enabled: boolean | nullpassword_min_length: number | null@@ -5365,14 +5390,19 @@ export interface components {sms_template?: stringhook_mfa_verification_attempt_enabled?: booleanhook_mfa_verification_attempt_uri?: string+ hook_mfa_verification_attempt_secrets?: stringhook_password_verification_attempt_enabled?: booleanhook_password_verification_attempt_uri?: string+ hook_password_verification_attempt_secrets?: stringhook_custom_access_token_enabled?: booleanhook_custom_access_token_uri?: string+ hook_custom_access_token_secrets?: stringhook_send_sms_enabled?: booleanhook_send_sms_uri?: string+ hook_send_sms_secrets?: stringhook_send_email_enabled?: booleanhook_send_email_uri?: string+ hook_send_email_secrets?: stringexternal_apple_enabled?: booleanexternal_apple_client_id?: stringexternal_apple_secret?: string@@ -5437,6 +5467,8 @@ export interface components {external_zoom_enabled?: booleanexternal_zoom_client_id?: stringexternal_zoom_secret?: string+ db_max_pool_size?: number+ api_max_request_duration?: number}CreateThirdPartyAuthBody: {oidc_issuer_url?: string@@ -9623,6 +9655,7 @@ export interface operations {startDate: stringendDate: stringinterval?: '1m' | '5m' | '10m' | '30m' | '1h' | '1d'+ databaseIdentifier?: string}path: {/** @description Project ref */