Files
supabase/apps/studio/components/interfaces/Auth/Hooks/hooks.constants.ts
T
35645efc6f feat: add UI For Auth HTTP Hooks (#22495)
* feat: add https auth hook support

* fix: commit changes

* fix: add enterprise hook config

* fix: add descriptionText

* Revert the changes to the ui components.

* Refactor the whole hooks page into a table with adding/editing hook in a side panel.

* Dele	te unused file.

* Rename all web strings to HTTPS.

* Put all fields in the hook card in a copyable and revealable input.

* Start nudges

* Nudges

* Add validation for both types of hooks.

* Reorganize the layouts for the both types of hooks.

* Move the button for enabling a hook in the side panel.

* Move the button for deleting a hook in the side panel.

* Minor redesign of the hook card.

* Add a link to upgrade to enterprise.

* Fix type errors.

* Simplify function selector.

* Add checked prop to the toggle.

* Wait when deleting a hook.

* Use the new RadioGroup.

* Add a flag for https hooks.

* Minor CSS fixes.

* Change the page to use scaffold containers.

* Minor fixes.

* Convert the description to markdown. Fix. the generate secret onClick handler.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
2024-05-29 10:31:29 +02:00

61 lines
2.2 KiB
TypeScript

export const HOOKS_DEFINITIONS = [
{
title: 'Send SMS hook',
subtitle: 'Will be called by Supabase Auth each time an SMS message needs to be sent.',
enabledKey: 'HOOK_SEND_SMS_ENABLED',
uriKey: 'HOOK_SEND_SMS_URI',
secretsKey: 'HOOK_SEND_SMS_SECRETS',
enterprise: false,
},
{
title: 'Send Email hook',
subtitle: 'Will be called by Supabase Auth each time an email message needs to be sent.',
enabledKey: 'HOOK_SEND_EMAIL_ENABLED',
uriKey: 'HOOK_SEND_EMAIL_URI',
secretsKey: 'HOOK_SEND_EMAIL_SECRETS',
enterprise: false,
},
{
title: 'Customize Access Token (JWT) Claims hook',
subtitle:
'Will be called by Supabase Auth each time a new JWT is created. It should return the claims you wish to be present in the JWT.',
enabledKey: 'HOOK_CUSTOM_ACCESS_TOKEN_ENABLED',
uriKey: 'HOOK_CUSTOM_ACCESS_TOKEN_URI',
secretsKey: 'HOOK_CUSTOM_ACCESS_TOKEN_SECRETS',
enterprise: false,
},
{
title: 'MFA Verification Attempt hook',
subtitle:
'Will be called by Supabase Auth each time a user tries to verify an MFA factor. Return a decision on whether to reject the attempt and future ones, or to allow the user to keep trying.',
enabledKey: 'HOOK_MFA_VERIFICATION_ATTEMPT_ENABLED',
uriKey: 'HOOK_MFA_VERIFICATION_ATTEMPT_URI',
secretsKey: 'HOOK_MFA_VERIFICATION_ATTEMPT_SECRETS',
enterprise: true,
},
{
title: 'Password Verification Attempt hook',
subtitle:
'Will be called by Supabase Auth each time a user tries to sign in with a password. Return a decision whether to allow the user to reject the attempt, or to allow the user to keep trying.',
enabledKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED',
uriKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT_URI',
secretsKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT_SECRETS',
enterprise: true,
},
] as const
export type HOOK_DEFINITION_TITLE = (typeof HOOKS_DEFINITIONS)[number]['title']
export interface Hook {
title: HOOK_DEFINITION_TITLE
subtitle: string
enabled: boolean
enabledKey: string
uriKey: string
secretsKey: string
method:
| { type: 'postgres'; schema: string; functionName: string }
| { type: 'https'; url: string; secret: string }
enterprise: boolean
}