mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 05:09:12 +03:00
* oAuth clients index layout * oAuth apps crud * is public * add user count and client secret generation and management * scaffold oauth server settings * improve oauth server enablement / disablement * show cover when oAuth server is disabled * fix update panel update button * add site url and authorization path settings values * move oauth server to it's own nav item * remove unneeded oauth server settings * let the user disactivate oauth server even after creating oauth apps * better delete button * cleanup * fix typecheck * test endpoints * add EnableOAuth21 feature flag * update OAUTH_SERVER_ auth config api * load OAUTH_SERVER_ENABLED in oauth list * Update the api.d.ts. Remove the custom versions of supa libs. * Add query for getTemporaryAPIKey. * Add a hook for initializing a supabase client. * Add hooks for oAuth Server apps. * Regenerate pnpm-lock.yaml. * Revert updates to the platform.d.ts. Not needed for this PR. * Migrate all code to use the new hooks. * Try to integrate the mutations and fix some of the sheet and dialogs. * improve default and saving states * fix oauth app form validation * unify components into CreateOrUpdateOAuthAppModal * create or update oauth app * Update the OAuth Server page. * Remove extra files. * Minor various fixes. * More fixes to the creation of oauth apps. * Bump the libs to fix a DELETE oauth app error. * Clean up the scope feature. * Move the feature flag in the auth layout. * Bunch of smaller fixes. * Regenerate pnpm-lock. * Revert SidePanel and CardDescription changes. * Add confirm dialog for regenerating secret. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
185 lines
5.5 KiB
TypeScript
185 lines
5.5 KiB
TypeScript
import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
|
|
import { IS_PLATFORM } from 'lib/constants'
|
|
|
|
export const generateAuthMenu = (
|
|
ref: string,
|
|
flags?: {
|
|
authenticationSignInProviders: boolean
|
|
authenticationRateLimits: boolean
|
|
authenticationEmails: boolean
|
|
authenticationMultiFactor: boolean
|
|
authenticationAttackProtection: boolean
|
|
authenticationAdvanced: boolean
|
|
authenticationShowOverview: boolean
|
|
authenticationShowSecurityNotifications: boolean
|
|
authenticationOauth21: boolean
|
|
}
|
|
): ProductMenuGroup[] => {
|
|
const {
|
|
authenticationSignInProviders,
|
|
authenticationRateLimits,
|
|
authenticationEmails,
|
|
authenticationMultiFactor,
|
|
authenticationAttackProtection,
|
|
authenticationAdvanced,
|
|
authenticationShowOverview,
|
|
authenticationShowSecurityNotifications,
|
|
authenticationOauth21,
|
|
} = flags ?? {}
|
|
|
|
return [
|
|
{
|
|
title: 'Manage',
|
|
items: [
|
|
...(authenticationShowOverview
|
|
? [{ name: 'Overview', key: 'overview', url: `/project/${ref}/auth/overview`, items: [] }]
|
|
: []),
|
|
{ name: 'Users', key: 'users', url: `/project/${ref}/auth/users`, items: [] },
|
|
...(authenticationOauth21
|
|
? [
|
|
{
|
|
name: 'OAuth Apps',
|
|
key: 'oauth-apps',
|
|
url: `/project/${ref}/auth/oauth-apps`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
],
|
|
},
|
|
...(authenticationEmails && authenticationShowSecurityNotifications && IS_PLATFORM
|
|
? [
|
|
{
|
|
title: 'Notifications',
|
|
items: [
|
|
...(authenticationEmails
|
|
? [
|
|
{
|
|
name: 'Email',
|
|
key: 'email',
|
|
pages: ['templates', 'smtp'],
|
|
url: `/project/${ref}/auth/templates`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
],
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
title: 'Configuration',
|
|
items: [
|
|
{
|
|
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: [],
|
|
},
|
|
]
|
|
: []),
|
|
...(authenticationOauth21
|
|
? [
|
|
{
|
|
name: 'OAuth Server',
|
|
key: 'oauth-server',
|
|
url: `/project/${ref}/auth/oauth-server`,
|
|
label: 'BETA',
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
name: 'Sessions',
|
|
key: 'sessions',
|
|
url: `/project/${ref}/auth/sessions`,
|
|
items: [],
|
|
},
|
|
...(authenticationRateLimits
|
|
? [
|
|
{
|
|
name: 'Rate Limits',
|
|
key: 'rate-limits',
|
|
url: `/project/${ref}/auth/rate-limits`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
...(authenticationEmails && !authenticationShowSecurityNotifications
|
|
? [
|
|
{
|
|
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: [],
|
|
},
|
|
...(authenticationAttackProtection
|
|
? [
|
|
{
|
|
name: 'Attack Protection',
|
|
key: 'protection',
|
|
url: `/project/${ref}/auth/protection`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
name: 'Auth Hooks',
|
|
key: 'hooks',
|
|
url: `/project/${ref}/auth/hooks`,
|
|
items: [],
|
|
label: 'BETA',
|
|
},
|
|
{
|
|
name: 'Audit Logs',
|
|
key: 'audit-logs',
|
|
url: `/project/${ref}/auth/audit-logs`,
|
|
items: [],
|
|
label: 'BETA',
|
|
},
|
|
...(authenticationAdvanced
|
|
? [
|
|
{
|
|
name: 'Advanced',
|
|
key: 'advanced',
|
|
url: `/project/${ref}/auth/advanced`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
]
|
|
: []),
|
|
],
|
|
},
|
|
]
|
|
}
|