Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Chore/disable authentication segments (#38029)

Joshen Lim78fab83aee51
diff --git a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx
index 4409bc24e54..7c461c69a3b 100644
--- a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx
+++ b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx
@@ -14,6 +14,7 @@ import NoPermission from 'components/ui/NoPermission'
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import {
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
@@ -42,6 +43,8 @@ const schema = object({
const BasicAuthSettingsForm = () => {
const { ref: projectRef } = useParams()
+ const showManualLinking = useIsFeatureEnabled('authentication:show_manual_linking')
+
const {
data: authConfig,
error: authConfigError,
@@ -169,38 +172,40 @@ const BasicAuthSettingsForm = () => {
)}
/>
</CardContent>
- <CardContent>
- <FormField_Shadcn_
- control={form.control}
- name="SECURITY_MANUAL_LINKING_ENABLED"
- render={({ field }) => (
- <FormItemLayout
- layout="flex-row-reverse"
- label="Allow manual linking"
- description={
- <>
- Enable{' '}
- <InlineLink
- className="text-foreground-light hover:text-foreground"
- href="https://supabase.com/docs/guides/auth/auth-identity-linking#manual-linking-beta"
- >
- manual linking APIs
- </InlineLink>{' '}
- for your project
- </>
- }
- >
- <FormControl_Shadcn_>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- disabled={!canUpdateConfig}
- />
- </FormControl_Shadcn_>
- </FormItemLayout>
- )}
- />
- </CardContent>
+ {showManualLinking && (
+ <CardContent>
+ <FormField_Shadcn_
+ control={form.control}
+ name="SECURITY_MANUAL_LINKING_ENABLED"
+ render={({ field }) => (
+ <FormItemLayout
+ layout="flex-row-reverse"
+ label="Allow manual linking"
+ description={
+ <>
+ Enable{' '}
+ <InlineLink
+ className="text-foreground-light hover:text-foreground"
+ href="https://supabase.com/docs/guides/auth/auth-identity-linking#manual-linking-beta"
+ >
+ manual linking APIs
+ </InlineLink>{' '}
+ for your project
+ </>
+ }
+ >
+ <FormControl_Shadcn_>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ disabled={!canUpdateConfig}
+ />
+ </FormControl_Shadcn_>
+ </FormItemLayout>
+ )}
+ />
+ </CardContent>
+ )}
<CardContent>
<FormField_Shadcn_
control={form.control}
diff --git a/apps/studio/components/layouts/AuthLayout/AuthEmailsLayout.tsx b/apps/studio/components/layouts/AuthLayout/AuthEmailsLayout.tsx
index 82ee2c1ecd4..fe69585fe33 100644
--- a/apps/studio/components/layouts/AuthLayout/AuthEmailsLayout.tsx
+++ b/apps/studio/components/layouts/AuthLayout/AuthEmailsLayout.tsx
@@ -2,10 +2,13 @@ import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import AuthLayout from './AuthLayout'
export const AuthEmailsLayout = ({ children }: PropsWithChildren<{}>) => {
const { ref } = useParams()
+ const showEmails = useIsFeatureEnabled('authentication:emails')
const navItems = [
{
@@ -20,13 +23,17 @@ export const AuthEmailsLayout = ({ children }: PropsWithChildren<{}>) => {
return (
<AuthLayout>
- <PageLayout
- title="Emails"
- subtitle="Configure what emails your users receive and how they are sent"
- navigationItems={navItems}
- >
- {children}
- </PageLayout>
+ {showEmails ? (
+ <PageLayout
+ title="Emails"
+ subtitle="Configure what emails your users receive and how they are sent"
+ navigationItems={navItems}
+ >
+ {children}
+ </PageLayout>
+ ) : (
+ <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
+ )}
</AuthLayout>
)
}
diff --git a/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx b/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
index 002d48acbd8..5d10e1bccdd 100644
--- a/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
+++ b/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
@@ -4,6 +4,7 @@ import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { ProductMenu } from 'components/ui/ProductMenu'
import { useAuthConfigPrefetch } from 'data/auth/auth-config-query'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { withAuth } from 'hooks/misc/withAuth'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
import { generateAuthMenu } from './AuthLayout.utils'
@@ -12,10 +13,41 @@ const AuthProductMenu = () => {
const router = useRouter()
const { ref: projectRef = 'default' } = useParams()
+ const {
+ authenticationPolicies,
+ authenticationSignInProviders,
+ authenticationRateLimits,
+ authenticationEmails,
+ authenticationMultiFactor,
+ authenticationAttackProtection,
+ authenticationAdvanced,
+ } = useIsFeatureEnabled([
+ 'authentication:policies',
+ 'authentication:sign_in_providers',
+ 'authentication:rate_limits',
+ 'authentication:emails',
+ 'authentication:multi_factor',
+ 'authentication:attack_protection',
+ 'authentication:advanced',
+ ])
+
useAuthConfigPrefetch({ projectRef })
const page = router.pathname.split('/')[4]
- return <ProductMenu page={page} menu={generateAuthMenu(projectRef)} />
+ return (
+ <ProductMenu
+ page={page}
+ menu={generateAuthMenu(projectRef, {
+ authenticationPolicies,
+ authenticationSignInProviders,
+ authenticationRateLimits,
+ authenticationEmails,
+ authenticationMultiFactor,
+ authenticationAttackProtection,
+ authenticationAdvanced,
+ })}
+ />
+ )
}
const AuthLayout = ({ children }: PropsWithChildren<{}>) => {
diff --git a/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts b/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
index f3eba231bfb..468bc0b2b2f 100644
--- a/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
+++ b/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
@@ -1,7 +1,28 @@
import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import { IS_PLATFORM } from 'lib/constants'
-export const generateAuthMenu = (ref: string): ProductMenuGroup[] => {
+export const generateAuthMenu = (
+ ref: string,
+ flags?: {
+ authenticationPolicies: boolean
+ authenticationSignInProviders: boolean
+ authenticationRateLimits: boolean
+ authenticationEmails: boolean
+ authenticationMultiFactor: boolean
+ authenticationAttackProtection: boolean
+ authenticationAdvanced: boolean
+ }
+): ProductMenuGroup[] => {
+ const {
+ authenticationPolicies,
+ authenticationSignInProviders,
+ authenticationRateLimits,
+ authenticationEmails,
+ authenticationMultiFactor,
+ authenticationAttackProtection,
+ authenticationAdvanced,
+ } = flags ?? {}
+
return [
{
title: 'Manage',
@@ -10,58 +31,82 @@ export const generateAuthMenu = (ref: string): ProductMenuGroup[] => {
{
title: 'Configuration',
items: [
- {
- name: 'Policies',
- key: 'policies',
- url: `/project/${ref}/auth/policies`,
- items: [],
- },
- ...(IS_PLATFORM
+ ...(authenticationPolicies
? [
{
- name: 'Sign In / Providers',
- key: 'sign-in-up',
- pages: ['providers', 'third-party'],
- url: `/project/${ref}/auth/providers`,
+ name: 'Policies',
+ key: 'policies',
+ url: `/project/${ref}/auth/policies`,
items: [],
},
+ ]
+ : []),
+ ...(IS_PLATFORM
+ ? [
+ ...(authenticationSignInProviders
+ ? [
+ {
+ name: 'Sign In / Providers',
+ key: 'sign-in-up',
+ pages: ['providers', 'third-party'],
+ url: `/project/${ref}/auth/providers`,
+ items: [],
+ },
+ ]
+ : []),
{
name: 'Sessions',
key: 'sessions',
url: `/project/${ref}/auth/sessions`,
items: [],
},
- {
- name: 'Rate Limits',
- key: 'rate-limits',
- url: `/project/${ref}/auth/rate-limits`,
- items: [],
- },
- {
- name: 'Emails',
- key: 'emails',
- pages: ['templates', 'smtp'],
- url: `/project/${ref}/auth/templates`,
- items: [],
- },
- {
- name: 'Multi-Factor',
- key: 'mfa',
- url: `/project/${ref}/auth/mfa`,
- items: [],
- },
+ ...(authenticationRateLimits
+ ? [
+ {
+ name: 'Rate Limits',
+ key: 'rate-limits',
+ url: `/project/${ref}/auth/rate-limits`,
+ items: [],
+ },
+ ]
+ : []),
+ ...(authenticationEmails
+ ? [
+ {
+ name: 'Emails',
+ key: 'emails',
+ pages: ['templates', 'smtp'],
+ url: `/project/${ref}/auth/templates`,
+ items: [],
+ },
+ ]
+ : []),
+ ...(authenticationMultiFactor
+ ? [
+ {
+ name: 'Multi-Factor',
+ key: 'mfa',
+ url: `/project/${ref}/auth/mfa`,
+ items: [],
+ },
+ ]
+ : []),
{
name: 'URL Configuration',
key: 'url-configuration',
url: `/project/${ref}/auth/url-configuration`,
items: [],
},
- {
- name: 'Attack Protection',
- key: 'protection',
- url: `/project/${ref}/auth/protection`,
- items: [],
- },
+ ...(authenticationAttackProtection
+ ? [
+ {
+ name: 'Attack Protection',
+ key: 'protection',
+ url: `/project/${ref}/auth/protection`,
+ items: [],
+ },
+ ]
+ : []),
{
name: 'Auth Hooks',
key: 'hooks',
@@ -69,12 +114,16 @@ export const generateAuthMenu = (ref: string): ProductMenuGroup[] => {
items: [],
label: 'BETA',
},
- {
- name: 'Advanced',
- key: 'advanced',
- url: `/project/${ref}/auth/advanced`,
- items: [],
- },
+ ...(authenticationAdvanced
+ ? [
+ {
+ name: 'Advanced',
+ key: 'advanced',
+ url: `/project/${ref}/auth/advanced`,
+ items: [],
+ },
+ ]
+ : []),
]
: []),
],
diff --git a/apps/studio/components/layouts/AuthLayout/AuthProvidersLayout.tsx b/apps/studio/components/layouts/AuthLayout/AuthProvidersLayout.tsx
index 712b4c2fd8d..f2a247ab280 100644
--- a/apps/studio/components/layouts/AuthLayout/AuthProvidersLayout.tsx
+++ b/apps/studio/components/layouts/AuthLayout/AuthProvidersLayout.tsx
@@ -2,31 +2,45 @@ import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import AuthLayout from './AuthLayout'
export const AuthProvidersLayout = ({ children }: PropsWithChildren<{}>) => {
const { ref } = useParams()
+ const { authenticationSignInProviders, authenticationThirdPartyAuth } = useIsFeatureEnabled([
+ 'authentication:sign_in_providers',
+ 'authentication:third_party_auth',
+ ])
const navItems = [
{
label: 'Supabase Auth',
href: `/project/${ref}/auth/providers`,
},
- {
- label: 'Third Party Auth',
- href: `/project/${ref}/auth/third-party`,
- },
+ ...(authenticationThirdPartyAuth
+ ? [
+ {
+ label: 'Third Party Auth',
+ href: `/project/${ref}/auth/third-party`,
+ },
+ ]
+ : []),
]
return (
<AuthLayout>
- <PageLayout
- title="Sign In / Providers"
- subtitle="Configure authentication providers and login methods for your users"
- navigationItems={navItems}
- >
- {children}
- </PageLayout>
+ {authenticationSignInProviders ? (
+ <PageLayout
+ title="Sign In / Providers"
+ subtitle="Configure authentication providers and login methods for your users"
+ navigationItems={navItems}
+ >
+ {children}
+ </PageLayout>
+ ) : (
+ <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
+ )}
</AuthLayout>
)
}
diff --git a/apps/studio/pages/project/[ref]/auth/advanced.tsx b/apps/studio/pages/project/[ref]/auth/advanced.tsx
index 3bf49e11668..1524a38b690 100644
--- a/apps/studio/pages/project/[ref]/auth/advanced.tsx
+++ b/apps/studio/pages/project/[ref]/auth/advanced.tsx
@@ -1,43 +1,51 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { useParams } from 'common'
import { AdvancedAuthSettingsForm } from 'components/interfaces/Auth/AdvancedAuthSettingsForm'
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
-import { ScaffoldContainer } from 'components/layouts/Scaffold'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import NoPermission from 'components/ui/NoPermission'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const AdvancedPage: NextPageWithLayout = () => {
+ const { ref } = useParams()
+ const showAdvanced = useIsFeatureEnabled('authentication:advanced')
+
const isPermissionsLoaded = usePermissionsLoaded()
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
- if (isPermissionsLoaded && !canReadAuthSettings) {
- return <NoPermission isFullPage resourceText="access your project's authentication settings" />
+ if (!showAdvanced) {
+ return <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
}
return (
- <ScaffoldContainer>
- {!isPermissionsLoaded ? (
- <div className="mt-12">
- <GenericSkeletonLoader />
- </div>
+ <PageLayout title="Advanced" subtitle="Configure advanced authentication server settings">
+ {isPermissionsLoaded && !canReadAuthSettings ? (
+ <NoPermission isFullPage resourceText="access your project's authentication settings" />
) : (
- <AdvancedAuthSettingsForm />
+ <ScaffoldContainer>
+ {!isPermissionsLoaded ? (
+ <ScaffoldSection isFullWidth>
+ <GenericSkeletonLoader />
+ </ScaffoldSection>
+ ) : (
+ <AdvancedAuthSettingsForm />
+ )}
+ </ScaffoldContainer>
)}
- </ScaffoldContainer>
+ </PageLayout>
)
}
AdvancedPage.getLayout = (page) => (
<DefaultLayout>
- <AuthLayout>
- <PageLayout title="Advanced" subtitle="Configure advanced authentication server settings">
- {page}
- </PageLayout>
- </AuthLayout>
+ <AuthLayout>{page}</AuthLayout>
</DefaultLayout>
)
diff --git a/apps/studio/pages/project/[ref]/auth/mfa.tsx b/apps/studio/pages/project/[ref]/auth/mfa.tsx
index cbe50b1ff0e..84d75511655 100644
--- a/apps/studio/pages/project/[ref]/auth/mfa.tsx
+++ b/apps/studio/pages/project/[ref]/auth/mfa.tsx
@@ -1,40 +1,54 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { useParams } from 'common'
import { MfaAuthSettingsForm } from 'components/interfaces/Auth'
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
-import { ScaffoldContainer } from 'components/layouts/Scaffold'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import NoPermission from 'components/ui/NoPermission'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const MfaPage: NextPageWithLayout = () => {
+ const { ref } = useParams()
+ const showMFA = useIsFeatureEnabled('authentication:multi_factor')
+
const isPermissionsLoaded = usePermissionsLoaded()
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
- if (isPermissionsLoaded && !canReadAuthSettings) {
- return <NoPermission isFullPage resourceText="access your project's authentication settings" />
+ if (!showMFA) {
+ return <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
}
return (
- <ScaffoldContainer>
- {!isPermissionsLoaded ? <GenericSkeletonLoader /> : <MfaAuthSettingsForm />}
- </ScaffoldContainer>
+ <PageLayout
+ title="Multi-Factor Authentication (MFA)"
+ subtitle="Requires users to provide additional verification factors to authenticate"
+ >
+ {isPermissionsLoaded && !canReadAuthSettings ? (
+ <NoPermission isFullPage resourceText="access your project's authentication settings" />
+ ) : (
+ <ScaffoldContainer>
+ {!isPermissionsLoaded ? (
+ <ScaffoldSection isFullWidth>
+ <GenericSkeletonLoader />
+ </ScaffoldSection>
+ ) : (
+ <MfaAuthSettingsForm />
+ )}
+ </ScaffoldContainer>
+ )}
+ </PageLayout>
)
}
MfaPage.getLayout = (page) => (
<DefaultLayout>
- <AuthLayout>
- <PageLayout
- title="Multi-Factor Authentication (MFA)"
- subtitle="Requires users to provide additional verification factors to authenticate"
- >
- {page}
- </PageLayout>
- </AuthLayout>
+ <AuthLayout>{page}</AuthLayout>
</DefaultLayout>
)
diff --git a/apps/studio/pages/project/[ref]/auth/policies.tsx b/apps/studio/pages/project/[ref]/auth/policies.tsx
index fe8f6313386..86223aabbf2 100644
--- a/apps/studio/pages/project/[ref]/auth/policies.tsx
+++ b/apps/studio/pages/project/[ref]/auth/policies.tsx
@@ -3,6 +3,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { Search } from 'lucide-react'
import { useState } from 'react'
+import { useParams } from 'common'
import { useIsInlineEditorEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import Policies from 'components/interfaces/Auth/Policies/Policies'
import { getGeneralPolicyTemplates } from 'components/interfaces/Auth/Policies/PolicyEditorModal/PolicyEditorModal.constants'
@@ -16,9 +17,11 @@ import { EditorPanel } from 'components/ui/EditorPanel/EditorPanel'
import NoPermission from 'components/ui/NoPermission'
import SchemaSelector from 'components/ui/SchemaSelector'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
import { useDatabasePoliciesQuery } from 'data/database-policies/database-policies-query'
import { useTablesQuery } from 'data/tables/tables-query'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { useUrlState } from 'hooks/ui/useUrlState'
import { useIsProtectedSchema } from 'hooks/useProtectedSchemas'
@@ -61,6 +64,7 @@ const onFilterTables = (
}
const AuthPoliciesPage: NextPageWithLayout = () => {
+ const { ref } = useParams()
const [params, setParams] = useUrlState<{
schema?: string
search?: string
@@ -68,6 +72,7 @@ const AuthPoliciesPage: NextPageWithLayout = () => {
const { schema = 'public', search: searchString = '' } = params
const { data: project } = useSelectedProjectQuery()
const isInlineEditorEnabled = useIsInlineEditorEnabled()
+ const showPolicies = useIsFeatureEnabled('authentication:policies')
const [selectedTable, setSelectedTable] = useState<string>()
const [showPolicyAiEditor, setShowPolicyAiEditor] = useState(false)
@@ -99,6 +104,10 @@ const AuthPoliciesPage: NextPageWithLayout = () => {
const canReadPolicies = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'policies')
const isPermissionsLoaded = usePermissionsLoaded()
+ if (!showPolicies) {
+ return <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
+ }
+
if (isPermissionsLoaded && !canReadPolicies) {
return <NoPermission isFullPage resourceText="view this project's RLS policies" />
}
diff --git a/apps/studio/pages/project/[ref]/auth/protection.tsx b/apps/studio/pages/project/[ref]/auth/protection.tsx
index 9751d097520..2e621551171 100644
--- a/apps/studio/pages/project/[ref]/auth/protection.tsx
+++ b/apps/studio/pages/project/[ref]/auth/protection.tsx
@@ -1,46 +1,54 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { useParams } from 'common'
import { ProtectionAuthSettingsForm } from 'components/interfaces/Auth'
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
-import { ScaffoldContainer } from 'components/layouts/Scaffold'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import NoPermission from 'components/ui/NoPermission'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const ProtectionPage: NextPageWithLayout = () => {
+ const { ref } = useParams()
+ const showAttackProtection = useIsFeatureEnabled('authentication:attack_protection')
+
const isPermissionsLoaded = usePermissionsLoaded()
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
- if (isPermissionsLoaded && !canReadAuthSettings) {
- return <NoPermission isFullPage resourceText="access your project's auth provider settings" />
+ if (!showAttackProtection) {
+ return <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
}
return (
- <ScaffoldContainer>
- {!isPermissionsLoaded ? (
- <div className="mt-12">
- <GenericSkeletonLoader />
- </div>
+ <PageLayout
+ title="Attack Protection"
+ subtitle="Configure security settings to protect your project from attacks"
+ >
+ {isPermissionsLoaded && !canReadAuthSettings ? (
+ <NoPermission isFullPage resourceText="access your project's auth provider settings" />
) : (
- <ProtectionAuthSettingsForm />
+ <ScaffoldContainer>
+ {!isPermissionsLoaded ? (
+ <ScaffoldSection isFullWidth>
+ <GenericSkeletonLoader />
+ </ScaffoldSection>
+ ) : (
+ <ProtectionAuthSettingsForm />
+ )}
+ </ScaffoldContainer>
)}
- </ScaffoldContainer>
+ </PageLayout>
)
}
ProtectionPage.getLayout = (page) => (
<DefaultLayout>
- <AuthLayout>
- <PageLayout
- title="Attack Protection"
- subtitle="Configure security settings to protect your project from attacks"
- >
- {page}
- </PageLayout>
- </AuthLayout>
+ <AuthLayout>{page}</AuthLayout>
</DefaultLayout>
)
diff --git a/apps/studio/pages/project/[ref]/auth/providers.tsx b/apps/studio/pages/project/[ref]/auth/providers.tsx
index 2bdc9ab9584..8c3db26924e 100644
--- a/apps/studio/pages/project/[ref]/auth/providers.tsx
+++ b/apps/studio/pages/project/[ref]/auth/providers.tsx
@@ -2,13 +2,16 @@ import { AuthProvidersForm, BasicAuthSettingsForm } from 'components/interfaces/
import { AuthProvidersLayout } from 'components/layouts/AuthLayout/AuthProvidersLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { ScaffoldContainer } from 'components/layouts/Scaffold'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const ProvidersPage: NextPageWithLayout = () => {
+ const showProviders = useIsFeatureEnabled('authentication:show_providers')
+
return (
<ScaffoldContainer>
<BasicAuthSettingsForm />
- <AuthProvidersForm />
+ {showProviders && <AuthProvidersForm />}
</ScaffoldContainer>
)
}
diff --git a/apps/studio/pages/project/[ref]/auth/rate-limits.tsx b/apps/studio/pages/project/[ref]/auth/rate-limits.tsx
index 759ac70c188..185c000bd4c 100644
--- a/apps/studio/pages/project/[ref]/auth/rate-limits.tsx
+++ b/apps/studio/pages/project/[ref]/auth/rate-limits.tsx
@@ -1,44 +1,58 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { useParams } from 'common'
import RateLimits from 'components/interfaces/Auth/RateLimits/RateLimits'
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
-import { ScaffoldContainer } from 'components/layouts/Scaffold'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import { DocsButton } from 'components/ui/DocsButton'
import NoPermission from 'components/ui/NoPermission'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const RateLimitsPage: NextPageWithLayout = () => {
+ const { ref } = useParams()
+ const showRateLimits = useIsFeatureEnabled('authentication:rate_limits')
+
const isPermissionsLoaded = usePermissionsLoaded()
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
- if (isPermissionsLoaded && !canReadAuthSettings) {
- return <NoPermission isFullPage resourceText="access your project's auth rate limit settings" />
+ if (!showRateLimits) {
+ return <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
}
return (
- <ScaffoldContainer>
- {!isPermissionsLoaded ? <GenericSkeletonLoader /> : <RateLimits />}
- </ScaffoldContainer>
+ <PageLayout
+ title="Rate Limits"
+ subtitle="Safeguard against bursts of incoming traffic to prevent abuse and maximize stability"
+ primaryActions={
+ <DocsButton href="https://supabase.com/docs/guides/platform/going-into-prod#rate-limiting-resource-allocation--abuse-prevention" />
+ }
+ >
+ {isPermissionsLoaded && !canReadAuthSettings ? (
+ <NoPermission isFullPage resourceText="access your project's auth rate limit settings" />
+ ) : (
+ <ScaffoldContainer>
+ {!isPermissionsLoaded ? (
+ <ScaffoldSection isFullWidth>
+ <GenericSkeletonLoader />
+ </ScaffoldSection>
+ ) : (
+ <RateLimits />
+ )}
+ </ScaffoldContainer>
+ )}
+ </PageLayout>
)
}
RateLimitsPage.getLayout = (page) => (
<DefaultLayout>
- <AuthLayout>
- <PageLayout
- title="Rate Limits"
- subtitle="Safeguard against bursts of incoming traffic to prevent abuse and maximize stability"
- primaryActions={
- <DocsButton href="https://supabase.com/docs/guides/platform/going-into-prod#rate-limiting-resource-allocation--abuse-prevention" />
- }
- >
- {page}
- </PageLayout>
- </AuthLayout>
+ <AuthLayout>{page}</AuthLayout>
</DefaultLayout>
)
diff --git a/apps/studio/pages/project/[ref]/auth/third-party.tsx b/apps/studio/pages/project/[ref]/auth/third-party.tsx
index e3d955abd2d..fdfbcc79f4c 100644
--- a/apps/studio/pages/project/[ref]/auth/third-party.tsx
+++ b/apps/studio/pages/project/[ref]/auth/third-party.tsx
@@ -1,32 +1,45 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { useParams } from 'common'
import { ThirdPartyAuthForm } from 'components/interfaces/Auth'
+import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
import { AuthProvidersLayout } from 'components/layouts/AuthLayout/AuthProvidersLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { ScaffoldContainer } from 'components/layouts/Scaffold'
import NoPermission from 'components/ui/NoPermission'
+import { UnknownInterface } from 'components/ui/UnknownInterface'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { NextPageWithLayout } from 'types'
const ThirdPartyPage: NextPageWithLayout = () => {
+ const { ref } = useParams()
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
const isPermissionsLoaded = usePermissionsLoaded()
- if (isPermissionsLoaded && !canReadAuthSettings) {
- return <NoPermission isFullPage resourceText="access your project's auth provider settings" />
+ const showThirdPartyAuth = useIsFeatureEnabled('authentication:third_party_auth')
+
+ if (!showThirdPartyAuth) {
+ return (
+ <AuthLayout>
+ <UnknownInterface urlBack={`/project/${ref}/auth/providers`} />
+ </AuthLayout>
+ )
}
return (
- <ScaffoldContainer className="pb-16">
- <ThirdPartyAuthForm />
- </ScaffoldContainer>
+ <AuthProvidersLayout>
+ {isPermissionsLoaded && !canReadAuthSettings ? (
+ <NoPermission isFullPage resourceText="access your project's auth provider settings" />
+ ) : (
+ <ScaffoldContainer className="pb-16">
+ <ThirdPartyAuthForm />
+ </ScaffoldContainer>
+ )}
+ </AuthProvidersLayout>
)
}
-ThirdPartyPage.getLayout = (page) => (
- <DefaultLayout>
- <AuthProvidersLayout>{page}</AuthProvidersLayout>
- </DefaultLayout>
-)
+ThirdPartyPage.getLayout = (page) => <DefaultLayout>{page}</DefaultLayout>
export default ThirdPartyPage
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index f2d63d66846..ec2357a4351 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -6,6 +6,17 @@
"ai:opt_in_level_schema_and_log": true,
"ai:opt_in_level_schema_and_log_and_data": true,
+ "authentication:policies": true,
+ "authentication:sign_in_providers": true,
+ "authentication:third_party_auth": true,
+ "authentication:rate_limits": true,
+ "authentication:emails": true,
+ "authentication:multi_factor": true,
+ "authentication:attack_protection": true,
+ "authentication:advanced": true,
+
+ "authentication:show_providers": true,
+ "authentication:show_manual_linking": true,
"authentication:show_send_invitation": true,
"authentication:show_provider_filter": true,
"authentication:show_sort_by_email": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index 22081cf423d..f3bd32c894d 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -23,6 +23,47 @@
"description": "Enable the AI opt in level 'schema_and_log_and_data'"
},
+ "authentication:policies": {
+ "type": "boolean",
+ "description": "Enable the authentication policies page (as well as all other product's policies page)"
+ },
+ "authentication:sign_in_providers": {
+ "type": "boolean",
+ "description": "Enable the authentication sign in / providers page"
+ },
+ "authentication:third_party_auth": {
+ "type": "boolean",
+ "description": "Enable the authentication third party auth page"
+ },
+ "authentication:rate_limits": {
+ "type": "boolean",
+ "description": "Enable the authentication rate limits page"
+ },
+ "authentication:emails": {
+ "type": "boolean",
+ "description": "Enable the authentication emails page"
+ },
+ "authentication:multi_factor": {
+ "type": "boolean",
+ "description": "Enable the authentication multi factor page"
+ },
+ "authentication:attack_protection": {
+ "type": "boolean",
+ "description": "Enable the authentication attack protection page"
+ },
+ "authentication:advanced": {
+ "type": "boolean",
+ "description": "Enable the authentication advanced page"
+ },
+
+ "authentication:show_providers": {
+ "type": "boolean",
+ "description": "Show the providers section in the authentication Sign In / Providers page"
+ },
+ "authentication:show_manual_linking": {
+ "type": "boolean",
+ "description": "Show the manual linking toggle in the authentication Sign In / Providers page under User Signups"
+ },
"authentication:show_send_invitation": {
"type": "boolean",
"description": "Show the send invitation option in the authentication users page"
@@ -118,6 +159,16 @@
"ai:opt_in_level_schema",
"ai:opt_in_level_schema_and_log",
"ai:opt_in_level_schema_and_log_and_data",
+ "authentication:policies",
+ "authentication:sign_in_providers",
+ "authentication:third_party_auth",
+ "authentication:rate_limits",
+ "authentication:emails",
+ "authentication:multi_factor",
+ "authentication:attack_protection",
+ "authentication:advanced",
+ "authentication:show_providers",
+ "authentication:show_manual_linking",
"authentication:show_provider_filter",
"authentication:show_send_invitation",
"authentication:show_sort_by_email",