0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-10 22:22:45 -05:00

feat(console): support HTTP for webhook requests (#4716)

This commit is contained in:
Xiao Yijun 2023-10-23 13:56:09 +08:00 committed by GitHub
parent 19aa36aac2
commit 87df417d1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 44 additions and 68 deletions

View file

@ -0,0 +1,6 @@
---
"@logto/console": minor
"@logto/phrases": minor
---
feat: support HTTP for webhook requests

View file

@ -64,12 +64,7 @@ function BasicWebhookForm() {
<TextInput
{...register('url', {
required: true,
validate: (value) => {
if (!uriValidator(value)) {
return t('errors.invalid_uri_format');
}
return value.startsWith('https://') || t('webhooks.create_form.https_format_error');
},
validate: (value) => uriValidator(value) || t('errors.invalid_uri_format'),
})}
placeholder={t('webhooks.create_form.endpoint_url_placeholder')}
error={errors.url?.type === 'required' ? true : errors.url?.message}

View file

@ -5,7 +5,7 @@ export const expectToCreateWebhook = async (page: Page) => {
await expect(page).toClick('span[class$=label]', { text: 'Create new account' });
await expect(page).toClick('span[class$=label]', { text: 'Sign in' });
await expect(page).toFill('input[name=name]', 'hook_name');
await expect(page).toFill('input[name=url]', 'https://example.com/webhook');
await expect(page).toFill('input[name=url]', 'https://localhost/webhook');
await expect(page).toClick('button[type=submit]');
await page.waitForSelector('div[class$=header] div[class$=metadata] div[class$=title]');
};

View file

@ -52,24 +52,24 @@ describe('webhooks', () => {
await expect(page).toClick('div[class$=main] div[class$=headline] > button');
await expect(page).toFill('input[name=name]', 'hook_name');
await expect(page).toFill('input[name=url]', 'https://example.com/webhook');
await expect(page).toFill('input[name=url]', 'https://localhost/webhook');
await expect(page).toClick('button[type=submit]');
await expect(page).toMatchElement('.ReactModalPortal div[class$=errorMessage]', {
text: 'You have to select at least one event.',
});
});
it('fails to create webhook if endpoint url is not an HTTPS url', async () => {
it('can create webhook if endpoint url is an HTTP url', async () => {
await expectNavigation(page.goto(appendPathname('/console/webhooks', logtoConsoleUrl).href));
await expect(page).toClick('div[class$=main] div[class$=headline] > button');
await expect(page).toClick('span[class$=label]', { text: 'Create new account' });
await expect(page).toClick('span[class$=label]', { text: 'Sign in' });
await expect(page).toFill('input[name=name]', 'hook_name');
await expect(page).toFill('input[name=url]', 'http://example.com/webhook');
await expect(page).toFill('input[name=url]', 'http://localhost/webhook');
await expect(page).toClick('button[type=submit]');
await expect(page).toMatchElement('.ReactModalPortal div[class$=errorMessage]', {
text: 'HTTPS format required for security reasons.',
await expect(page).toMatchElement('div[class$=main] div[class$=metadata] div[class$=title]', {
text: 'hook_name',
});
});
@ -79,7 +79,7 @@ describe('webhooks', () => {
await expectToCreateWebhook(page);
await expect(page).toFill('input[name=name]', 'hook_name_updated');
await expect(page).toFill('input[name=url]', 'https://example.com/new-webhook');
await expect(page).toFill('input[name=url]', 'https://localhost/new-webhook');
await expectToSaveChanges(page);
await waitForToast(page, { text: 'Saved' });

View file

@ -25,8 +25,6 @@ const webhook_details = {
'Wählen Sie die Auslöserereignisse aus, die Logto die POST-Anforderung senden wird.',
name: 'Name',
endpoint_url: 'Endpunkt-URL',
endpoint_url_tip:
'Geben Sie die HTTPS-URL Ihres Endpunkts ein, an die die Nutzlast eines Webhooks gesendet wird, wenn das Ereignis eintritt.',
signing_key: 'Signing Key',
signing_key_tip:
'Fügen Sie den von Logto bereitgestellten geheimen Schlüssel als Anforderungsheader zu Ihrem Endpunkt hinzu, um die Echtheit der Nutzlast des Webhooks sicherzustellen.',

View file

@ -32,11 +32,11 @@ const webhooks = {
name_placeholder: 'Webhook-Namen eingeben',
endpoint_url: 'Endpunkt-URL',
endpoint_url_placeholder: 'https://Ihre.webhook.endpunkt.url',
/** UNTRANSLATED */
endpoint_url_tip:
'Geben Sie die HTTPS-URL Ihres Endpunkts ein, an den der Payload eines Webhooks gesendet wird, wenn das Ereignis eintritt.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Webhook erstellen',
missing_event_error: 'Sie müssen mindestens ein Ereignis auswählen.',
https_format_error: 'HTTPS-Format erforderlich aus Sicherheitsgründen.',
},
webhook_created: 'Der Webhook {{name}} wurde erfolgreich erstellt.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'Select the trigger events which Logto will send the POST request.',
name: 'Name',
endpoint_url: 'Endpoint URL',
endpoint_url_tip:
'Enter the HTTPS URL of your endpoint where a webhooks payload is sent to when the event occurs.',
signing_key: 'Signing key',
signing_key_tip:
'Add the secret key provided by Logto to your endpoint as a request header to ensure the authenticity of the webhooks payload.',

View file

@ -31,10 +31,9 @@ const webhooks = {
endpoint_url: 'Endpoint URL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
endpoint_url_tip:
'Enter the HTTPS URL of your endpoint where a webhooks payload is sent to when the event occurs.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Create webhook',
missing_event_error: 'You have to select at least one event.',
https_format_error: 'HTTPS format required for security reasons.',
},
webhook_created: 'The webhook {{name}} has been successfully created.',
};

View file

@ -25,8 +25,6 @@ const webhook_details = {
'Seleccione los eventos desencadenantes que Logto enviará como solicitud POST.',
name: 'Nombre',
endpoint_url: 'URL del Extremo',
endpoint_url_tip:
'Ingrese la URL HTTPS de su endpoint a la que se enviará el payload del webhook cuando ocurra el evento.',
signing_key: 'Clave de firma',
signing_key_tip:
'Agregue la clave secreta proporcionada por Logto a su extremo como encabezado de solicitud para garantizar la autenticidad del payload del webhook.',

View file

@ -32,11 +32,11 @@ const webhooks = {
name_placeholder: 'Ingrese el nombre del webhook',
endpoint_url: 'URL de punto final',
endpoint_url_placeholder: 'https://su.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
'Ingrese la URL HTTPS de su punto final donde se envía el payload de un webhook cuando se produce un evento.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Crear webhook',
missing_event_error: 'Debe seleccionar al menos un evento.',
https_format_error: 'Se requiere formato HTTPS por motivos de seguridad.',
},
webhook_created: 'El webhook {{name}} se ha creado correctamente.',
};

View file

@ -25,8 +25,6 @@ const webhook_details = {
'Sélectionnez les événements déclencheurs que Logto enverra la requête POST.',
name: 'Nom',
endpoint_url: "URL de l'endpoint",
endpoint_url_tip:
"Entrez l'URL HTTPS de votre endpoint où la charge utile d'un webhook est envoyée lorsque l'événement se produit.",
signing_key: 'Clé de signature',
signing_key_tip:
"Ajoutez la clé secrète fournie par Logto à votre endpoint en tant qu'en-tête de requête pour garantir l'authenticité de la charge utile du webhook.",

View file

@ -32,11 +32,11 @@ const webhooks = {
name_placeholder: 'Entrez le nom du webhook',
endpoint_url: "URL du point d'extrémité",
endpoint_url_placeholder: 'https://votre.url.de.webhook.point.de.terminaison',
/** UNTRANSLATED */
endpoint_url_tip:
"Entrez l'URL HTTPS de votre point de terminaison où la charge utile d'un webhook est envoyée lorsque l'événement se produit.",
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Créer un webhook',
missing_event_error: 'Vous devez sélectionner au moins un événement.',
https_format_error: 'Format HTTPS requis pour des raisons de sécurité.',
},
webhook_created: 'Le webhook {{name}} a été créé avec succès.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'Seleziona gli eventi trigger che Logto invierà la richiesta POST.',
name: 'Nome',
endpoint_url: 'Endpoint URL',
endpoint_url_tip:
"Inserisci l'URL HTTPS del tuo endpoint dove viene inviato il payload del webhook quando il evento si verifica.",
signing_key: 'Chiave di firma',
signing_key_tip:
"Aggiungi la chiave segreta fornita da Logto al tuo endpoint come header richiesta per garantire l'autenticità del payload del webhook.",

View file

@ -31,11 +31,11 @@ const webhooks = {
name_placeholder: 'Inserisci nome webhook',
endpoint_url: 'Endpoint URL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
"Inserisci l'URL HTTPS del tuo endpoint dove il payload di un webhook viene inviato quando si verifica l'evento.",
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Crea webhook',
missing_event_error: 'Devi selezionare almeno un evento.',
https_format_error: 'Richiesto formato HTTPS per motivi di sicurezza.',
},
webhook_created: 'Il webhook {{name}} è stato creato con successo.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'LogtoがPOSTリクエストを送信するトリガーイベントを選択します。',
name: '名前',
endpoint_url: 'エンドポイントURL',
endpoint_url_tip:
'イベントが発生したときにWebhookのペイロードが送信されるHTTPS URLを入力します。',
signing_key: '署名キー',
signing_key_tip:
'ログトから提供されたシークレットキーをエンドポイントにリクエストヘッダーとして追加して、Webhookのペイロードの正当性を保証します。',

View file

@ -30,11 +30,11 @@ const webhooks = {
name_placeholder: 'Webhook名を入力してください',
endpoint_url: 'エンドポイントURL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
'イベントが発生したときに webhook ペイロードが送信されるエンドポイントの HTTPS URLを入力します。',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Webhookを作成する',
missing_event_error: '少なくとも1つのイベントを選択する必要があります。',
https_format_error: 'セキュリティ上の理由からHTTPS形式が必要です。',
},
webhook_created: 'Webhook {{name}}が正常に作成されました。',
};

View file

@ -24,7 +24,6 @@ const webhook_details = {
events_description: 'Logto에서 POST request를 보낼 이벤트를 선택하세요.',
name: '이름',
endpoint_url: '엔드포인트 URL',
endpoint_url_tip: '웹훅 페이로드가 이벤트 발생시 전송되는 내 https 엔드포인트 URL 입력',
signing_key: 'Signing key',
signing_key_tip:
'Logto에서 제공된 시크릿 키를 사용하여 엔드포인트에 요청 헤더로 추가하여 웹훅 페이로드의 진위성 보장',

View file

@ -30,11 +30,11 @@ const webhooks = {
name_placeholder: 'Webhook 이름 입력',
endpoint_url: 'Endpoint URL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
'이벤트가 발생할 때 웹훅의 payload가 전송되는 엔드포인트의 HTTPS URL을 입력합니다.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Webhook 생성',
missing_event_error: '하나 이상의 이벤트를 선택해야 합니다.',
https_format_error: '보안 상의 이유로 HTTPS 형식이 필요합니다.',
},
webhook_created: 'Webhook {{name}} 가 성공적으로 생성되었습니다.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'Wybierz zdarzenia wywołujące, które Logto wyśle żądanie POST.',
name: 'Nazwa',
endpoint_url: 'Adres URL końcowego',
endpoint_url_tip:
'Wpisz adres URL protokołu HTTPS Twojego endpointu, na który webhook wysyła ładunek, gdy występuje zdarzenie.',
signing_key: 'Klucz podpisu',
signing_key_tip:
'Dodaj klucz sekretny dostarczony przez Logto do swojego endpointu jako nagłówek żądania, aby zapewnić autentyczność ładunku webhooka.',

View file

@ -32,11 +32,11 @@ const webhooks = {
name_placeholder: 'Wprowadź nazwę webhooka',
endpoint_url: 'URL punktu końcowego',
endpoint_url_placeholder: 'https://twoj.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
'Wprowadź adres URL końcowego, na który zostanie wysłany ładunek webhooka, gdy wystąpi zdarzenie.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Utwórz webhook',
missing_event_error: 'Musisz wybrać przynajmniej jedno zdarzenie.',
https_format_error: 'Wymagany format HTTPS ze względu na bezpieczeństwo.',
},
webhook_created: 'Webhook {{name}} został pomyślnie utworzony.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'Selecione os eventos de gatilho que o Logto enviará a solicitação POST.',
name: 'Nome',
endpoint_url: 'URL do Endpoint',
endpoint_url_tip:
'Insira o URL HTTPS do seu endpoint onde o payload de um webhook é enviado quando o evento ocorre.',
signing_key: 'Chave de assinatura',
signing_key_tip:
'Adicione a chave secreta fornecida pelo Logto ao seu endpoint como um cabeçalho de solicitação para garantir a autenticidade do payload do webhook.',

View file

@ -31,11 +31,11 @@ const webhooks = {
name_placeholder: 'Digite o nome do webhook',
endpoint_url: 'URL de endpoint',
endpoint_url_placeholder: 'https://seu.url.endpoint.do.webhook',
/** UNTRANSLATED */
endpoint_url_tip:
'Digite a URL HTTPS do seu endpoint para a qual a carga útil de um webhook é enviada quando o evento ocorre.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Criar webhook',
missing_event_error: 'Você precisa selecionar pelo menos um evento.',
https_format_error: 'Formato HTTPS necessário por motivos de segurança.',
},
webhook_created: 'O webhook {{name}foi criado com sucesso.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'Selecione os eventos de gatilho que o Logto enviará a solicitação POST.',
name: 'Nome',
endpoint_url: 'URL do endpoint',
endpoint_url_tip:
'Digite o URL HTTPS do seu endpoint, onde um corpo de webhook é enviado quando ocorre um evento.',
signing_key: 'Chave de assinatura',
signing_key_tip:
'Adicione a chave secreta fornecida pelo Logto ao seu endpoint como um cabeçalho de solicitação para garantir a autenticidade do corpo do webhook.',

View file

@ -31,11 +31,11 @@ const webhooks = {
name_placeholder: 'Digite o nome do webhook',
endpoint_url: 'URL do ponto final',
endpoint_url_placeholder: 'https://seu.url.de.ponto.final/webhook',
/** UNTRANSLATED */
endpoint_url_tip:
'Insira o URL HTTPS do seu ponto final, onde o payload de um webhook é enviado quando o evento ocorre.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Criar webhook',
missing_event_error: 'Você deve selecionar pelo menos um evento.',
https_format_error: 'Formato HTTPS exigido por motivos de segurança.',
},
webhook_created: 'O webhook {{name}} foi criado com sucesso.',
};

View file

@ -24,8 +24,6 @@ const webhook_details = {
events_description: 'Выберите события триггеров, которые Logto будет отправлять POST-запрос.',
name: 'Имя',
endpoint_url: 'URL-адрес точки доступа',
endpoint_url_tip:
'Введите HTTPS-URL вашей конечной точки, куда будет отправляться нагрузка вебхука при возникновении события.',
signing_key: 'Ключ подписи',
signing_key_tip:
'Добавьте секретный ключ, предоставленный Logto, к своей конечной точке в виде заголовка запроса, чтобы обеспечить подлинность нагрузки вебхука.',

View file

@ -32,11 +32,11 @@ const webhooks = {
name_placeholder: 'Введите имя вебхука',
endpoint_url: 'URL-адрес конечной точки',
endpoint_url_placeholder: 'https://ваш.url.адрес.вебхука',
/** UNTRANSLATED */
endpoint_url_tip:
'Введите HTTPS URL вашей конечной точки, куда будет отправлено тело вебхука при наступлении события.',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Создать вебхук',
missing_event_error: 'Вы должны выбрать как минимум одно событие.',
https_format_error: 'Требуется формат HTTPS по соображениям безопасности.',
},
webhook_created: 'Вебхук {{name}} был успешно создан.',
};

View file

@ -24,7 +24,6 @@ const webhook_details = {
events_description: 'Logtonun POST isteğini göndereceği tetikleyici olayları seçin.',
name: 'İsim',
endpoint_url: 'Uç nokta URLsi',
endpoint_url_tip: 'Olay gerçekleştiğinde webhookun yükü gönderilen HTTPS URLsini girin.',
signing_key: 'İmza anahtarı',
signing_key_tip:
'Webhookun yükü için kimliğinin doğruluğunu sağlamak için Logto tarafından sağlanan gizli anahtarın istek başlığı olarak uç noktanızda ekleyin.',

View file

@ -31,11 +31,11 @@ const webhooks = {
name_placeholder: 'Webhook adını girin',
endpoint_url: 'Uç Nokta URLsi',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
"Bir webhooks yükünün gerçekleştiği zaman gönderilen POST isteğinin HTTPS URL'ini girin.",
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: 'Webhook Oluştur',
missing_event_error: 'En az bir olay seçmeniz gerekiyor.',
https_format_error: 'Güvenliği nedeniyle HTTPS biçimi gereklidir.',
},
webhook_created: 'Webhook {{name}} başarıyla oluşturuldu.',
};

View file

@ -22,7 +22,6 @@ const webhook_details = {
events_description: '选择 Logto 将发送 POST 请求的触发事件。',
name: '名称',
endpoint_url: '端点 URL',
endpoint_url_tip: '输入 HTTPS 端点的 URL事件发生时 Webhook 负载将发送到此 URL。',
signing_key: '签名密钥',
signing_key_tip:
'将由 Logto 提供的密钥作为请求标头添加到您的端点中,以确保 Webhook 负载的真实性。',

View file

@ -29,10 +29,11 @@ const webhooks = {
name_placeholder: '输入 Webhook 名称',
endpoint_url: 'Endpoint URL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
endpoint_url_tip: '在事件发生时发送 Webhook 负载的 HTTPS URL 端点。',
/** UNTRANSLATED */
endpoint_url_tip:
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: '创建 Webhook',
missing_event_error: '您必须至少选择一个事件。',
https_format_error: 'HTTPS 格式为安全性所必须。',
},
webhook_created: 'Webhook {{name}} 已成功创建。',
};

View file

@ -22,7 +22,6 @@ const webhook_details = {
events_description: '選擇 Logto 將發送 POST 請求的觸發事件。',
name: '名稱',
endpoint_url: '端點 URL',
endpoint_url_tip: '輸入 HTTPS URL用於 webhook 負載的事件發生時發送到的端點。',
signing_key: '簽名密鑰',
signing_key_tip:
'添加 Logto 提供的秘密金鑰作為請求標題至您的端點,以確保 webhook 負載的真實性。',

View file

@ -29,11 +29,11 @@ const webhooks = {
name_placeholder: '輸入 webhook 名稱',
endpoint_url: 'Endpoint URL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
'輸入 Webhook 要發送到的 HTTPS URL當事件發生時Logto 會將 POST 請求發送到此處,以便收到最新的信息。',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: '創建 Webhook',
missing_event_error: '您必須至少選擇一個事件。',
https_format_error: '出於安全原因,需要 HTTPS 格式。',
},
webhook_created: 'Webhook {{name}} 成功創建。',
};

View file

@ -22,7 +22,6 @@ const webhook_details = {
events_description: '選擇觸發 Logto 發送 POST 請求的觸發器事件。',
name: '名稱',
endpoint_url: '端點 URL',
endpoint_url_tip: '輸入 Webhook 的有效 HTTPS 端點 URL事件發生時會將有效載荷發送到該 URL。',
signing_key: '簽名密鑰',
signing_key_tip:
'將 Logto 提供的密鑰添加到您的端點作為請求標頭,以確保 Webhook 的有效載荷的真實性。',

View file

@ -29,11 +29,11 @@ const webhooks = {
name_placeholder: '輸入 webhook 名稱',
endpoint_url: '端點 URL',
endpoint_url_placeholder: 'https://your.webhook.endpoint.url',
/** UNTRANSLATED */
endpoint_url_tip:
'輸入 Webhook 要發送到的 HTTPS URL當事件發生時Logto 會將 POST 請求發送到此處,以便收到最新的信息。',
'Enter the URL of your endpoint where a webhooks payload is sent to when the event occurs.',
create_webhook: '創建 webhook',
missing_event_error: '您需要選擇至少一個事件。',
https_format_error: 'HTTPS 格式要求為了安全原因。',
},
webhook_created: 'Webhook {{name}} 已成功創建。',
};