diff --git a/docs/developers/webhooks/events.mdx b/docs/developers/webhooks/events.mdx index 78cc9084093..ff108f8ab3f 100644 --- a/docs/developers/webhooks/events.mdx +++ b/docs/developers/webhooks/events.mdx @@ -116,9 +116,9 @@ This guide list the different Logto webhook events and explains when each event | User password reset | User.Data.Updated | | User registration | User.Created | -## Exception hook events +## Exception hook events \{#exception-hook-events} -### Security +### Security \{#security} | Event type | Description | | ------------------ | ----------------------------------------------------------------- | diff --git a/docs/developers/webhooks/request.mdx b/docs/developers/webhooks/request.mdx index db971629ef9..5790db7a553 100644 --- a/docs/developers/webhooks/request.mdx +++ b/docs/developers/webhooks/request.mdx @@ -214,7 +214,7 @@ type OrganizationScope = { | OrganizationScope.Data.Updated | data | OrganizationScope | | The updated organization scope entity. | | OrganizationScope.Deleted | data | null | / | | -## Exception hook events request body +## Exception hook events request body \{#exception-hook-events-request-body} Available events: `Identifier.Lockout` diff --git a/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index e723e23e9b4..8c8425a51a8 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -7,69 +7,69 @@ sidebar_position: 3 # Webhooks-Ereignisse -Dieser Leitfaden listet die verschiedenen Logto-Webhooks-Ereignisse auf und erklärt, wann jedes Ereignis auftritt. +Dieser Leitfaden listet die verschiedenen Logto Webhook-Ereignisse auf und erklärt, wann jedes Ereignis auftritt. ## Benutzerinteraktions-Hook-Ereignisse \{#user-interaction-hook-events} -| Ereignistyp | Beschreibung | -| ----------------- | ------------------------------------------------------------------------------------------------ | -| PostRegister | Ein Benutzer erstellt erfolgreich ein neues Konto über die Benutzeroberfläche. | -| PostSignIn | Ein Benutzer meldet sich erfolgreich über die Benutzeroberfläche an. | -| PostResetPassword | Das Passwort eines Benutzers wird erfolgreich über den "Passwort vergessen"-Fluss zurückgesetzt. | +| Ereignistyp | Beschreibung | +| ----------------- | ------------------------------------------------------------------------------------------------- | +| PostRegister | Ein Benutzer erstellt erfolgreich ein neues Konto über die UI-Oberfläche. | +| PostSignIn | Ein Benutzer meldet sich erfolgreich über die UI-Oberfläche an. | +| PostResetPassword | Das Passwort eines Benutzers wird erfolgreich über den „Passwort vergessen“-Ablauf zurückgesetzt. | -## Datenänderungs-Hook-Ereignisse \{#data-mutation-hook-events} +## Datenmutations-Hook-Ereignisse \{#data-mutation-hook-events} ### Benutzer \{#user} -| Ereignistyp | Beschreibung | -| ----------------------------- | ------------------------------------------------------------------------------------------ | -| User.Created | Ein neues Benutzerkonto wird erstellt. | -| User.Deleted | Ein Benutzerkonto wird gelöscht. | -| User.Data.Updated | Benutzerdaten werden aktualisiert, z.B. E-Mail, Avatar, custom.data, soziale Kennung, etc. | -| User.SuspensionStatus.Updated | Der Sperrstatus eines Benutzers wird geändert (gesperrt oder reaktiviert). | +| Ereignistyp | Beschreibung | +| ----------------------------- | -------------------------------------------------------------------------------------------- | +| User.Created | Ein neues Benutzerkonto wird erstellt. | +| User.Deleted | Ein Benutzerkonto wird gelöscht. | +| User.Data.Updated | Benutzerdaten werden aktualisiert, z. B. E-Mail, Avatar, custom.data, Social-Identifier usw. | +| User.SuspensionStatus.Updated | Der Sperrstatus eines Benutzers wird geändert (gesperrt oder reaktiviert). | ### Rolle \{#role} -| Ereignistyp | Beschreibung | -| ------------------- | -------------------------------------------------------------------------------------------------- | -| Role.Created | Eine neue Rolle wird erstellt. | -| Role.Deleted | Eine Rolle wird gelöscht. | -| Role.Data.Updated | Die Daten einer Rolle werden aktualisiert, z.B. Rollenname, Beschreibung und Standardrollenstatus. | -| Role.Scopes.Updated | Berechtigungen, die einer Rolle zugewiesen sind, werden hinzugefügt oder entfernt. | +| Ereignistyp | Beschreibung | +| ------------------- | --------------------------------------------------------------------------------------------- | +| Role.Created | Eine neue Rolle wird erstellt. | +| Role.Deleted | Eine Rolle wird gelöscht. | +| Role.Data.Updated | Die Daten einer Rolle werden aktualisiert, z. B. Rollenname, Beschreibung und Standardstatus. | +| Role.Scopes.Updated | Berechtigungen, die einer Rolle zugewiesen sind, werden hinzugefügt oder entfernt. | -### Berechtigung (Scope) \{#permission-scope} +### Berechtigung (Berechtigung) \{#permission-scope} -| Ereignistyp | Beschreibung | -| ------------------ | ------------------------------------------------------------------------------------- | -| Scope.Created | Eine neue API-Berechtigung wird erstellt. | -| Scope.Deleted | Eine API-Berechtigung wird gelöscht. | -| Scope.Data.Updated | Die Daten einer API-Berechtigung werden aktualisiert, z.B. Berechtigungsbeschreibung. | +| Ereignistyp | Beschreibung | +| ------------------ | ------------------------------------------------------------------------- | +| Scope.Created | Eine neue API-Berechtigung wird erstellt. | +| Scope.Deleted | Eine API-Berechtigung wird gelöscht. | +| Scope.Data.Updated | Die Daten einer API-Berechtigung werden aktualisiert, z. B. Beschreibung. | ### Organisation \{#organization} -| Ereignistyp | Beschreibung | -| ------------------------------- | --------------------------------------------------------------------------------------------------------- | -| Organization.Created | Eine neue Organisation wird erstellt. | -| Organization.Deleted | Eine Organisation wird gelöscht. | -| Organization.Data.Updated | Die Daten einer Organisation werden aktualisiert, z.B. Organisationsname, Beschreibung, custom.data, etc. | -| Organization.Membership.Updated | Mitglieder werden zu einer Organisation hinzugefügt oder entfernt. | +| Ereignistyp | Beschreibung | +| ------------------------------- | -------------------------------------------------------------------------------------------- | +| Organization.Created | Eine neue Organisation wird erstellt. | +| Organization.Deleted | Eine Organisation wird gelöscht. | +| Organization.Data.Updated | Die Daten einer Organisation werden aktualisiert, z. B. Name, Beschreibung, custom.data usw. | +| Organization.Membership.Updated | Mitglieder werden zu einer Organisation hinzugefügt oder entfernt. | ### Organisationsrolle \{#organization-role} -| Ereignistyp | Beschreibung | -| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -| OrganizationRole.Created | Eine neue Organisationsrolle wird erstellt. | -| OrganizationRole.Deleted | Eine Organisationsrolle wird gelöscht. | -| OrganizationRole.Data.Updated | Die Daten einer Organisationsrolle werden aktualisiert, z.B. Organisationsrollenname und Beschreibung. | -| OrganizationRole.Scopes.Updated | Berechtigungen, die einer Organisationsrolle zugewiesen sind, werden hinzugefügt oder entfernt. | +| Ereignistyp | Beschreibung | +| ------------------------------- | ----------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | Eine neue Organisationsrolle wird erstellt. | +| OrganizationRole.Deleted | Eine Organisationsrolle wird gelöscht. | +| OrganizationRole.Data.Updated | Die Daten einer Organisationsrolle werden aktualisiert, z. B. Name und Beschreibung. | +| OrganizationRole.Scopes.Updated | Berechtigungen, die einer Organisationsrolle zugewiesen sind, werden hinzugefügt oder entfernt. | -### Organisationsberechtigung (Scope) \{#organization-permission-scope} +### Organisationsberechtigung (Berechtigung) \{#organization-permission-scope} -| Ereignistyp | Beschreibung | -| ------------------------------ | ----------------------------------------------------------------------------------------------------------- | -| OrganizationScope.Created | Eine neue Organisationsberechtigung wird erstellt. | -| OrganizationScope.Deleted | Eine Organisationsberechtigung wird gelöscht. | -| OrganizationScope.Data.Updated | Die Daten einer Organisationsberechtigung werden aktualisiert, z.B. Organisationsberechtigungsbeschreibung. | +| Ereignistyp | Beschreibung | +| ------------------------------ | ---------------------------------------------------------------------------------------------------------------- | +| OrganizationScope.Created | Eine neue Organisationsberechtigung wird erstellt. | +| OrganizationScope.Deleted | Eine Organisationsberechtigung wird gelöscht. | +| OrganizationScope.Data.Updated | Die Daten einer Organisationsberechtigung werden aktualisiert, z. B. Beschreibung der Organisationsberechtigung. | ### Management API ausgelöste Ereignisse \{#management-api-triggered-events} @@ -110,12 +110,20 @@ Dieser Leitfaden listet die verschiedenen Logto-Webhooks-Ereignisse auf und erkl | Benutzerinteraktionsaktion | Ereignis | | ----------------------------------- | ----------------- | -| Benutzer-E-Mail/Telefon-Verknüpfung | User.Data.Updated | -| Benutzer-MFAs-Verknüpfung | User.Data.Updated | -| Benutzer-Soziale/SSO-Verknüpfung | User.Data.Updated | -| Benutzer-Passwortzurücksetzung | User.Data.Updated | +| Benutzer E-Mail/Telefon-Verknüpfung | User.Data.Updated | +| Benutzer MFA-Verknüpfung | User.Data.Updated | +| Benutzer Social/SSO-Verknüpfung | User.Data.Updated | +| Benutzer Passwort zurücksetzen | User.Data.Updated | | Benutzerregistrierung | User.Created | +## Ausnahme-Hook-Ereignisse \{#exception-hook-events} + +### Sicherheit \{#security} + +| Ereignistyp | Beschreibung | +| ------------------ | ----------------------------------------------------------------------------------- | +| Identifier.Lockout | Ein Benutzerkonto wird aufgrund mehrerer fehlgeschlagener Anmeldeversuche gesperrt. | + ## FAQs \{#faqs}
@@ -125,6 +133,6 @@ Dieser Leitfaden listet die verschiedenen Logto-Webhooks-Ereignisse auf und erkl -`PostRegister` wird ausgelöst, wenn ein Benutzer erfolgreich ein neues Konto über den Benutzeranmeldefluss erstellt; `User.Created` wird ausgelöst, wenn ein neues Benutzerkonto über die Management API erstellt wird. +`PostRegister` wird ausgelöst, wenn ein Benutzer erfolgreich ein neues Konto über den Benutzerregistrierungsablauf erstellt; `User.Created` wird ausgelöst, wenn ein neues Benutzerkonto über die Management API erstellt wird.
diff --git a/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index ed0dc17f305..2fb794fcc0b 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/de/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -7,23 +7,23 @@ sidebar_position: 4 # Webhooks-Anfrage -Sobald ein gültiges Hook-Ereignis ausgelöst wird, sucht Logto nach entsprechenden Webhooks und sendet eine POST-Anfrage pro Hook-Konfiguration. +Sobald ein gültiges Hook-Ereignis ausgelöst wird, sucht Logto die entsprechenden Webhooks und sendet pro Hook-Konfiguration eine POST-Anfrage. ## Anfrage-Header \{#request-headers} -| Schlüssel | Anpassbar | Anmerkungen | -| ----------------------- | --------- | -------------------------------------------------------------------------------------------------------- | -| user-agent | ✅ | Standardmäßig `Logto (https://logto.io/)`. | -| content-type | ✅ | Standardmäßig `application/json`. | -| logto-signature-sha-256 | | Die Signatur des Anfragetextes, siehe [Sicherung deiner Webhooks](/developers/webhooks/secure-webhooks). | +| Key | Anpassbar | Hinweise | +| ----------------------- | --------- | ------------------------------------------------------------------------------------------------- | +| user-agent | ✅ | Standardmäßig `Logto (https://logto.io/)`. | +| content-type | ✅ | Standardmäßig `application/json`. | +| logto-signature-sha-256 | | Die Signatur des Anfrage-Bodys, siehe [Webhooks absichern](/developers/webhooks/secure-webhooks). | -Du kannst anpassbare Header überschreiben, indem du die [Anfrage-Header anpasst](/developers/webhooks/configure-webhooks/#secure-webhook) mit demselben Schlüssel. +Du kannst anpassbare Header überschreiben, indem du [Anfrage-Header anpasst](/developers/webhooks/configure-webhooks/#secure-webhook) mit dem gleichen Schlüssel. -## Anfragetext für Interaktions-Hook-Ereignisse \{#interaction-hook-events-request-body} +## Interaction-Hook-Events Anfrage-Body \{#interaction-hook-events-request-body} Verfügbare Ereignisse: `PostRegister`, `PostSignIn`, `PostResetPassword` -Der Anfragetext ist ein JSON-Objekt, das drei Arten von Datenfeldern enthält: +Der Anfrage-Body ist ein JSON-Objekt, das drei Arten von Datenfeldern enthält: ```tsx type UserEntity = { @@ -43,84 +43,94 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| Feld | Typ | Optional | Anmerkungen | +| Feld | Typ | Optional | Hinweise | | ---------------- | ------------------- | -------- | ------------------------------------------------------------------------------ | -| hookId | `string` | | Der Bezeichner in Logto. | -| event | `string` | | Welches Ereignis diesen Hook auslöst. | -| createdAt | `string` | | Die Erstellungszeit der Nutzlast im ISO-Format. | +| hookId | `string` | | Die Kennung in Logto. | +| event | `string` | | Das Ereignis, das diesen Hook auslöst. | +| createdAt | `string` | | Das Erstellungsdatum der Nutzlast im ISO-Format. | | interactionEvent | `string` | | Das Interaktionsereignis, das diesen Hook auslöst. | -| sessionId | `string` | ✅ | Die Sitzungs-ID (nicht Interaktions-ID) für dieses Ereignis, falls zutreffend. | +| sessionId | `string` | ✅ | Die Session-ID (nicht Interaction-ID) für dieses Ereignis, falls zutreffend. | | userAgent | `string` | ✅ | Der User-Agent für die Anfrage, die diesen Hook auslöst. | | userIp | `string` | ✅ | Die IP-Adresse für die Anfrage, die diesen Hook auslöst. | | userId | `string` | ✅ | Die zugehörige Benutzer-ID für dieses Ereignis, falls zutreffend. | -| user | `UserEntity` | ✅ | Die zugehörige Benutzerentität für dieses Ereignis, falls zutreffend. | +| user | `UserEntity` | ✅ | Die zugehörige Benutzer-Entität für dieses Ereignis, falls zutreffend. | | applicationId | `string` | ✅ | Die zugehörige Anwendungs-ID für dieses Ereignis, falls zutreffend. | | application | `ApplicationEntity` | ✅ | Die zugehörigen Anwendungsinformationen für dieses Ereignis, falls zutreffend. | -Siehe [Benutzer](/user-management/user-data) und [Anwendungen](/integrate-logto/application-data-structure) Referenz für detaillierte Felderklärungen. +Siehe [Benutzer](/user-management/user-data) und [Anwendungen](/integrate-logto/application-data-structure) für detaillierte Feldbeschreibungen. -## Anfragetext für Datenmutations-Hook-Ereignisse \{#data-mutation-hook-events-request-body} +## Datenmutations-Hook-Events Anfrage-Body \{#data-mutation-hook-events-request-body} -### Standard-Anfragetextfelder \{#standard-request-body-fields} +### Standard-Anfrage-Body-Felder \{#standard-request-body-fields} -| Feld | Typ | Optional | Anmerkungen | -| --------- | -------- | -------- | ----------------------------------------------- | -| hookId | `string` | | Der Bezeichner in Logto. | -| event | `string` | | Welches Ereignis diesen Hook auslöst. | -| createdAt | `string` | | Die Erstellungszeit der Nutzlast im ISO-Format. | -| userAgent | `string` | ✅ | Der User-Agent für die Anfrage. | -| ip | `string` | ✅ | Die IP-Adresse für die Anfrage. | +| Feld | Typ | Optional | Hinweise | +| --------- | -------- | -------- | ------------------------------------------------ | +| hookId | `string` | | Die Kennung in Logto. | +| event | `string` | | Das Ereignis, das diesen Hook auslöst. | +| createdAt | `string` | | Das Erstellungsdatum der Nutzlast im ISO-Format. | +| userAgent | `string` | ✅ | Der User-Agent für die Anfrage. | +| ip | `string` | ✅ | Die IP-Adresse für die Anfrage. | -### Interaktions-API-Kontextfelder \{#interaction-api-context-body-fields} +### Interaction-API-Kontext-Body-Felder \{#interaction-api-context-body-fields} -Datenmutations-Hook-Ereignisse, die durch Benutzerinteraktions-API-Aufrufe ausgelöst werden. +Datenmutations-Hook-Events, die durch Benutzer-Interaktions-API-Aufrufe ausgelöst werden. Verfügbare Ereignisse: `User.Created`, `User.Data.Updated` -| Feld | Typ | Optional | Anmerkungen | +| Feld | Typ | Optional | Hinweise | | ---------------- | ------------------- | -------- | ------------------------------------------------------------------------------ | | interactionEvent | `string` | ✅ | Das Interaktionsereignis, das diesen Hook auslöst. | -| sessionId | `string` | ✅ | Die Sitzungs-ID (nicht Interaktions-ID) für dieses Ereignis, falls zutreffend. | +| sessionId | `string` | ✅ | Die Session-ID (nicht Interaction-ID) für dieses Ereignis, falls zutreffend. | | applicationId | `string` | ✅ | Die zugehörige Anwendungs-ID für dieses Ereignis, falls zutreffend. | | application | `ApplicationEntity` | ✅ | Die zugehörigen Anwendungsinformationen für dieses Ereignis, falls zutreffend. | -### Management-API-Kontextfelder \{#management-api-context-body-fields} +### Management-API-Kontext-Body-Felder \{#management-api-context-body-fields} -Datenmutations-Hook-Ereignisse, die durch Management-API-Aufrufe ausgelöst werden. +Datenmutations-Hook-Events, die durch Management API-Aufrufe ausgelöst werden. -| Feld | Typ | Optional | Anmerkungen | -| ------------ | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -| path | `string` | ✅ | Der Pfad des API-Aufrufs, der diesen Hook auslöst. | -| method | `string` | ✅ | Die Methode des API-Aufrufs, der diesen Hook auslöst. | -| status | `number` | ✅ | Der Antwortstatuscode des API-Aufrufs, der diesen Hook auslöst. | -| params | `object` | ✅ | Die Anfrage-Koa-Pfadparameter des API-Aufrufs, der diesen Hook auslöst. | -| matchedRoute | `string` | ✅ | Die Koa-übereinstimmende Route des API-Aufrufs, der diesen Hook auslöst. Logto verwendet dieses Feld, um die aktivierten Hook-Ereignisse zuzuordnen. | +| Feld | Typ | Optional | Hinweise | +| ------------ | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| path | `string` | ✅ | Der Pfad des API-Aufrufs, der diesen Hook auslöst. | +| method | `string` | ✅ | Die Methode des API-Aufrufs, der diesen Hook auslöst. | +| status | `number` | ✅ | Der Antwort-Statuscode des API-Aufrufs, der diesen Hook auslöst. | +| params | `object` | ✅ | Die Koa-Pfad-Parameter des API-Aufrufs, der diesen Hook auslöst. | +| matchedRoute | `string` | ✅ | Die Koa-Matched-Route des API-Aufrufs, der diesen Hook auslöst. Logto verwendet dieses Feld, um die aktivierten Hook-Events zuzuordnen. | -### Daten-Nutzlastfelder \{#data-payload-body-fields} +### Daten-Payload-Body-Felder \{#data-payload-body-fields} -**Benutzerereignisse** +**Benutzer-Ereignisse** -| Ereignis | Feld | Typ | Optional | Anmerkungen | -| ----------------- | ---- | ---------- | -------- | ------------------------------------------------------ | -| User.Created | data | UserEntity | | Die erstellte Benutzerentität für dieses Ereignis. | -| User.Data.Updated | data | UserEntity | | Die aktualisierte Benutzerentität für dieses Ereignis. | -| User.Deleted | data | null | / | | +| Ereignis | Feld | Typ | Optional | Hinweise | +| ----------------- | ---- | ---------- | -------- | ------------------------------------------------------- | +| User.Created | data | UserEntity | | Die erstellte Benutzer-Entität für dieses Ereignis. | +| User.Data.Updated | data | UserEntity | | Die aktualisierte Benutzer-Entität für dieses Ereignis. | +| User.Deleted | data | null | / | | -**Rollenereignisse** +**Rollen-Ereignisse** ```tsx type Role = { id: string; name: string; description: string; - type: 'User' / 'MachineToMachine'; + type: 'User' | 'MachineToMachine'; isDefault: boolean; }; ``` @@ -135,23 +145,23 @@ type Scope = { }; ``` -| Ereignis | Feld | Typ | Optional | Anmerkungen | -| ------------------ | ------ | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Role.Created | data | Role | | Die erstellte Rollenentität für dieses Ereignis. | -| Role.Data.Updated | data | Role | | Die aktualisierte Rollenentität für dieses Ereignis. | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | Die aktualisierten Berechtigungen, die der Rolle zugewiesen sind. | -| Role.Scope.Updated | roleId | string | ✅ | Die Rollen-ID, der Berechtigungen zugewiesen sind. (Nur verfügbar, wenn das Ereignis durch das Erstellen einer neuen Rolle mit vorab zugewiesenen Berechtigungen ausgelöst wurde) | +| Ereignis | Feld | Typ | Optional | Hinweise | +| ------------------ | ------ | ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Role.Created | data | Rolle (Role) | | Die erstellte Rollen-Entität für dieses Ereignis. | +| Role.Data.Updated | data | Rolle (Role) | | Die aktualisierte Rollen-Entität für dieses Ereignis. | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | Die aktualisierten Berechtigungen (Scopes), die der Rolle zugewiesen sind. | +| Role.Scope.Updated | roleId | string | ✅ | Die Rollen-ID, der Berechtigungen zugewiesen sind. (Nur verfügbar, wenn das Ereignis durch das Erstellen einer neuen Rolle mit vorab zugewiesenen Berechtigungen ausgelöst wurde) | -**Berechtigungsereignisse (Scope)** +**Berechtigungs- (Scope-) Ereignisse** -| Ereignis | Feld | Typ | Optional | Anmerkungen | -| ------------------ | ---- | ----- | -------- | ----------------------------------------------------------- | -| Scope.Created | data | Scope | | Die erstellte Berechtigungsentität für dieses Ereignis. | -| Scope.Data.Updated | data | Scope | | Die aktualisierte Berechtigungsentität für dieses Ereignis. | -| Scope.Deleted | data | null | / | | +| Ereignis | Feld | Typ | Optional | Hinweise | +| ------------------ | ---- | ----- | -------- | ------------------------------------------------------------ | +| Scope.Created | data | Scope | | Die erstellte Berechtigungs-Entität für dieses Ereignis. | +| Scope.Data.Updated | data | Scope | | Die aktualisierte Berechtigungs-Entität für dieses Ereignis. | +| Scope.Deleted | data | null | / | | -**Organisationsereignisse** +**Organisations-Ereignisse** ```tsx type Organization = { @@ -163,14 +173,14 @@ type Organization = { }; ``` -| Ereignis | Feld | Typ | Optional | Anmerkungen | -| ------------------------------- | ---- | ------------ | -------- | ----------------------------------------------------------- | -| Organization.Created | data | Organization | | Die erstellte Organisationsentität für dieses Ereignis. | -| Organization.Data.Updated | data | Organization | | Die aktualisierte Organisationsentität für dieses Ereignis. | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| Ereignis | Feld | Typ | Optional | Hinweise | +| ------------------------------- | ---- | --------------------------- | -------- | ------------------------------------------------------------ | +| Organization.Created | data | Organisation (Organization) | | Die erstellte Organisations-Entität für dieses Ereignis. | +| Organization.Data.Updated | data | Organisation (Organization) | | Die aktualisierte Organisations-Entität für dieses Ereignis. | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | -**Organisationsrollenereignisse** +**OrganisationRollen-Ereignisse** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Ereignis | Feld | Typ | Optional | Anmerkungen | +| Ereignis | Feld | Typ | Optional | Hinweise | | ------------------------------ | ------------------ | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | Die erstellte Organisationsrollenentität für dieses Ereignis. | -| OrganizationRole.Data.Updated | data | OrganizationRole | | Die aktualisierte Organisationsrollenentität für dieses Ereignis. | +| OrganizationRole.Created | data | OrganizationRole | | Die erstellte Organisationsrollen-Entität für dieses Ereignis. | +| OrganizationRole.Data.Updated | data | OrganizationRole | | Die aktualisierte Organisationsrollen-Entität für dieses Ereignis. | | OrganizationRole.Deleted | data | null | / | | | OrganizationRole.Scope.Updated | data | null | / | | | OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | Die Rollen-ID, der Berechtigungen zugewiesen sind. (Nur verfügbar, wenn das Ereignis durch das Erstellen einer neuen Rolle mit vorab zugewiesenen Berechtigungen ausgelöst wurde) | -**Organisationsberechtigungsereignisse (OrganizationScope)** +**Organisationsberechtigungs- (OrganizationScope-) Ereignisse** + +| Ereignis | Feld | Typ | Optional | Hinweise | +| ------------------------------ | ---- | ----------------- | -------- | ----------------------------------------------------- | +| OrganizationScope.Created | data | OrganizationScope | | Die erstellte Organisationsberechtigungs-Entität. | +| OrganizationScope.Data.Updated | data | OrganizationScope | | Die aktualisierte Organisationsberechtigungs-Entität. | +| OrganizationScope.Deleted | data | null | / | | + +## Ausnahme-Hook-Events Anfrage-Body \{#exception-hook-events-request-body} + +Verfügbare Ereignisse: `Identifier.Lockout` + +Der Anfrage-Body ist ein JSON-Objekt, das die Standard-Anfrage-Body-Felder und zusätzliche Felder wie unten enthält: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` -| Ereignis | Feld | Typ | Optional | Anmerkungen | -| ------------------------------ | ---- | ----------------- | -------- | ---------------------------------------------------- | -| OrganizationScope.Created | data | OrganizationScope | | Die erstellte Organisationsberechtigungsentität. | -| OrganizationScope.Data.Updated | data | OrganizationScope | | Die aktualisierte Organisationsberechtigungsentität. | -| OrganizationScope.Deleted | data | null | / | | +| Feld | Typ | Optional | Hinweise | +| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------------ | +| hookId | `string` | | Die Kennung in Logto. | +| event | `string` | | Das Ereignis, das diesen Hook auslöst. | +| createdAt | `string` | | Das Erstellungsdatum der Nutzlast im ISO-Format. | +| userAgent | `string` | ✅ | Der User-Agent für die Anfrage. | +| ip | `string` | ✅ | Die IP-Adresse für die Anfrage. | +| interactionEvent | `string` | ✅ | Das Interaktionsereignis, das diesen Hook auslöst. | +| sessionId | `string` | ✅ | Die Session-ID (nicht Interaction-ID) für dieses Ereignis, falls zutreffend. | +| applicationId | `string` | ✅ | Die zugehörige Anwendungs-ID für dieses Ereignis, falls zutreffend. | +| application | `ApplicationEntity` | ✅ | Die zugehörigen Anwendungsinformationen für dieses Ereignis, falls zutreffend. | +| type | `SignInIdentifier` | | Der Identifikatortyp des Benutzers, z. B. E-Mail, Telefon oder Benutzername. | +| value | `string` | | Der Identifikatorwert des Benutzers, der die Sperrung ausgelöst hat. | diff --git a/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index 739bf2168c3..87a4a90f127 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -9,15 +9,15 @@ sidebar_position: 3 Esta guía enumera los diferentes eventos de webhook de Logto y explica cuándo ocurre cada evento. -## Eventos de interacción del usuario \{#user-interaction-hook-events} +## Eventos de hook de interacción de usuario \{#user-interaction-hook-events} -| Tipo de evento | Descripción | -| ----------------- | ---------------------------------------------------------------------------------------------------- | -| PostRegister | Un usuario crea exitosamente una nueva cuenta a través de la interfaz de usuario. | -| PostSignIn | Un usuario inicia sesión exitosamente a través de la interfaz de usuario. | -| PostResetPassword | La contraseña de un usuario se restablece exitosamente a través del flujo de "Olvidé mi contraseña". | +| Tipo de evento | Descripción | +| ----------------- | --------------------------------------------------------------------------------------------------- | +| PostRegister | Un usuario crea exitosamente una nueva cuenta a través de la interfaz de usuario. | +| PostSignIn | Un usuario inicia sesión exitosamente a través de la interfaz de usuario. | +| PostResetPassword | La contraseña de un usuario se restablece exitosamente mediante el flujo de "Olvidé mi contraseña". | -## Eventos de mutación de datos \{#data-mutation-hook-events} +## Eventos de hook de mutación de datos \{#data-mutation-hook-events} ### Usuario \{#user} @@ -30,12 +30,12 @@ Esta guía enumera los diferentes eventos de webhook de Logto y explica cuándo ### Rol \{#role} -| Tipo de evento | Descripción | -| ------------------- | ----------------------------------------------------------------------------------------------------------- | -| Role.Created | Se crea un nuevo rol. | -| Role.Deleted | Se elimina un rol. | -| Role.Data.Updated | Se actualizan los datos de un rol, por ejemplo, nombre del rol, descripción y estado de rol predeterminado. | -| Role.Scopes.Updated | Se añaden o eliminan permisos asignados a un rol. | +| Tipo de evento | Descripción | +| ------------------- | ------------------------------------------------------------------------------------------------- | +| Role.Created | Se crea un nuevo rol. | +| Role.Deleted | Se elimina un rol. | +| Role.Data.Updated | Se actualizan los datos de un rol, por ejemplo, nombre del rol, descripción y estado por defecto. | +| Role.Scopes.Updated | Se agregan o eliminan permisos asignados a un rol. | ### Permiso (Alcance) \{#permission-scope} @@ -47,23 +47,23 @@ Esta guía enumera los diferentes eventos de webhook de Logto y explica cuándo ### Organización \{#organization} -| Tipo de evento | Descripción | -| ------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| Organization.Created | Se crea una nueva organización. | -| Organization.Deleted | Se elimina una organización. | -| Organization.Data.Updated | Se actualizan los datos de una organización, por ejemplo, nombre de la organización, descripción, custom.data, etc. | -| Organization.Membership.Updated | Se añaden o eliminan miembros de una organización. | +| Tipo de evento | Descripción | +| ------------------------------- | ------------------------------------------------------------------------------------------------ | +| Organization.Created | Se crea una nueva organización. | +| Organization.Deleted | Se elimina una organización. | +| Organization.Data.Updated | Se actualizan los datos de una organización, por ejemplo, nombre, descripción, custom.data, etc. | +| Organization.Membership.Updated | Se agregan o eliminan miembros de una organización. | -### Rol de la organización \{#organization-role} +### Rol de organización \{#organization-role} | Tipo de evento | Descripción | | ------------------------------- | ------------------------------------------------------------------------------------------------------------- | | OrganizationRole.Created | Se crea un nuevo rol de organización. | | OrganizationRole.Deleted | Se elimina un rol de organización. | | OrganizationRole.Data.Updated | Se actualizan los datos de un rol de organización, por ejemplo, nombre y descripción del rol de organización. | -| OrganizationRole.Scopes.Updated | Se añaden o eliminan permisos asignados a un rol de organización. | +| OrganizationRole.Scopes.Updated | Se agregan o eliminan permisos asignados a un rol de organización. | -### Permiso de la organización (alcance) \{#organization-permission-scope} +### Permiso de organización (alcance) \{#organization-permission-scope} | Tipo de evento | Descripción | | ------------------------------ | --------------------------------------------------------------------------------------------------------------- | @@ -71,7 +71,7 @@ Esta guía enumera los diferentes eventos de webhook de Logto y explica cuándo | OrganizationScope.Deleted | Se elimina un permiso de organización. | | OrganizationScope.Data.Updated | Se actualizan los datos de un permiso de organización, por ejemplo, la descripción del permiso de organización. | -### Eventos desencadenados por la Management API \{#management-api-triggered-events} +### Eventos desencadenados por Management API \{#management-api-triggered-events} | Endpoint de API | Evento | | ---------------------------------------------------------- | ----------------------------------------------------------- | @@ -106,15 +106,23 @@ Esta guía enumera los diferentes eventos de webhook de Logto y explica cuándo | POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated | | DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated | -### Eventos desencadenados por la Interaction API \{#interaction-api-triggered-events} +### Eventos desencadenados por Interaction API \{#interaction-api-triggered-events} -| Acción de interacción del usuario | Evento | -| ------------------------------------------------- | ----------------- | -| Enlace de correo electrónico/teléfono del usuario | User.Data.Updated | -| Enlace de MFAs del usuario | User.Data.Updated | -| Enlace social/SSO del usuario | User.Data.Updated | -| Restablecimiento de contraseña del usuario | User.Data.Updated | -| Registro de usuario | User.Created | +| Acción de interacción de usuario | Evento | +| ----------------------------------------- | ----------------- | +| Enlace de correo/teléfono de usuario | User.Data.Updated | +| Enlace de MFA de usuario | User.Data.Updated | +| Enlace social/SSO de usuario | User.Data.Updated | +| Restablecimiento de contraseña de usuario | User.Data.Updated | +| Registro de usuario | User.Created | + +## Eventos de hook de excepción \{#exception-hook-events} + +### Seguridad \{#security} + +| Tipo de evento | Descripción | +| ------------------ | ------------------------------------------------------------------------------------------ | +| Identifier.Lockout | Una cuenta de usuario se bloquea debido a múltiples intentos fallidos de inicio de sesión. | ## Preguntas frecuentes \{#faqs} diff --git a/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 6e7a71bacf8..2c78eebcb1a 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/es/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -1,25 +1,25 @@ --- id: webhooks-request -title: Webhooks request -sidebar_label: Webhooks request +title: Solicitud de Webhooks (Webhooks request) +sidebar_label: Solicitud de Webhooks (Webhooks request) sidebar_position: 4 --- -# Solicitud de Webhooks +# Solicitud de Webhooks (Webhooks request) -Una vez que se emite un evento de hook válido, Logto encontrará los webhooks correspondientes y enviará una solicitud POST por cada configuración de hook. +Una vez que se emite un evento de hook válido, Logto buscará los webhooks correspondientes y enviará una solicitud POST por cada configuración de hook. ## Encabezados de la solicitud \{#request-headers} -| Clave | Personalizable | Notas | -| ----------------------- | -------------- | -------------------------------------------------------------------------------------------------------------- | -| user-agent | ✅ | `Logto (https://logto.io/)` por defecto. | -| content-type | ✅ | `application/json` por defecto. | -| logto-signature-sha-256 | | la firma del cuerpo de la solicitud, consulta [asegurando tus webhooks](/developers/webhooks/secure-webhooks). | +| Key | Personalizable | Notas | +| ----------------------- | -------------- | ----------------------------------------------------------------------------------------------------------- | +| user-agent | ✅ | `Logto (https://logto.io/)` por defecto. | +| content-type | ✅ | `application/json` por defecto. | +| logto-signature-sha-256 | | la firma del cuerpo de la solicitud, consulta [asegura tus webhooks](/developers/webhooks/secure-webhooks). | -Puedes sobrescribir los encabezados personalizables [personalizando la solicitud](/developers/webhooks/configure-webhooks/#secure-webhook) con la misma clave. +Puedes sobrescribir los encabezados personalizables [personalizando los encabezados de la solicitud](/developers/webhooks/configure-webhooks/#secure-webhook) con la misma clave. -## Cuerpo de la solicitud de eventos de hook de interacción \{#interaction-hook-events-request-body} +## Cuerpo de la solicitud de eventos de interaction hook \{#interaction-hook-events-request-body} Eventos disponibles: `PostRegister`, `PostSignIn`, `PostResetPassword` @@ -43,67 +43,77 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| Campo | Tipo | Opcional | Notas | -| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------------- | -| hookId | `string` | | El identificador en Logto. | -| event | `string` | | Qué evento desencadena este hook. | -| createdAt | `string` | | La hora de creación del payload en formato ISO. | -| interactionEvent | `string` | | El evento de interacción que desencadena este hook. | -| sessionId | `string` | ✅ | El ID de la sesión (no el ID de interacción) para este evento, si es aplicable. | -| userAgent | `string` | ✅ | El user-agent para la solicitud que desencadena este hook. | -| userIp | `string` | ✅ | La dirección IP para la solicitud que desencadena este hook. | -| userId | `string` | ✅ | El ID de usuario relacionado para este evento, si es aplicable. | -| user | `UserEntity` | ✅ | La entidad de usuario relacionada para este evento, si es aplicable. | -| applicationId | `string` | ✅ | El ID de aplicación relacionado para este evento, si es aplicable. | -| application | `ApplicationEntity` | ✅ | La información de la aplicación relacionada para este evento, si es aplicable. | +| Campo | Tipo | Opcional | Notas | +| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------ | +| hookId | `string` | | El identificador en Logto. | +| event | `string` | | Qué evento dispara este hook. | +| createdAt | `string` | | La fecha de creación del payload en formato ISO. | +| interactionEvent | `string` | | El evento de interacción que dispara este hook. | +| sessionId | `string` | ✅ | El ID de sesión (no el ID de interacción) para este evento, si aplica. | +| userAgent | `string` | ✅ | El user-agent de la solicitud que dispara este hook. | +| userIp | `string` | ✅ | La dirección IP de la solicitud que dispara este hook. | +| userId | `string` | ✅ | El ID de usuario relacionado para este evento, si aplica. | +| user | `UserEntity` | ✅ | La entidad de usuario relacionada para este evento, si aplica. | +| applicationId | `string` | ✅ | El ID de aplicación relacionado para este evento, si aplica. | +| application | `ApplicationEntity` | ✅ | La información de la aplicación relacionada para este evento, si aplica. | -Consulta las referencias de [Usuarios](/user-management/user-data) y [Aplicaciones](/integrate-logto/application-data-structure) para explicaciones detalladas de los campos. +Consulta la referencia de [Usuarios](/user-management/user-data) y [Aplicaciones](/integrate-logto/application-data-structure) para explicaciones detalladas de los campos. -## Cuerpo de la solicitud de eventos de mutación de datos \{#data-mutation-hook-events-request-body} +## Cuerpo de la solicitud de eventos de data mutation hook \{#data-mutation-hook-events-request-body} ### Campos estándar del cuerpo de la solicitud \{#standard-request-body-fields} -| Campo | Tipo | Opcional | Notas | -| --------- | -------- | -------- | ----------------------------------------------- | -| hookId | `string` | | El identificador en Logto. | -| event | `string` | | Qué evento desencadena este hook. | -| createdAt | `string` | | La hora de creación del payload en formato ISO. | -| userAgent | `string` | ✅ | El user-agent para la solicitud. | -| ip | `string` | ✅ | La dirección IP para la solicitud. | +| Campo | Tipo | Opcional | Notas | +| --------- | -------- | -------- | ------------------------------------------------ | +| hookId | `string` | | El identificador en Logto. | +| event | `string` | | Qué evento dispara este hook. | +| createdAt | `string` | | La fecha de creación del payload en formato ISO. | +| userAgent | `string` | ✅ | El user-agent de la solicitud. | +| ip | `string` | ✅ | La dirección IP de la solicitud. | -### Campos del cuerpo del contexto de la API de interacción \{#interaction-api-context-body-fields} +### Campos del cuerpo de contexto de Interaction API \{#interaction-api-context-body-fields} -Eventos de mutación de datos que son desencadenados por llamadas a la API de interacción de usuario. +Eventos de data mutation hook que son disparados por llamadas a la API de interacción de usuario. Eventos disponibles: `User.Created`, `User.Data.Updated` -| Campo | Tipo | Opcional | Notas | -| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------------- | -| interactionEvent | `string` | ✅ | El evento de interacción que desencadena este hook. | -| sessionId | `string` | ✅ | El ID de la sesión (no el ID de interacción) para este evento, si es aplicable. | -| applicationId | `string` | ✅ | El ID de aplicación relacionado para este evento, si es aplicable. | -| application | `ApplicationEntity` | ✅ | La información de la aplicación relacionada para este evento, si es aplicable. | +| Campo | Tipo | Opcional | Notas | +| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------ | +| interactionEvent | `string` | ✅ | El evento de interacción que dispara este hook. | +| sessionId | `string` | ✅ | El ID de sesión (no el ID de interacción) para este evento, si aplica. | +| applicationId | `string` | ✅ | El ID de aplicación relacionado para este evento, si aplica. | +| application | `ApplicationEntity` | ✅ | La información de la aplicación relacionada para este evento, si aplica. | -### Campos del cuerpo del contexto de la Management API \{#management-api-context-body-fields} +### Campos del cuerpo de contexto de Management API \{#management-api-context-body-fields} -Eventos de mutación de datos que son desencadenados por llamadas a la Management API. +Eventos de data mutation hook que son disparados por llamadas a la Management API. -| Campo | Tipo | Opcional | Notas | -| ------------ | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -| path | `string` | ✅ | La ruta de la llamada API que desencadena este hook. | -| method | `string` | ✅ | El método de la llamada API que desencadena este hook. | -| status | `number` | ✅ | El código de estado de respuesta de la llamada API que desencadena este hook. | -| params | `object` | ✅ | Los parámetros de ruta koa de la solicitud de la llamada API que desencadena este hook. | -| matchedRoute | `string` | ✅ | La ruta coincidente de koa de la llamada API que desencadena este hook. Logto utiliza este campo para coincidir con los eventos de hook habilitados. | +| Campo | Tipo | Opcional | Notas | +| ------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | +| path | `string` | ✅ | La ruta de la llamada a la API que dispara este hook. | +| method | `string` | ✅ | El método de la llamada a la API que dispara este hook. | +| status | `number` | ✅ | El código de estado de la respuesta de la llamada a la API que dispara este hook. | +| params | `object` | ✅ | Los parámetros de ruta koa de la solicitud de la API que dispara este hook. | +| matchedRoute | `string` | ✅ | La ruta koa coincidente de la llamada a la API que dispara este hook. Logto usa este campo para emparejar los eventos habilitados de hook. | -### Campos del cuerpo del payload de datos \{#data-payload-body-fields} +### Campos del cuerpo de datos del payload \{#data-payload-body-fields} **Eventos de usuario** @@ -113,7 +123,7 @@ Eventos de mutación de datos que son desencadenados por llamadas a la Managemen | User.Data.Updated | data | UserEntity | | La entidad de usuario actualizada para este evento. | | User.Deleted | data | null | / | | -**Eventos de rol** +**Eventos de rol (Role)** ```tsx type Role = { @@ -135,15 +145,15 @@ type Scope = { }; ``` -| Evento | Campo | Tipo | Opcional | Notas | -| ------------------ | ------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Role.Created | data | Role | | La entidad de rol creada para este evento. | -| Role.Data.Updated | data | Role | | La entidad de rol actualizada para este evento. | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | Los alcances actualizados asignados al rol. | -| Role.Scope.Updated | roleId | string | ✅ | El ID del rol al que se asignan los alcances. (Solo disponible cuando el evento fue desencadenado por la creación de un nuevo rol con alcances preasignados) | +| Evento | Campo | Tipo | Opcional | Notas | +| ------------------ | ------ | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Role.Created | data | Role | | La entidad de rol creada para este evento. | +| Role.Data.Updated | data | Role | | La entidad de rol actualizada para este evento. | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | Los alcances (scopes) actualizados asignados al rol. | +| Role.Scope.Updated | roleId | string | ✅ | El ID del rol al que se asignan los alcances. (Solo disponible cuando el evento fue disparado por la creación de un nuevo rol con alcances preasignados) | -**Eventos de permiso (alcance)** +**Eventos de permiso (Scope)** | Evento | Campo | Tipo | Opcional | Notas | | ------------------ | ----- | ----- | -------- | --------------------------------------------------- | @@ -151,7 +161,7 @@ type Scope = { | Scope.Data.Updated | data | Scope | | La entidad de alcance actualizada para este evento. | | Scope.Deleted | data | null | / | | -**Eventos de organización** +**Eventos de organización (Organization)** ```tsx type Organization = { @@ -170,7 +180,7 @@ type Organization = { | Organization.Deleted | data | null | / | | | Organization.Membership.Updated | data | null | / | | -**Eventos de rol de organización** +**Eventos de OrganizationRole** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Evento | Campo | Tipo | Opcional | Notas | -| ------------------------------ | ------------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| OrganizationRole.Created | data | OrganizationRole | | La entidad de rol de organización creada para este evento. | -| OrganizationRole.Data.Updated | data | OrganizationRole | | La entidad de rol de organización actualizada para este evento. | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | El ID del rol al que se asignan los alcances. (Solo disponible cuando el evento fue desencadenado por la creación de un nuevo rol con alcances preasignados) | +| Evento | Campo | Tipo | Opcional | Notas | +| ------------------------------ | ------------------ | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | data | OrganizationRole | | La entidad de rol de organización creada para este evento. | +| OrganizationRole.Data.Updated | data | OrganizationRole | | La entidad de rol de organización actualizada para este evento. | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | El ID del rol al que se asignan los alcances. (Solo disponible cuando el evento fue disparado por la creación de un nuevo rol con alcances preasignados) | -**Eventos de permiso de organización (alcance de organización)** +**Eventos de permiso de organización (OrganizationScope)** | Evento | Campo | Tipo | Opcional | Notas | | ------------------------------ | ----- | ----------------- | -------- | -------------------------------------------------- | | OrganizationScope.Created | data | OrganizationScope | | La entidad de alcance de organización creada. | | OrganizationScope.Data.Updated | data | OrganizationScope | | La entidad de alcance de organización actualizada. | | OrganizationScope.Deleted | data | null | / | | + +## Cuerpo de la solicitud de eventos de excepción hook \{#exception-hook-events-request-body} + +Eventos disponibles: `Identifier.Lockout` + +El cuerpo de la solicitud es un objeto JSON que contiene los campos estándar del cuerpo de la solicitud y campos adicionales como se muestra a continuación: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| Campo | Tipo | Opcional | Notas | +| ---------------- | ------------------- | -------- | --------------------------------------------------------------------------------------- | +| hookId | `string` | | El identificador en Logto. | +| event | `string` | | Qué evento dispara este hook. | +| createdAt | `string` | | La fecha de creación del payload en formato ISO. | +| userAgent | `string` | ✅ | El user-agent de la solicitud. | +| ip | `string` | ✅ | La dirección IP de la solicitud. | +| interactionEvent | `string` | ✅ | El evento de interacción que dispara este hook. | +| sessionId | `string` | ✅ | El ID de sesión (no el ID de interacción) para este evento, si aplica. | +| applicationId | `string` | ✅ | El ID de aplicación relacionado para este evento, si aplica. | +| application | `ApplicationEntity` | ✅ | La información de la aplicación relacionada para este evento, si aplica. | +| type | `SignInIdentifier` | | El tipo de identificador del usuario, por ejemplo, email, teléfono o nombre de usuario. | +| value | `string` | | El valor del identificador del usuario que disparó el bloqueo. | diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index 2c95b375247..b2aaf701084 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -7,71 +7,71 @@ sidebar_position: 3 # Événements Webhooks -Ce guide répertorie les différents événements de webhook Logto et explique quand chaque événement se produit. +Ce guide liste les différents événements webhook Logto et explique quand chaque événement se produit. -## Événements de hook d'interaction utilisateur \{#user-interaction-hook-events} +## Événements de hook d’interaction utilisateur \{#user-interaction-hook-events} -| Type d'événement | Description | +| Type d’événement | Description | | ----------------- | ------------------------------------------------------------------------------------------------ | -| PostRegister | Un utilisateur crée avec succès un nouveau compte via l'interface utilisateur. | -| PostSignIn | Un utilisateur se connecte avec succès via l'interface utilisateur. | -| PostResetPassword | Le mot de passe d'un utilisateur est réinitialisé avec succès via le flux "Mot de passe oublié". | +| PostRegister | Un utilisateur crée avec succès un nouveau compte via l’interface utilisateur. | +| PostSignIn | Un utilisateur se connecte avec succès via l’interface utilisateur. | +| PostResetPassword | Le mot de passe d’un utilisateur est réinitialisé avec succès via le flux "Mot de passe oublié". | ## Événements de hook de mutation de données \{#data-mutation-hook-events} ### Utilisateur \{#user} -| Type d'événement | Description | -| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| User.Created | Un nouveau compte utilisateur est créé. | -| User.Deleted | Un compte utilisateur est supprimé. | -| User.Data.Updated | Les données du profil utilisateur sont mises à jour, par exemple, e-mail, avatar, custom.data, identifiant social, etc. | -| User.SuspensionStatus.Updated | Le statut de suspension de l'utilisateur est modifié (suspendu ou réactivé). | +| Type d’événement | Description | +| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| User.Created | Un nouveau compte utilisateur est créé. | +| User.Deleted | Un compte utilisateur est supprimé. | +| User.Data.Updated | Les données du profil utilisateur sont mises à jour, par exemple : e-mail, avatar, custom.data, identifiant social, etc. | +| User.SuspensionStatus.Updated | Le statut de suspension de l’utilisateur est modifié (suspendu ou réactivé). | ### Rôle \{#role} -| Type d'événement | Description | -| ------------------- | ------------------------------------------------------------------------------------------------------------ | -| Role.Created | Un nouveau rôle est créé. | -| Role.Deleted | Un rôle est supprimé. | -| Role.Data.Updated | Les données d'un rôle sont mises à jour, par exemple, nom du rôle, description et statut de rôle par défaut. | -| Role.Scopes.Updated | Les Permissions (Portées) attribuées à un rôle sont ajoutées ou supprimées. | +| Type d’événement | Description | +| ------------------- | --------------------------------------------------------------------------------------------------- | +| Role.Created | Un nouveau rôle est créé. | +| Role.Deleted | Un rôle est supprimé. | +| Role.Data.Updated | Les données d’un rôle sont mises à jour, par exemple : nom du rôle, description, statut par défaut. | +| Role.Scopes.Updated | Les permissions attribuées à un rôle sont ajoutées ou supprimées. | ### Permission (Portée) \{#permission-scope} -| Type d'événement | Description | -| ------------------ | ------------------------------------------------------------------------------------------------------- | -| Scope.Created | Une nouvelle Permission (Portée) API est créée. | -| Scope.Deleted | Une Permission (Portée) API est supprimée. | -| Scope.Data.Updated | Les données d'une Permission (Portée) API sont mises à jour, par exemple, description de la permission. | +| Type d’événement | Description | +| ------------------ | ----------------------------------------------------------------------------------------------- | +| Scope.Created | Une nouvelle permission API est créée. | +| Scope.Deleted | Une permission API est supprimée. | +| Scope.Data.Updated | Les données d’une permission API sont mises à jour, par exemple : description de la permission. | ### Organisation \{#organization} -| Type d'événement | Description | -| ------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| Organization.Created | Une nouvelle Organisation est créée. | -| Organization.Deleted | Une Organisation est supprimée. | -| Organization.Data.Updated | Les données d'une Organisation sont mises à jour, par exemple, nom de l'organisation, description, custom.data, etc. | -| Organization.Membership.Updated | Des membres sont ajoutés ou supprimés d'une Organisation. | +| Type d’événement | Description | +| ------------------------------- | --------------------------------------------------------------------------------------------------- | +| Organization.Created | Une nouvelle organisation est créée. | +| Organization.Deleted | Une organisation est supprimée. | +| Organization.Data.Updated | Les données d’une organisation sont mises à jour, par exemple : nom, description, custom.data, etc. | +| Organization.Membership.Updated | Des membres sont ajoutés ou supprimés d’une organisation. | -### Rôle d'organisation \{#organization-role} +### Rôle d’organisation \{#organization-role} -| Type d'événement | Description | -| ------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | Un nouveau rôle d'organisation est créé. | -| OrganizationRole.Deleted | Un rôle d'organisation est supprimé. | -| OrganizationRole.Data.Updated | Les données d'un rôle d'organisation sont mises à jour, par exemple, nom et description du rôle d'organisation. | -| OrganizationRole.Scopes.Updated | Les Permissions (Portées) attribuées à un rôle d'organisation sont ajoutées ou supprimées. | +| Type d’événement | Description | +| ------------------------------- | ------------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | Un nouveau rôle d’organisation est créé. | +| OrganizationRole.Deleted | Un rôle d’organisation est supprimé. | +| OrganizationRole.Data.Updated | Les données d’un rôle d’organisation sont mises à jour, par exemple : nom et description du rôle. | +| OrganizationRole.Scopes.Updated | Les permissions attribuées à un rôle d’organisation sont ajoutées ou supprimées. | -### Permission d'organisation (Portée) \{#organization-permission-scope} +### Permission d’organisation (portée) \{#organization-permission-scope} -| Type d'événement | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | -| OrganizationScope.Created | Une nouvelle Permission (Portée) d'organisation est créée. | -| OrganizationScope.Deleted | Une Permission (Portée) d'organisation est supprimée. | -| OrganizationScope.Data.Updated | Les données d'une Permission (Portée) d'organisation sont mises à jour, par exemple, description de la permission d'organisation. | +| Type d’événement | Description | +| ------------------------------ | ---------------------------------------------------------------------------------------------------------- | +| OrganizationScope.Created | Une nouvelle permission d’organisation est créée. | +| OrganizationScope.Deleted | Une permission d’organisation est supprimée. | +| OrganizationScope.Data.Updated | Les données d’une permission d’organisation sont mises à jour, par exemple : description de la permission. | -### Événements déclenchés par Management API \{#management-api-triggered-events} +### Événements déclenchés par la Management API \{#management-api-triggered-events} | Point de terminaison API | Événement | | ---------------------------------------------------------- | ----------------------------------------------------------- | @@ -106,17 +106,25 @@ Ce guide répertorie les différents événements de webhook Logto et explique q | POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated | | DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated | -### Événements déclenchés par Interaction API \{#interaction-api-triggered-events} +### Événements déclenchés par l’Experience API \{#interaction-api-triggered-events} -| Action d'interaction utilisateur | Événement | +| Action d’interaction utilisateur | Événement | | -------------------------------------------- | ----------------- | -| Liaison d'e-mail / téléphone utilisateur | User.Data.Updated | -| Liaison des MFA utilisateur | User.Data.Updated | -| Liaison sociale / SSO utilisateur | User.Data.Updated | +| Liaison e-mail/téléphone | User.Data.Updated | +| Liaison MFA utilisateur | User.Data.Updated | +| Liaison social/SSO utilisateur | User.Data.Updated | | Réinitialisation du mot de passe utilisateur | User.Data.Updated | | Inscription utilisateur | User.Created | -## FAQs \{#faqs} +## Événements de hook d’exception \{#exception-hook-events} + +### Sécurité \{#security} + +| Type d’événement | Description | +| ------------------ | ------------------------------------------------------------------------------------------- | +| Identifier.Lockout | Un compte utilisateur est verrouillé suite à de multiples tentatives de connexion échouées. | + +## FAQ \{#faqs}
@@ -125,6 +133,6 @@ Ce guide répertorie les différents événements de webhook Logto et explique q -`PostRegister` est déclenché lorsqu'un utilisateur crée avec succès un nouveau compte via le flux d'inscription utilisateur ; `User.Created` est déclenché lorsqu'un nouveau compte utilisateur est créé via le Management API. +`PostRegister` est déclenché lorsqu’un utilisateur crée avec succès un nouveau compte via le flux d’inscription utilisateur ; `User.Created` est déclenché lorsqu’un nouveau compte utilisateur est créé via la Management API.
diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index f2712472bac..f0f1991c5eb 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/fr/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -1,29 +1,29 @@ --- id: webhooks-request -title: Requête de Webhooks -sidebar_label: Requête de Webhooks +title: Requête Webhooks +sidebar_label: Requête Webhooks sidebar_position: 4 --- -# Requête de Webhooks +# Requête Webhooks -Une fois qu'un événement de hook valide est émis, Logto trouvera les webhooks correspondants et enverra une requête POST par configuration de hook. +Lorsqu'un événement de hook valide est émis, Logto recherche les webhooks correspondants et envoie une requête POST par configuration de hook. ## En-têtes de requête \{#request-headers} -| Clé | Personnalisable | Remarques | -| ----------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- | -| user-agent | ✅ | `Logto (https://logto.io/)` par défaut. | -| content-type | ✅ | `application/json` par défaut. | -| logto-signature-sha-256 | | la signature du corps de la requête, se référer à [sécuriser vos webhooks](/developers/webhooks/secure-webhooks). | +| Clé | Personnalisable | Remarques | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------------------- | +| user-agent | ✅ | `Logto (https://logto.io/)` par défaut. | +| content-type | ✅ | `application/json` par défaut. | +| logto-signature-sha-256 | | la signature du corps de la requête, voir [sécuriser vos webhooks](/developers/webhooks/secure-webhooks). | -Vous pouvez remplacer les en-têtes personnalisables en [personnalisant les requêtes](/developers/webhooks/configure-webhooks/#secure-webhook) avec la même clé. +Vous pouvez écraser les en-têtes personnalisables en [personnalisant les en-têtes de requête](/developers/webhooks/configure-webhooks/#secure-webhook) avec la même clé. -## Corps de requête des événements de hook d'interaction \{#interaction-hook-events-request-body} +## Corps de la requête des événements d'interaction hook \{#interaction-hook-events-request-body} Événements disponibles : `PostRegister`, `PostSignIn`, `PostResetPassword` -Le corps de la requête est un objet JSON qui contient trois types de champ de données : +Le corps de la requête est un objet JSON qui contient trois types de champs de données : ```tsx type UserEntity = { @@ -43,65 +43,75 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| Champ | Type | Optionnel | Remarques | -| ---------------- | ------------------- | --------- | --------------------------------------------------------------------------- | -| hookId | `string` | | L'identifiant dans Logto. | -| event | `string` | | Quel événement déclenche ce hook. | -| createdAt | `string` | | L'heure de création de la charge utile au format ISO. | -| interactionEvent | `string` | | L'événement d'interaction qui déclenche ce hook. | -| sessionId | `string` | ✅ | L'ID de session (pas l'ID d'interaction) pour cet événement, si applicable. | -| userAgent | `string` | ✅ | L'agent utilisateur pour la requête qui déclenche ce hook. | -| userIp | `string` | ✅ | L'adresse IP pour la requête qui déclenche ce hook. | -| userId | `string` | ✅ | L'ID utilisateur associé à cet événement, si applicable. | -| user | `UserEntity` | ✅ | L'entité utilisateur associée à cet événement, si applicable. | -| applicationId | `string` | ✅ | L'ID d'application associé à cet événement, si applicable. | -| application | `ApplicationEntity` | ✅ | Les informations de l'application associée à cet événement, si applicable. | +| Champ | Type | Optionnel | Remarques | +| ---------------- | ------------------- | --------- | ------------------------------------------------------------------------------ | +| hookId | `string` | | L'identifiant dans Logto. | +| event | `string` | | L'événement qui déclenche ce hook. | +| createdAt | `string` | | La date de création du payload au format ISO. | +| interactionEvent | `string` | | L'événement d'interaction qui déclenche ce hook. | +| sessionId | `string` | ✅ | L'ID de session (et non l'ID d'interaction) pour cet événement, si applicable. | +| userAgent | `string` | ✅ | Le user-agent pour la requête qui déclenche ce hook. | +| userIp | `string` | ✅ | L'adresse IP pour la requête qui déclenche ce hook. | +| userId | `string` | ✅ | L'ID utilisateur associé à cet événement, si applicable. | +| user | `UserEntity` | ✅ | L'entité utilisateur associée à cet événement, si applicable. | +| applicationId | `string` | ✅ | L'ID d'application associé à cet événement, si applicable. | +| application | `ApplicationEntity` | ✅ | Les informations de l'application associée à cet événement, si applicable. | -Voir les références [Utilisateurs](/user-management/user-data) et [Applications](/integrate-logto/application-data-structure) pour des explications détaillées des champs. +Voir la référence [Utilisateurs](/user-management/user-data) et [Applications](/integrate-logto/application-data-structure) pour des explications détaillées des champs. -## Corps de requête des événements de hook de mutation de données \{#data-mutation-hook-events-request-body} +## Corps de la requête des événements de mutation de données hook \{#data-mutation-hook-events-request-body} -### Champs standard du corps de la requête \{#standard-request-body-fields} +### Champs standards du corps de la requête \{#standard-request-body-fields} -| Champ | Type | Optionnel | Remarques | -| --------- | -------- | --------- | ----------------------------------------------------- | -| hookId | `string` | | L'identifiant dans Logto. | -| event | `string` | | Quel événement déclenche ce hook. | -| createdAt | `string` | | L'heure de création de la charge utile au format ISO. | -| userAgent | `string` | ✅ | L'agent utilisateur pour la requête. | -| ip | `string` | ✅ | L'adresse IP pour la requête. | +| Champ | Type | Optionnel | Remarques | +| --------- | -------- | --------- | --------------------------------------------- | +| hookId | `string` | | L'identifiant dans Logto. | +| event | `string` | | L'événement qui déclenche ce hook. | +| createdAt | `string` | | La date de création du payload au format ISO. | +| userAgent | `string` | ✅ | Le user-agent pour la requête. | +| ip | `string` | ✅ | L'adresse IP pour la requête. | -### Champs du corps de contexte de l'API d'interaction \{#interaction-api-context-body-fields} +### Champs du corps de contexte Interaction API \{#interaction-api-context-body-fields} -Événements de hook de mutation de données déclenchés par des appels d'API d'interaction utilisateur. +Événements de mutation de données hook déclenchés par des appels API d'interaction utilisateur. Événements disponibles : `User.Created`, `User.Data.Updated` -| Champ | Type | Optionnel | Remarques | -| ---------------- | ------------------- | --------- | --------------------------------------------------------------------------- | -| interactionEvent | `string` | ✅ | L'événement d'interaction qui déclenche ce hook. | -| sessionId | `string` | ✅ | L'ID de session (pas l'ID d'interaction) pour cet événement, si applicable. | -| applicationId | `string` | ✅ | L'ID d'application associé à cet événement, si applicable. | -| application | `ApplicationEntity` | ✅ | Les informations de l'application associée à cet événement, si applicable. | +| Champ | Type | Optionnel | Remarques | +| ---------------- | ------------------- | --------- | ------------------------------------------------------------------------------ | +| interactionEvent | `string` | ✅ | L'événement d'interaction qui déclenche ce hook. | +| sessionId | `string` | ✅ | L'ID de session (et non l'ID d'interaction) pour cet événement, si applicable. | +| applicationId | `string` | ✅ | L'ID d'application associé à cet événement, si applicable. | +| application | `ApplicationEntity` | ✅ | Les informations de l'application associée à cet événement, si applicable. | -### Champs du corps de contexte de l'API de gestion \{#management-api-context-body-fields} +### Champs du corps de contexte Management API \{#management-api-context-body-fields} -Événements de hook de mutation de données déclenchés par des appels d'API de gestion. +Événements de mutation de données hook déclenchés par des appels Management API. -| Champ | Type | Optionnel | Remarques | -| ------------ | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| path | `string` | ✅ | Le chemin de l'appel API qui déclenche ce hook. | -| method | `string` | ✅ | La méthode de l'appel API qui déclenche ce hook. | -| status | `number` | ✅ | Le code de statut de la réponse de l'appel API qui déclenche ce hook. | -| params | `object` | ✅ | Les paramètres de chemin koa de la requête de l'appel API qui déclenche ce hook. | -| matchedRoute | `string` | ✅ | La route koa correspondante de l'appel API qui déclenche ce hook. Logto utilise ce champ pour faire correspondre les événements de hook activés. | +| Champ | Type | Optionnel | Remarques | +| ------------ | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| path | `string` | ✅ | Le chemin de l'appel API qui déclenche ce hook. | +| method | `string` | ✅ | La méthode de l'appel API qui déclenche ce hook. | +| status | `number` | ✅ | Le code de statut de la réponse de l'appel API qui déclenche ce hook. | +| params | `object` | ✅ | Les paramètres de chemin koa de la requête de l'appel API qui déclenche ce hook. | +| matchedRoute | `string` | ✅ | La route koa correspondante de l'appel API qui déclenche ce hook. Logto utilise ce champ pour faire correspondre les événements hook activés. | ### Champs du corps de la charge utile de données \{#data-payload-body-fields} @@ -113,7 +123,7 @@ Voir les références [Utilisateurs](/user-management/user-data) et [Application | User.Data.Updated | data | UserEntity | | L'entité utilisateur mise à jour pour cet événement. | | User.Deleted | data | null | / | | -**Événements de rôle** +**Événements Rôle (Role)** ```tsx type Role = { @@ -135,23 +145,23 @@ type Scope = { }; ``` -| Événement | Champ | Type | Optionnel | Remarques | -| ------------------ | ------ | ------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Role.Created | data | Role | | L'entité de rôle créée pour cet événement. | -| Role.Data.Updated | data | Role | | L'entité de rôle mise à jour pour cet événement. | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | Les portées mises à jour assignées au rôle. | -| Role.Scope.Updated | roleId | string | ✅ | L'ID du rôle auquel les portées sont assignées. (Disponible uniquement lorsque l'événement a été déclenché par la création d'un nouveau rôle avec des portées pré-assignées) | +| Événement | Champ | Type | Optionnel | Remarques | +| ------------------ | ------ | ------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Role.Created | data | Role | | L'entité rôle créée pour cet événement. | +| Role.Data.Updated | data | Role | | L'entité rôle mise à jour pour cet événement. | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | Les portées mises à jour attribuées au rôle. | +| Role.Scope.Updated | roleId | string | ✅ | L'ID du rôle auquel les portées sont attribuées. (Disponible uniquement lorsque l'événement a été déclenché par la création d'un nouveau rôle avec des portées pré-attribuées) | -**Événements de permission (Portée)** +**Événements Permission (Scope)** -| Événement | Champ | Type | Optionnel | Remarques | -| ------------------ | ----- | ----- | --------- | -------------------------------------------------- | -| Scope.Created | data | Scope | | L'entité de portée créée pour cet événement. | -| Scope.Data.Updated | data | Scope | | L'entité de portée mise à jour pour cet événement. | -| Scope.Deleted | data | null | / | | +| Événement | Champ | Type | Optionnel | Remarques | +| ------------------ | ----- | ----- | --------- | ----------------------------------------------- | +| Scope.Created | data | Scope | | L'entité portée créée pour cet événement. | +| Scope.Data.Updated | data | Scope | | L'entité portée mise à jour pour cet événement. | +| Scope.Deleted | data | null | / | | -**Événements d'organisation** +**Événements Organisation (Organization)** ```tsx type Organization = { @@ -163,14 +173,14 @@ type Organization = { }; ``` -| Événement | Champ | Type | Optionnel | Remarques | -| ------------------------------- | ----- | ------------ | --------- | ------------------------------------------------------- | -| Organization.Created | data | Organization | | L'entité d'organisation créée pour cet événement. | -| Organization.Data.Updated | data | Organization | | L'entité d'organisation mise à jour pour cet événement. | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| Événement | Champ | Type | Optionnel | Remarques | +| ------------------------------- | ----- | ------------ | --------- | ----------------------------------------------------- | +| Organization.Created | data | Organization | | L'entité organisation créée pour cet événement. | +| Organization.Data.Updated | data | Organization | | L'entité organisation mise à jour pour cet événement. | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | -**Événements de rôle d'organisation** +**Événements OrganisationRôle (OrganizationRole)** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Événement | Champ | Type | Optionnel | Remarques | -| ------------------------------ | ------------------ | ---------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | L'entité de rôle d'organisation créée pour cet événement. | -| OrganizationRole.Data.Updated | data | OrganizationRole | | L'entité de rôle d'organisation mise à jour pour cet événement. | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | L'ID du rôle auquel les portées sont assignées. (Disponible uniquement lorsque l'événement a été déclenché par la création d'un nouveau rôle avec des portées pré-assignées) | - -**Événements de permission d'organisation (Portée d'organisation)** - -| Événement | Champ | Type | Optionnel | Remarques | -| ------------------------------ | ----- | ----------------- | --------- | ---------------------------------------------- | -| OrganizationScope.Created | data | OrganizationScope | | L'entité de portée d'organisation créée. | -| OrganizationScope.Data.Updated | data | OrganizationScope | | L'entité de portée d'organisation mise à jour. | -| OrganizationScope.Deleted | data | null | / | | +| Événement | Champ | Type | Optionnel | Remarques | +| ------------------------------ | ------------------ | ---------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| OrganizationRole.Created | data | OrganizationRole | | L'entité rôle d'organisation créée pour cet événement. | +| OrganizationRole.Data.Updated | data | OrganizationRole | | L'entité rôle d'organisation mise à jour pour cet événement. | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | L'ID du rôle auquel les portées sont attribuées. (Disponible uniquement lorsque l'événement a été déclenché par la création d'un nouveau rôle avec des portées pré-attribuées) | + +**Événements Permission d'organisation (OrganizationScope)** + +| Événement | Champ | Type | Optionnel | Remarques | +| ------------------------------ | ----- | ----------------- | --------- | ------------------------------------------- | +| OrganizationScope.Created | data | OrganizationScope | | L'entité portée d'organisation créée. | +| OrganizationScope.Data.Updated | data | OrganizationScope | | L'entité portée d'organisation mise à jour. | +| OrganizationScope.Deleted | data | null | / | | + +## Corps de la requête des événements d'exception hook \{#exception-hook-events-request-body} + +Événements disponibles : `Identifier.Lockout` + +Le corps de la requête est un objet JSON qui contient les champs standards du corps de la requête et des champs additionnels comme ci-dessous : + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| Champ | Type | Optionnel | Remarques | +| ---------------- | ------------------- | --------- | ------------------------------------------------------------------------------ | +| hookId | `string` | | L'identifiant dans Logto. | +| event | `string` | | L'événement qui déclenche ce hook. | +| createdAt | `string` | | La date de création du payload au format ISO. | +| userAgent | `string` | ✅ | Le user-agent pour la requête. | +| ip | `string` | ✅ | L'adresse IP pour la requête. | +| interactionEvent | `string` | ✅ | L'événement d'interaction qui déclenche ce hook. | +| sessionId | `string` | ✅ | L'ID de session (et non l'ID d'interaction) pour cet événement, si applicable. | +| applicationId | `string` | ✅ | L'ID d'application associé à cet événement, si applicable. | +| application | `ApplicationEntity` | ✅ | Les informations de l'application associée à cet événement, si applicable. | +| type | `SignInIdentifier` | | Le type d'identifiant utilisateur, ex : email, téléphone ou nom d'utilisateur. | +| value | `string` | | La valeur de l'identifiant utilisateur qui a déclenché le verrouillage. | diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index 923840626c5..a115cb1af18 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -7,71 +7,71 @@ sidebar_position: 3 # Webhooks イベント -このガイドでは、Logto の異なる Webhook イベントを一覧にし、それぞれのイベントが発生するタイミングを説明します。 +このガイドでは、Logto のさまざまな Webhook イベントと、それぞれのイベントが発生するタイミングについて説明します。 ## ユーザーインタラクションフックイベント \{#user-interaction-hook-events} -| イベントタイプ | 説明 | -| ----------------- | ---------------------------------------------------------------------------------- | -| PostRegister | ユーザーが UI インターフェースを介して新しいアカウントを正常に作成します。 | -| PostSignIn | ユーザーが UI インターフェースを介して正常にサインインします。 | -| PostResetPassword | ユーザーのパスワードが「パスワードを忘れた」フローを通じて正常にリセットされます。 | +| イベントタイプ | 説明 | +| ----------------- | ------------------------------------------------------------------------------------------ | +| PostRegister | ユーザーが UI インターフェースを通じて新しいアカウントを正常に作成したときに発生します。 | +| PostSignIn | ユーザーが UI インターフェースを通じて正常にサインインしたときに発生します。 | +| PostResetPassword | 「パスワードを忘れた」フローでユーザーのパスワードが正常にリセットされたときに発生します。 | ## データ変更フックイベント \{#data-mutation-hook-events} ### ユーザー \{#user} -| イベントタイプ | 説明 | -| ----------------------------- | --------------------------------------------------------------------------------------------------- | -| User.Created | 新しいユーザーアカウントが作成されます。 | -| User.Deleted | ユーザーアカウントが削除されます。 | -| User.Data.Updated | ユーザープロファイルデータが更新されます。例:メール、アバター、custom.data、ソーシャル識別子など。 | -| User.SuspensionStatus.Updated | ユーザーの停止状態が変更されます(停止または再有効化)。 | +| イベントタイプ | 説明 | +| ----------------------------- | ------------------------------------------------------------------------------------------------------- | +| User.Created | 新しいユーザーアカウントが作成されました。 | +| User.Deleted | ユーザーアカウントが削除されました。 | +| User.Data.Updated | ユーザープロファイルデータが更新されました(例:メール、アバター、custom.data、ソーシャル識別子など)。 | +| User.SuspensionStatus.Updated | ユーザーのサスペンド状態が変更されました(サスペンドまたは再有効化)。 | -### ロール \{#role} +### ロール (Role) \{#role} -| イベントタイプ | 説明 | -| ------------------- | -------------------------------------------------------------------------- | -| Role.Created | 新しいロールが作成されます。 | -| Role.Deleted | ロールが削除されます。 | -| Role.Data.Updated | ロールのデータが更新されます。例:ロール名、説明、デフォルトロールの状態。 | -| Role.Scopes.Updated | ロールに割り当てられた権限が追加または削除されます。 | +| イベントタイプ | 説明 | +| ------------------- | ---------------------------------------------------------------------------- | +| Role.Created | 新しいロールが作成されました。 | +| Role.Deleted | ロールが削除されました。 | +| Role.Data.Updated | ロールのデータが更新されました(例:ロール名、説明、デフォルトロール状態)。 | +| Role.Scopes.Updated | ロールに割り当てられた権限が追加または削除されました。 | ### 権限 (スコープ) \{#permission-scope} -| イベントタイプ | 説明 | -| ------------------ | ------------------------------------------------ | -| Scope.Created | 新しい API 権限が作成されます。 | -| Scope.Deleted | API 権限が削除されます。 | -| Scope.Data.Updated | API 権限のデータが更新されます。例:権限の説明。 | +| イベントタイプ | 説明 | +| ------------------ | ---------------------------------------------------- | +| Scope.Created | 新しい API 権限が作成されました。 | +| Scope.Deleted | API 権限が削除されました。 | +| Scope.Data.Updated | API 権限のデータが更新されました(例:権限の説明)。 | -### 組織 \{#organization} +### 組織 (Organization) \{#organization} -| イベントタイプ | 説明 | -| ------------------------------- | ---------------------------------------------------------------- | -| Organization.Created | 新しい組織が作成されます。 | -| Organization.Deleted | 組織が削除されます。 | -| Organization.Data.Updated | 組織のデータが更新されます。例:組織名、説明、custom.data など。 | -| Organization.Membership.Updated | 組織にメンバーが追加または削除されます。 | +| イベントタイプ | 説明 | +| ------------------------------- | -------------------------------------------------------------------- | +| Organization.Created | 新しい組織が作成されました。 | +| Organization.Deleted | 組織が削除されました。 | +| Organization.Data.Updated | 組織のデータが更新されました(例:組織名、説明、custom.data など)。 | +| Organization.Membership.Updated | 組織のメンバーが追加または削除されました。 | -### 組織ロール \{#organization-role} +### 組織ロール (Organization role) \{#organization-role} -| イベントタイプ | 説明 | -| ------------------------------- | ---------------------------------------------------------- | -| OrganizationRole.Created | 新しい組織ロールが作成されます。 | -| OrganizationRole.Deleted | 組織ロールが削除されます。 | -| OrganizationRole.Data.Updated | 組織ロールのデータが更新されます。例:組織ロール名と説明。 | -| OrganizationRole.Scopes.Updated | 組織ロールに割り当てられた権限が追加または削除されます。 | +| イベントタイプ | 説明 | +| ------------------------------- | -------------------------------------------------------------- | +| OrganizationRole.Created | 新しい組織ロールが作成されました。 | +| OrganizationRole.Deleted | 組織ロールが削除されました。 | +| OrganizationRole.Data.Updated | 組織ロールのデータが更新されました(例:組織ロール名、説明)。 | +| OrganizationRole.Scopes.Updated | 組織ロールに割り当てられた権限が追加または削除されました。 | ### 組織権限 (スコープ) \{#organization-permission-scope} -| イベントタイプ | 説明 | -| ------------------------------ | ---------------------------------------------------- | -| OrganizationScope.Created | 新しい組織権限が作成されます。 | -| OrganizationScope.Deleted | 組織権限が削除されます。 | -| OrganizationScope.Data.Updated | 組織権限のデータが更新されます。例:組織権限の説明。 | +| イベントタイプ | 説明 | +| ------------------------------ | -------------------------------------------------------- | +| OrganizationScope.Created | 新しい組織権限が作成されました。 | +| OrganizationScope.Deleted | 組織権限が削除されました。 | +| OrganizationScope.Data.Updated | 組織権限のデータが更新されました(例:組織権限の説明)。 | -### Management API によってトリガーされるイベント \{#management-api-triggered-events} +### Management API によるトリガーイベント \{#management-api-triggered-events} | API エンドポイント | イベント | | ---------------------------------------------------------- | ----------------------------------------------------------- | @@ -106,15 +106,23 @@ sidebar_position: 3 | POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated | | DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated | -### インタラクション API によってトリガーされるイベント \{#interaction-api-triggered-events} +### Experience API によるトリガーイベント \{#interaction-api-triggered-events} -| ユーザーインタラクションアクション | イベント | -| ----------------------------------- | ----------------- | -| ユーザーのメール / 電話のリンク | User.Data.Updated | -| ユーザーの MFA のリンク | User.Data.Updated | -| ユーザーのソーシャル / SSO のリンク | User.Data.Updated | -| ユーザーのパスワードリセット | User.Data.Updated | -| ユーザー登録 | User.Created | +| ユーザーインタラクションアクション | イベント | +| ---------------------------------- | ----------------- | +| ユーザーのメール/電話の連携 | User.Data.Updated | +| ユーザーの MFA 連携 | User.Data.Updated | +| ユーザーのソーシャル/SSO 連携 | User.Data.Updated | +| ユーザーのパスワードリセット | User.Data.Updated | +| ユーザー登録 | User.Created | + +## 例外フックイベント \{#exception-hook-events} + +### セキュリティ \{#security} + +| イベントタイプ | 説明 | +| ------------------ | ------------------------------------------------------------------ | +| Identifier.Lockout | 複数回のサインイン失敗によりユーザーアカウントがロックされました。 | ## よくある質問 \{#faqs} diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 72a1aaf494b..cb3869bed3c 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/ja/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -7,21 +7,21 @@ sidebar_position: 4 # Webhooks リクエスト -有効なフックイベントが発生すると、Logto は対応する Webhook を見つけ、フック設定ごとに POST リクエストを送信します。 +有効なフックイベントが発生すると、Logto は対応する Webhook を検索し、各フック設定ごとに POST リクエストを送信します。 ## リクエストヘッダー \{#request-headers} -| Key | カスタマイズ可能 | 備考 | -| ----------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------- | -| user-agent | ✅ | デフォルトでは `Logto (https://logto.io/)`。 | -| content-type | ✅ | デフォルトでは `application/json`。 | -| logto-signature-sha-256 | | リクエストボディの署名、[Webhook のセキュリティ保護](/developers/webhooks/secure-webhooks)を参照してください。 | +| Key | カスタマイズ可 | 備考 | +| ----------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------- | +| user-agent | ✅ | デフォルトは `Logto (https://logto.io/)` です。 | +| content-type | ✅ | デフォルトは `application/json` です。 | +| logto-signature-sha-256 | | リクエストボディの署名。 [Webhook のセキュリティ保護](/developers/webhooks/secure-webhooks) を参照してください。 | -カスタマイズ可能なヘッダーは、同じキーで [リクエストヘッダーをカスタマイズ](/developers/webhooks/configure-webhooks/#secure-webhook) することで上書きできます。 +カスタマイズ可能なヘッダーは、同じキーで [リクエストヘッダーのカスタマイズ](/developers/webhooks/configure-webhooks/#secure-webhook) により上書きできます。 ## インタラクションフックイベントのリクエストボディ \{#interaction-hook-events-request-body} -利用可能なイベント:`PostRegister`、`PostSignIn`、`PostResetPassword` +利用可能なイベント: `PostRegister`, `PostSignIn`, `PostResetPassword` リクエストボディは、3 種類のデータフィールドを含む JSON オブジェクトです: @@ -43,75 +43,85 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| フィールド | タイプ | オプション | 備考 | -| ---------------- | ------------------- | ---------- | --------------------------------------------------------------------------------- | -| hookId | `string` | | Logto 内の識別子。 | -| event | `string` | | このフックをトリガーするイベント。 | -| createdAt | `string` | | ISO 形式でのペイロードの作成時間。 | -| interactionEvent | `string` | | このフックをトリガーするインタラクションイベント。 | -| sessionId | `string` | ✅ | このイベントのセッション ID(インタラクション ID ではありません)、該当する場合。 | -| userAgent | `string` | ✅ | このフックをトリガーするリクエストのユーザーエージェント。 | -| userIp | `string` | ✅ | このフックをトリガーするリクエストの IP アドレス。 | -| userId | `string` | ✅ | このイベントに関連するユーザー ID、該当する場合。 | -| user | `UserEntity` | ✅ | このイベントに関連するユーザーエンティティ、該当する場合。 | -| applicationId | `string` | ✅ | このイベントに関連するアプリケーション ID、該当する場合。 | -| application | `ApplicationEntity` | ✅ | このイベントに関連するアプリケーション情報、該当する場合。 | - -詳細なフィールドの説明については、[ユーザー](/user-management/user-data) および [アプリケーション](/integrate-logto/application-data-structure) のリファレンスを参照してください。 +| フィールド | 型 | オプション | 備考 | +| ---------------- | ------------------- | ---------- | ------------------------------------------------------------------- | +| hookId | `string` | | Logto 内の識別子。 | +| event | `string` | | このフックをトリガーしたイベント。 | +| createdAt | `string` | | ペイロードの作成時刻(ISO 形式)。 | +| interactionEvent | `string` | | このフックをトリガーしたインタラクションイベント。 | +| sessionId | `string` | ✅ | このイベントのセッション ID(インタラクション ID ではありません)。 | +| userAgent | `string` | ✅ | このフックをトリガーしたリクエストのユーザーエージェント。 | +| userIp | `string` | ✅ | このフックをトリガーしたリクエストの IP アドレス。 | +| userId | `string` | ✅ | このイベントに関連するユーザー ID。 | +| user | `UserEntity` | ✅ | このイベントに関連するユーザーエンティティ。 | +| applicationId | `string` | ✅ | このイベントに関連するアプリケーション ID。 | +| application | `ApplicationEntity` | ✅ | このイベントに関連するアプリケーション情報。 | + +各フィールドの詳細な説明は [ユーザー](/user-management/user-data) および [アプリケーション](/integrate-logto/application-data-structure) リファレンスを参照してください。 ## データ変更フックイベントのリクエストボディ \{#data-mutation-hook-events-request-body} ### 標準リクエストボディフィールド \{#standard-request-body-fields} -| フィールド | タイプ | オプション | 備考 | +| フィールド | 型 | オプション | 備考 | | ---------- | -------- | ---------- | ---------------------------------- | | hookId | `string` | | Logto 内の識別子。 | -| event | `string` | | このフックをトリガーするイベント。 | -| createdAt | `string` | | ISO 形式でのペイロードの作成時間。 | +| event | `string` | | このフックをトリガーしたイベント。 | +| createdAt | `string` | | ペイロードの作成時刻(ISO 形式)。 | | userAgent | `string` | ✅ | リクエストのユーザーエージェント。 | | ip | `string` | ✅ | リクエストの IP アドレス。 | ### インタラクション API コンテキストボディフィールド \{#interaction-api-context-body-fields} -ユーザーインタラクション API 呼び出しによってトリガーされるデータ変更フックイベント。 +ユーザーのインタラクション API コールによってトリガーされるデータ変更フックイベント。 -利用可能なイベント:`User.Created`、`User.Data.Updated` +利用可能なイベント: `User.Created`, `User.Data.Updated` -| フィールド | タイプ | オプション | 備考 | -| ---------------- | ------------------- | ---------- | --------------------------------------------------------------------------------- | -| interactionEvent | `string` | ✅ | このフックをトリガーするインタラクションイベント。 | -| sessionId | `string` | ✅ | このイベントのセッション ID(インタラクション ID ではありません)、該当する場合。 | -| applicationId | `string` | ✅ | このイベントに関連するアプリケーション ID、該当する場合。 | -| application | `ApplicationEntity` | ✅ | このイベントに関連するアプリケーション情報、該当する場合。 | +| フィールド | 型 | オプション | 備考 | +| ---------------- | ------------------- | ---------- | ------------------------------------------------------------------- | +| interactionEvent | `string` | ✅ | このフックをトリガーしたインタラクションイベント。 | +| sessionId | `string` | ✅ | このイベントのセッション ID(インタラクション ID ではありません)。 | +| applicationId | `string` | ✅ | このイベントに関連するアプリケーション ID。 | +| application | `ApplicationEntity` | ✅ | このイベントに関連するアプリケーション情報。 | ### Management API コンテキストボディフィールド \{#management-api-context-body-fields} -Management API 呼び出しによってトリガーされるデータ変更フックイベント。 +Management API コールによってトリガーされるデータ変更フックイベント。 -| フィールド | タイプ | オプション | 備考 | -| ------------ | -------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| path | `string` | ✅ | このフックをトリガーする API 呼び出しのパス。 | -| method | `string` | ✅ | このフックをトリガーする API 呼び出しのメソッド。 | -| status | `number` | ✅ | このフックをトリガーする API 呼び出しのレスポンスステータスコード。 | -| params | `object` | ✅ | このフックをトリガーする API 呼び出しのリクエスト koa パスパラメータ。 | -| matchedRoute | `string` | ✅ | このフックをトリガーする API 呼び出しの koa マッチしたルート。Logto はこのフィールドを使用して有効なフックイベントをマッチします。 | +| フィールド | 型 | オプション | 備考 | +| ------------ | -------- | ---------- | ------------------------------------------------------------------------------------------------------------------ | +| path | `string` | ✅ | このフックをトリガーした API コールのパス。 | +| method | `string` | ✅ | このフックをトリガーした API コールのメソッド。 | +| status | `number` | ✅ | このフックをトリガーした API コールのレスポンスステータスコード。 | +| params | `object` | ✅ | このフックをトリガーした API コールの koa パスパラメータ。 | +| matchedRoute | `string` | ✅ | このフックをトリガーした API コールの koa マッチルート。Logto はこのフィールドで有効なフックイベントを判定します。 | ### データペイロードボディフィールド \{#data-payload-body-fields} **ユーザーイベント** -| イベント | フィールド | タイプ | オプション | 備考 | -| ----------------- | ---------- | ---------- | ---------- | ---------------------------------------------- | -| User.Created | data | UserEntity | | このイベントの作成されたユーザーエンティティ。 | -| User.Data.Updated | data | UserEntity | | このイベントの更新されたユーザーエンティティ。 | -| User.Deleted | data | null | / | | +| イベント | フィールド | 型 | オプション | 備考 | +| ----------------- | ---------- | ---------- | ---------- | -------------------------------------- | +| User.Created | data | UserEntity | | このイベントで作成されたユーザー情報。 | +| User.Data.Updated | data | UserEntity | | このイベントで更新されたユーザー情報。 | +| User.Deleted | data | null | / | | **ロールイベント** @@ -135,21 +145,21 @@ type Scope = { }; ``` -| イベント | フィールド | タイプ | オプション | 備考 | -| ------------------ | ---------- | ------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| Role.Created | data | Role | | このイベントの作成されたロールエンティティ。 | -| Role.Data.Updated | data | Role | | このイベントの更新されたロールエンティティ。 | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | ロールに割り当てられた更新されたスコープ。 | -| Role.Scope.Updated | roleId | string | ✅ | スコープが割り当てられたロール ID。(事前に割り当てられたスコープで新しいロールを作成することによってイベントがトリガーされた場合のみ利用可能) | +| イベント | フィールド | 型 | オプション | 備考 | +| ------------------ | ---------- | ------- | ---------- | ------------------------------------------------------------------------------------------- | +| Role.Created | data | Role | | このイベントで作成されたロール情報。 | +| Role.Data.Updated | data | Role | | このイベントで更新されたロール情報。 | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | ロールに割り当てられた更新済みスコープ。 | +| Role.Scope.Updated | roleId | string | ✅ | スコープが割り当てられたロール ID。(事前割り当てスコープ付き新規ロール作成時のみ利用可能) | -**権限 (スコープ) イベント** +**権限(スコープ)イベント** -| イベント | フィールド | タイプ | オプション | 備考 | -| ------------------ | ---------- | ------ | ---------- | ---------------------------------------------- | -| Scope.Created | data | Scope | | このイベントの作成されたスコープエンティティ。 | -| Scope.Data.Updated | data | Scope | | このイベントの更新されたスコープエンティティ。 | -| Scope.Deleted | data | null | / | | +| イベント | フィールド | 型 | オプション | 備考 | +| ------------------ | ---------- | ----- | ---------- | -------------------------------------- | +| Scope.Created | data | Scope | | このイベントで作成されたスコープ情報。 | +| Scope.Data.Updated | data | Scope | | このイベントで更新されたスコープ情報。 | +| Scope.Deleted | data | null | / | | **組織イベント** @@ -163,12 +173,12 @@ type Organization = { }; ``` -| イベント | フィールド | タイプ | オプション | 備考 | -| ------------------------------- | ---------- | ------------ | ---------- | ------------------------------------------ | -| Organization.Created | data | Organization | | このイベントの作成された組織エンティティ。 | -| Organization.Data.Updated | data | Organization | | このイベントの更新された組織エンティティ。 | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| イベント | フィールド | 型 | オプション | 備考 | +| ------------------------------- | ---------- | ------------ | ---------- | ---------------------------------- | +| Organization.Created | data | Organization | | このイベントで作成された組織情報。 | +| Organization.Data.Updated | data | Organization | | このイベントで更新された組織情報。 | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | **組織ロールイベント** @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| イベント | フィールド | タイプ | オプション | 備考 | -| ------------------------------ | ------------------ | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | このイベントの作成された組織ロールエンティティ。 | -| OrganizationRole.Data.Updated | data | OrganizationRole | | このイベントの更新された組織ロールエンティティ。 | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | スコープが割り当てられたロール ID。(事前に割り当てられたスコープで新しいロールを作成することによってイベントがトリガーされた場合のみ利用可能) | - -**組織権限 (組織スコープ) イベント** - -| イベント | フィールド | タイプ | オプション | 備考 | -| ------------------------------ | ---------- | ----------------- | ---------- | ------------------------------------ | -| OrganizationScope.Created | data | OrganizationScope | | 作成された組織スコープエンティティ。 | -| OrganizationScope.Data.Updated | data | OrganizationScope | | 更新された組織スコープエンティティ。 | -| OrganizationScope.Deleted | data | null | / | | +| イベント | フィールド | 型 | オプション | 備考 | +| ------------------------------ | ------------------ | ---------------- | ---------- | ------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | data | OrganizationRole | | このイベントで作成された組織ロール情報。 | +| OrganizationRole.Data.Updated | data | OrganizationRole | | このイベントで更新された組織ロール情報。 | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | スコープが割り当てられたロール ID。(事前割り当てスコープ付き新規ロール作成時のみ利用可能) | + +**組織権限(OrganizationScope)イベント** + +| イベント | フィールド | 型 | オプション | 備考 | +| ------------------------------ | ---------- | ----------------- | ---------- | ---------------------------- | +| OrganizationScope.Created | data | OrganizationScope | | 作成された組織スコープ情報。 | +| OrganizationScope.Data.Updated | data | OrganizationScope | | 更新された組織スコープ情報。 | +| OrganizationScope.Deleted | data | null | / | | + +## 例外フックイベントのリクエストボディ \{#exception-hook-events-request-body} + +利用可能なイベント: `Identifier.Lockout` + +リクエストボディは、標準リクエストボディフィールドと以下の追加フィールドを含む JSON オブジェクトです: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| フィールド | 型 | オプション | 備考 | +| ---------------- | ------------------- | ---------- | ------------------------------------------------------------------- | +| hookId | `string` | | Logto 内の識別子。 | +| event | `string` | | このフックをトリガーしたイベント。 | +| createdAt | `string` | | ペイロードの作成時刻(ISO 形式)。 | +| userAgent | `string` | ✅ | リクエストのユーザーエージェント。 | +| ip | `string` | ✅ | リクエストの IP アドレス。 | +| interactionEvent | `string` | ✅ | このフックをトリガーしたインタラクションイベント。 | +| sessionId | `string` | ✅ | このイベントのセッション ID(インタラクション ID ではありません)。 | +| applicationId | `string` | ✅ | このイベントに関連するアプリケーション ID。 | +| application | `ApplicationEntity` | ✅ | このイベントに関連するアプリケーション情報。 | +| type | `SignInIdentifier` | | ユーザーの識別子タイプ(例:email、phone、username)。 | +| value | `string` | | ロックアウトを引き起こしたユーザーの識別子値。 | diff --git a/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index b39c0bcf019..3296880b62d 100644 --- a/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -1,75 +1,75 @@ --- id: webhooks-events -title: Webhooks events -sidebar_label: Webhooks events +title: Webhooks 이벤트 +sidebar_label: Webhooks 이벤트 sidebar_position: 3 --- # Webhooks 이벤트 -이 가이드는 다양한 Logto Webhook 이벤트를 나열하고 각 이벤트가 발생하는 시점을 설명합니다. +이 가이드에서는 다양한 Logto Webhook 이벤트와 각 이벤트가 발생하는 시점을 설명합니다. ## 사용자 상호작용 훅 이벤트 \{#user-interaction-hook-events} -| 이벤트 유형 | 설명 | -| ----------------- | ------------------------------------------------------------------------ | -| PostRegister | 사용자가 UI 인터페이스를 통해 새 계정을 성공적으로 생성합니다. | -| PostSignIn | 사용자가 UI 인터페이스를 통해 성공적으로 로그인합니다. | -| PostResetPassword | 사용자의 비밀번호가 "비밀번호 찾기" 흐름을 통해 성공적으로 재설정됩니다. | +| 이벤트 타입 | 설명 | +| ----------------- | ---------------------------------------------------------------------- | +| PostRegister | 사용자가 UI 인터페이스를 통해 새 계정을 성공적으로 생성함. | +| PostSignIn | 사용자가 UI 인터페이스를 통해 성공적으로 로그인함. | +| PostResetPassword | 사용자가 "비밀번호 찾기" 플로우를 통해 비밀번호를 성공적으로 재설정함. | -## 데이터 변형 훅 이벤트 \{#data-mutation-hook-events} +## 데이터 변경 훅 이벤트 \{#data-mutation-hook-events} ### 사용자 \{#user} -| 이벤트 유형 | 설명 | -| ----------------------------- | --------------------------------------------------------------------------------------- | -| User.Created | 새 사용자 계정이 생성됩니다. | -| User.Deleted | 사용자 계정이 삭제됩니다. | -| User.Data.Updated | 사용자 프로필 데이터가 업데이트됩니다. 예: 이메일, 아바타, custom.data, 소셜 식별자 등. | -| User.SuspensionStatus.Updated | 사용자 정지 상태가 변경됩니다 (정지 또는 재활성화). | +| 이벤트 타입 | 설명 | +| ----------------------------- | ------------------------------------------------------------------------------------ | +| User.Created | 새 사용자 계정이 생성됨. | +| User.Deleted | 사용자 계정이 삭제됨. | +| User.Data.Updated | 사용자 프로필 데이터가 업데이트됨 (예: 이메일, 아바타, custom.data, 소셜 식별자 등). | +| User.SuspensionStatus.Updated | 사용자 정지 상태가 변경됨 (정지 또는 재활성화). | -### 역할 \{#role} +### 역할(Role) \{#role} -| 이벤트 유형 | 설명 | -| ------------------- | -------------------------------------------------------------------- | -| Role.Created | 새 역할이 생성됩니다. | -| Role.Deleted | 역할이 삭제됩니다. | -| Role.Data.Updated | 역할의 데이터가 업데이트됩니다. 예: 역할 이름, 설명, 기본 역할 상태. | -| Role.Scopes.Updated | 역할에 할당된 권한이 추가되거나 제거됩니다. | +| 이벤트 타입 | 설명 | +| ------------------- | --------------------------------------------------------------- | +| Role.Created | 새 역할이 생성됨. | +| Role.Deleted | 역할이 삭제됨. | +| Role.Data.Updated | 역할 데이터가 업데이트됨 (예: 역할 이름, 설명, 기본 역할 상태). | +| Role.Scopes.Updated | 역할에 할당된 권한이 추가되거나 제거됨. | -### 권한 (스코프) \{#permission-scope} +### 권한(Permission, Scope) \{#permission-scope} -| 이벤트 유형 | 설명 | -| ------------------ | -------------------------------------------------- | -| Scope.Created | 새 API 권한이 생성됩니다. | -| Scope.Deleted | API 권한이 삭제됩니다. | -| Scope.Data.Updated | API 권한의 데이터가 업데이트됩니다. 예: 권한 설명. | +| 이벤트 타입 | 설명 | +| ------------------ | --------------------------------------------- | +| Scope.Created | 새 API 권한이 생성됨. | +| Scope.Deleted | API 권한이 삭제됨. | +| Scope.Data.Updated | API 권한 데이터가 업데이트됨 (예: 권한 설명). | -### 조직 \{#organization} +### 조직(Organization) \{#organization} -| 이벤트 유형 | 설명 | -| ------------------------------- | -------------------------------------------------------------------- | -| Organization.Created | 새 조직이 생성됩니다. | -| Organization.Deleted | 조직이 삭제됩니다. | -| Organization.Data.Updated | 조직의 데이터가 업데이트됩니다. 예: 조직 이름, 설명, custom.data 등. | -| Organization.Membership.Updated | 조직에 멤버가 추가되거나 제거됩니다. | +| 이벤트 타입 | 설명 | +| ------------------------------- | --------------------------------------------------------------- | +| Organization.Created | 새 조직이 생성됨. | +| Organization.Deleted | 조직이 삭제됨. | +| Organization.Data.Updated | 조직 데이터가 업데이트됨 (예: 조직 이름, 설명, custom.data 등). | +| Organization.Membership.Updated | 조직에 멤버가 추가되거나 제거됨. | -### 조직 역할 \{#organization-role} +### 조직 역할(Organization role) \{#organization-role} -| 이벤트 유형 | 설명 | -| ------------------------------- | ---------------------------------------------------------------- | -| OrganizationRole.Created | 새 조직 역할이 생성됩니다. | -| OrganizationRole.Deleted | 조직 역할이 삭제됩니다. | -| OrganizationRole.Data.Updated | 조직 역할의 데이터가 업데이트됩니다. 예: 조직 역할 이름 및 설명. | -| OrganizationRole.Scopes.Updated | 조직 역할에 할당된 권한이 추가되거나 제거됩니다. | +| 이벤트 타입 | 설명 | +| ------------------------------- | --------------------------------------------------------- | +| OrganizationRole.Created | 새 조직 역할이 생성됨. | +| OrganizationRole.Deleted | 조직 역할이 삭제됨. | +| OrganizationRole.Data.Updated | 조직 역할 데이터가 업데이트됨 (예: 조직 역할 이름, 설명). | +| OrganizationRole.Scopes.Updated | 조직 역할에 할당된 권한이 추가되거나 제거됨. | -### 조직 권한 (스코프) \{#organization-permission-scope} +### 조직 권한(Organization permission, scope) \{#organization-permission-scope} -| 이벤트 유형 | 설명 | -| ------------------------------ | -------------------------------------------------------- | -| OrganizationScope.Created | 새 조직 권한이 생성됩니다. | -| OrganizationScope.Deleted | 조직 권한이 삭제됩니다. | -| OrganizationScope.Data.Updated | 조직 권한의 데이터가 업데이트됩니다. 예: 조직 권한 설명. | +| 이벤트 타입 | 설명 | +| ------------------------------ | --------------------------------------------------- | +| OrganizationScope.Created | 새 조직 권한이 생성됨. | +| OrganizationScope.Deleted | 조직 권한이 삭제됨. | +| OrganizationScope.Data.Updated | 조직 권한 데이터가 업데이트됨 (예: 조직 권한 설명). | ### Management API 트리거 이벤트 \{#management-api-triggered-events} @@ -108,15 +108,23 @@ sidebar_position: 3 ### Interaction API 트리거 이벤트 \{#interaction-api-triggered-events} -| 사용자 상호작용 액션 | 이벤트 | -| ------------------------- | ----------------- | -| 사용자 이메일 / 전화 연결 | User.Data.Updated | -| 사용자 MFA 연결 | User.Data.Updated | -| 사용자 소셜 / SSO 연결 | User.Data.Updated | -| 사용자 비밀번호 재설정 | User.Data.Updated | -| 사용자 등록 | User.Created | +| 사용자 상호작용 액션 | 이벤트 | +| ----------------------- | ----------------- | +| 사용자 이메일/전화 연결 | User.Data.Updated | +| 사용자 MFA 연결 | User.Data.Updated | +| 사용자 소셜/SSO 연결 | User.Data.Updated | +| 사용자 비밀번호 재설정 | User.Data.Updated | +| 사용자 등록 | User.Created | -## 자주 묻는 질문 \{#faqs} +## 예외 훅 이벤트 \{#exception-hook-events} + +### 보안 \{#security} + +| 이벤트 타입 | 설명 | +| ------------------ | ---------------------------------------------- | +| Identifier.Lockout | 여러 번 로그인 실패로 인해 사용자 계정이 잠김. | + +## 자주 묻는 질문(FAQs) \{#faqs}
@@ -125,6 +133,6 @@ sidebar_position: 3 -`PostRegister`는 사용자가 사용자 가입 흐름을 통해 새 계정을 성공적으로 생성할 때 트리거됩니다. `User.Created`는 Management API를 통해 새 사용자 계정이 생성될 때 트리거됩니다. +`PostRegister`는 사용자가 사용자 가입 플로우를 통해 새 계정을 성공적으로 생성할 때 트리거됩니다. `User.Created`는 Management API를 통해 새 사용자 계정이 생성될 때 트리거됩니다.
diff --git a/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 4a6a08f79c0..d1efbff6199 100644 --- a/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/ko/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -1,25 +1,25 @@ --- id: webhooks-request -title: Webhooks request -sidebar_label: Webhooks request +title: Webhooks 요청 +sidebar_label: Webhooks 요청 sidebar_position: 4 --- # Webhooks 요청 -유효한 훅 이벤트가 발생하면, Logto는 해당하는 웹훅을 찾아 각 훅 구성에 따라 POST 요청을 보냅니다. +유효한 hook 이벤트가 발생하면, Logto는 해당하는 webhooks를 찾아 각 hook 설정마다 POST 요청을 보냅니다. ## 요청 헤더 \{#request-headers} -| Key | Customizable | Notes | -| ----------------------- | ------------ | --------------------------------------------------------------------------------------- | -| user-agent | ✅ | 기본값은 `Logto (https://logto.io/)`입니다. | -| content-type | ✅ | 기본값은 `application/json`입니다. | -| logto-signature-sha-256 | | 요청 본문의 서명입니다. [웹훅 보안](/developers/webhooks/secure-webhooks)을 참조하세요. | +| Key | Customizable | Notes | +| ----------------------- | ------------ | ------------------------------------------------------------------------------------------------ | +| user-agent | ✅ | 기본값은 `Logto (https://logto.io/)` 입니다. | +| content-type | ✅ | 기본값은 `application/json` 입니다. | +| logto-signature-sha-256 | | 요청 본문의 서명입니다. [webhooks 보안 설정](/developers/webhooks/secure-webhooks)을 참고하세요. | -동일한 키로 [요청 헤더를 사용자 정의](/developers/webhooks/configure-webhooks/#secure-webhook)하여 사용자 정의 가능한 헤더를 덮어쓸 수 있습니다. +동일한 key로 [요청 헤더 커스터마이즈](/developers/webhooks/configure-webhooks/#secure-webhook)하여 커스터마이즈 가능한 헤더를 덮어쓸 수 있습니다. -## 상호작용 훅 이벤트 요청 본문 \{#interaction-hook-events-request-body} +## 상호작용 hook 이벤트 요청 본문 \{#interaction-hook-events-request-body} 사용 가능한 이벤트: `PostRegister`, `PostSignIn`, `PostResetPassword` @@ -43,75 +43,85 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| Field | Type | Optional | Notes | -| ---------------- | ------------------- | -------- | ----------------------------------------------------------------- | -| hookId | `string` | | Logto에서의 식별자입니다. | -| event | `string` | | 이 훅을 트리거하는 이벤트입니다. | -| createdAt | `string` | | ISO 형식의 페이로드 생성 시간입니다. | -| interactionEvent | `string` | | 이 훅을 트리거하는 상호작용 이벤트입니다. | -| sessionId | `string` | ✅ | 이 이벤트에 대한 세션 ID (상호작용 ID 아님)입니다, 해당하는 경우. | -| userAgent | `string` | ✅ | 이 훅을 트리거하는 요청의 사용자 에이전트입니다. | -| userIp | `string` | ✅ | 이 훅을 트리거하는 요청의 IP 주소입니다. | -| userId | `string` | ✅ | 이 이벤트와 관련된 사용자 ID입니다, 해당하는 경우. | -| user | `UserEntity` | ✅ | 이 이벤트와 관련된 사용자 엔티티입니다, 해당하는 경우. | -| applicationId | `string` | ✅ | 이 이벤트와 관련된 애플리케이션 ID입니다, 해당하는 경우. | -| application | `ApplicationEntity` | ✅ | 이 이벤트와 관련된 애플리케이션 정보입니다, 해당하는 경우. | +| Field | Type | Optional | Notes | +| ---------------- | ------------------- | -------- | --------------------------------------------------------- | +| hookId | `string` | | Logto의 식별자입니다. | +| event | `string` | | 이 hook을 트리거한 이벤트입니다. | +| createdAt | `string` | | 페이로드 생성 시간 (ISO 형식)입니다. | +| interactionEvent | `string` | | 이 hook을 트리거한 상호작용 이벤트입니다. | +| sessionId | `string` | ✅ | 이 이벤트의 세션 ID (Interaction ID 아님), 해당되는 경우. | +| userAgent | `string` | ✅ | 이 hook을 트리거한 요청의 user-agent입니다. | +| userIp | `string` | ✅ | 이 hook을 트리거한 요청의 IP 주소입니다. | +| userId | `string` | ✅ | 이 이벤트와 관련된 사용자 ID, 해당되는 경우. | +| user | `UserEntity` | ✅ | 이 이벤트와 관련된 사용자 엔티티, 해당되는 경우. | +| applicationId | `string` | ✅ | 이 이벤트와 관련된 애플리케이션 ID, 해당되는 경우. | +| application | `ApplicationEntity` | ✅ | 이 이벤트와 관련된 애플리케이션 정보, 해당되는 경우. | -자세한 필드 설명은 [사용자](/user-management/user-data) 및 [애플리케이션](/integrate-logto/application-data-structure) 참조를 확인하세요. +자세한 필드 설명은 [사용자](/user-management/user-data) 및 [애플리케이션](/integrate-logto/application-data-structure) 참고 문서를 확인하세요. -## 데이터 변이 훅 이벤트 요청 본문 \{#data-mutation-hook-events-request-body} +## 데이터 변이 hook 이벤트 요청 본문 \{#data-mutation-hook-events-request-body} ### 표준 요청 본문 필드 \{#standard-request-body-fields} | Field | Type | Optional | Notes | | --------- | -------- | -------- | ------------------------------------ | -| hookId | `string` | | Logto에서의 식별자입니다. | -| event | `string` | | 이 훅을 트리거하는 이벤트입니다. | -| createdAt | `string` | | ISO 형식의 페이로드 생성 시간입니다. | -| userAgent | `string` | ✅ | 요청의 사용자 에이전트입니다. | +| hookId | `string` | | Logto의 식별자입니다. | +| event | `string` | | 이 hook을 트리거한 이벤트입니다. | +| createdAt | `string` | | 페이로드 생성 시간 (ISO 형식)입니다. | +| userAgent | `string` | ✅ | 요청의 user-agent입니다. | | ip | `string` | ✅ | 요청의 IP 주소입니다. | ### 상호작용 API 컨텍스트 본문 필드 \{#interaction-api-context-body-fields} -사용자 상호작용 API 호출에 의해 트리거되는 데이터 변이 훅 이벤트입니다. +사용자 상호작용 API 호출로 트리거되는 데이터 변이 hook 이벤트입니다. 사용 가능한 이벤트: `User.Created`, `User.Data.Updated` -| Field | Type | Optional | Notes | -| ---------------- | ------------------- | -------- | ----------------------------------------------------------------- | -| interactionEvent | `string` | ✅ | 이 훅을 트리거하는 상호작용 이벤트입니다. | -| sessionId | `string` | ✅ | 이 이벤트에 대한 세션 ID (상호작용 ID 아님)입니다, 해당하는 경우. | -| applicationId | `string` | ✅ | 이 이벤트와 관련된 애플리케이션 ID입니다, 해당하는 경우. | -| application | `ApplicationEntity` | ✅ | 이 이벤트와 관련된 애플리케이션 정보입니다, 해당하는 경우. | +| Field | Type | Optional | Notes | +| ---------------- | ------------------- | -------- | --------------------------------------------------------- | +| interactionEvent | `string` | ✅ | 이 hook을 트리거한 상호작용 이벤트입니다. | +| sessionId | `string` | ✅ | 이 이벤트의 세션 ID (Interaction ID 아님), 해당되는 경우. | +| applicationId | `string` | ✅ | 이 이벤트와 관련된 애플리케이션 ID, 해당되는 경우. | +| application | `ApplicationEntity` | ✅ | 이 이벤트와 관련된 애플리케이션 정보, 해당되는 경우. | ### Management API 컨텍스트 본문 필드 \{#management-api-context-body-fields} -Management API 호출에 의해 트리거되는 데이터 변이 훅 이벤트입니다. +Management API 호출로 트리거되는 데이터 변이 hook 이벤트입니다. -| Field | Type | Optional | Notes | -| ------------ | -------- | -------- | ---------------------------------------------------------------------------------------------------------------- | -| path | `string` | ✅ | 이 훅을 트리거하는 API 호출의 경로입니다. | -| method | `string` | ✅ | 이 훅을 트리거하는 API 호출의 메서드입니다. | -| status | `number` | ✅ | 이 훅을 트리거하는 API 호출의 응답 상태 코드입니다. | -| params | `object` | ✅ | 이 훅을 트리거하는 API 호출의 요청 koa 경로 매개변수입니다. | -| matchedRoute | `string` | ✅ | 이 훅을 트리거하는 API 호출의 koa 매칭된 경로입니다. Logto는 이 필드를 사용하여 활성화된 훅 이벤트를 매칭합니다. | +| Field | Type | Optional | Notes | +| ------------ | -------- | -------- | -------------------------------------------------------------------------------------------------------------------- | +| path | `string` | ✅ | 이 hook을 트리거한 API 호출의 경로입니다. | +| method | `string` | ✅ | 이 hook을 트리거한 API 호출의 메서드입니다. | +| status | `number` | ✅ | 이 hook을 트리거한 API 호출의 응답 상태 코드입니다. | +| params | `object` | ✅ | 이 hook을 트리거한 API 호출의 koa path params입니다. | +| matchedRoute | `string` | ✅ | 이 hook을 트리거한 API 호출의 koa 매칭된 라우트입니다. Logto는 이 필드를 사용하여 활성화된 hook 이벤트를 매칭합니다. | ### 데이터 페이로드 본문 필드 \{#data-payload-body-fields} **사용자 이벤트** -| Event | Field | Type | Optional | Notes | -| ----------------- | ----- | ---------- | -------- | ------------------------------------------------ | -| User.Created | data | UserEntity | | 이 이벤트에 대한 생성된 사용자 엔티티입니다. | -| User.Data.Updated | data | UserEntity | | 이 이벤트에 대한 업데이트된 사용자 엔티티입니다. | -| User.Deleted | data | null | / | | +| Event | Field | Type | Optional | Notes | +| ----------------- | ----- | ---------- | -------- | ------------------------------------------- | +| User.Created | data | UserEntity | | 이 이벤트로 생성된 사용자 엔티티입니다. | +| User.Data.Updated | data | UserEntity | | 이 이벤트로 업데이트된 사용자 엔티티입니다. | +| User.Deleted | data | null | / | | **역할 이벤트** @@ -135,21 +145,21 @@ type Scope = { }; ``` -| Event | Field | Type | Optional | Notes | -| ------------------ | ------ | ------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| Role.Created | data | Role | | 이 이벤트에 대한 생성된 역할 엔티티입니다. | -| Role.Data.Updated | data | Role | | 이 이벤트에 대한 업데이트된 역할 엔티티입니다. | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | 역할에 할당된 업데이트된 스코프입니다. | -| Role.Scope.Updated | roleId | string | ✅ | 스코프가 할당된 역할 ID입니다. (사전 할당된 스코프로 새 역할을 생성할 때 이벤트가 트리거된 경우에만 사용 가능) | +| Event | Field | Type | Optional | Notes | +| ------------------ | ------ | ------- | -------- | ------------------------------------------------------------------------------ | +| Role.Created | data | Role | | 이 이벤트로 생성된 역할 엔티티입니다. | +| Role.Data.Updated | data | Role | | 이 이벤트로 업데이트된 역할 엔티티입니다. | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | 역할에 할당된 업데이트된 스코프입니다. | +| Role.Scope.Updated | roleId | string | ✅ | 스코프가 할당된 역할 ID입니다. (사전 할당된 스코프로 새 역할 생성 시에만 제공) | -**권한 (스코프) 이벤트** +**권한(스코프) 이벤트** -| Event | Field | Type | Optional | Notes | -| ------------------ | ----- | ----- | -------- | ------------------------------------------------ | -| Scope.Created | data | Scope | | 이 이벤트에 대한 생성된 스코프 엔티티입니다. | -| Scope.Data.Updated | data | Scope | | 이 이벤트에 대한 업데이트된 스코프 엔티티입니다. | -| Scope.Deleted | data | null | / | | +| Event | Field | Type | Optional | Notes | +| ------------------ | ----- | ----- | -------- | ------------------------------------------- | +| Scope.Created | data | Scope | | 이 이벤트로 생성된 스코프 엔티티입니다. | +| Scope.Data.Updated | data | Scope | | 이 이벤트로 업데이트된 스코프 엔티티입니다. | +| Scope.Deleted | data | null | / | | **조직 이벤트** @@ -163,14 +173,14 @@ type Organization = { }; ``` -| Event | Field | Type | Optional | Notes | -| ------------------------------- | ----- | ------------ | -------- | ---------------------------------------------- | -| Organization.Created | data | Organization | | 이 이벤트에 대한 생성된 조직 엔티티입니다. | -| Organization.Data.Updated | data | Organization | | 이 이벤트에 대한 업데이트된 조직 엔티티입니다. | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| Event | Field | Type | Optional | Notes | +| ------------------------------- | ----- | ------------ | -------- | ----------------------------------------- | +| Organization.Created | data | Organization | | 이 이벤트로 생성된 조직 엔티티입니다. | +| Organization.Data.Updated | data | Organization | | 이 이벤트로 업데이트된 조직 엔티티입니다. | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | -**조직 역할 이벤트** +**OrganizationRole 이벤트** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Event | Field | Type | Optional | Notes | -| ------------------------------ | ------------------ | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | 이 이벤트에 대한 생성된 조직 역할 엔티티입니다. | -| OrganizationRole.Data.Updated | data | OrganizationRole | | 이 이벤트에 대한 업데이트된 조직 역할 엔티티입니다. | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | 스코프가 할당된 역할 ID입니다. (사전 할당된 스코프로 새 역할을 생성할 때 이벤트가 트리거된 경우에만 사용 가능) | +| Event | Field | Type | Optional | Notes | +| ------------------------------ | ------------------ | ---------------- | -------- | ------------------------------------------------------------------------------ | +| OrganizationRole.Created | data | OrganizationRole | | 이 이벤트로 생성된 조직 역할 엔티티입니다. | +| OrganizationRole.Data.Updated | data | OrganizationRole | | 이 이벤트로 업데이트된 조직 역할 엔티티입니다. | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | 스코프가 할당된 역할 ID입니다. (사전 할당된 스코프로 새 역할 생성 시에만 제공) | -**조직 권한 (조직 스코프) 이벤트** +**조직 권한(OrganizationScope) 이벤트** | Event | Field | Type | Optional | Notes | | ------------------------------ | ----- | ----------------- | -------- | ------------------------------------ | | OrganizationScope.Created | data | OrganizationScope | | 생성된 조직 스코프 엔티티입니다. | | OrganizationScope.Data.Updated | data | OrganizationScope | | 업데이트된 조직 스코프 엔티티입니다. | | OrganizationScope.Deleted | data | null | / | | + +## 예외 hook 이벤트 요청 본문 \{#exception-hook-events-request-body} + +사용 가능한 이벤트: `Identifier.Lockout` + +요청 본문은 표준 요청 본문 필드와 아래의 추가 필드를 포함하는 JSON 객체입니다: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| Field | Type | Optional | Notes | +| ---------------- | ------------------- | -------- | --------------------------------------------------------- | +| hookId | `string` | | Logto의 식별자입니다. | +| event | `string` | | 이 hook을 트리거한 이벤트입니다. | +| createdAt | `string` | | 페이로드 생성 시간 (ISO 형식)입니다. | +| userAgent | `string` | ✅ | 요청의 user-agent입니다. | +| ip | `string` | ✅ | 요청의 IP 주소입니다. | +| interactionEvent | `string` | ✅ | 이 hook을 트리거한 상호작용 이벤트입니다. | +| sessionId | `string` | ✅ | 이 이벤트의 세션 ID (Interaction ID 아님), 해당되는 경우. | +| applicationId | `string` | ✅ | 이 이벤트와 관련된 애플리케이션 ID, 해당되는 경우. | +| application | `ApplicationEntity` | ✅ | 이 이벤트와 관련된 애플리케이션 정보, 해당되는 경우. | +| type | `SignInIdentifier` | | 사용자의 식별자 유형 (예: email, phone, username). | +| value | `string` | | 잠금이 발생한 사용자의 식별자 값입니다. | diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index 3504f4dd52e..53000fb9b43 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -9,15 +9,15 @@ sidebar_position: 3 Este guia lista os diferentes eventos de webhook do Logto e explica quando cada evento ocorre. -## Eventos de interação do usuário \{#user-interaction-hook-events} +## Eventos de hook de interação do usuário \{#user-interaction-hook-events} | Tipo de evento | Descrição | | ----------------- | ----------------------------------------------------------------------------------- | -| PostRegister | Um usuário cria com sucesso uma nova conta através da interface de usuário. | -| PostSignIn | Um usuário faz login com sucesso através da interface de usuário. | -| PostResetPassword | A senha de um usuário é redefinida com sucesso através do fluxo "Esqueceu a senha". | +| PostRegister | Um usuário cria com sucesso uma nova conta pela interface de usuário. | +| PostSignIn | Um usuário faz login com sucesso pela interface de usuário. | +| PostResetPassword | A senha de um usuário é redefinida com sucesso pelo fluxo de "Esqueci minha senha". | -## Eventos de mutação de dados \{#data-mutation-hook-events} +## Eventos de hook de mutação de dados \{#data-mutation-hook-events} ### Usuário \{#user} @@ -30,48 +30,48 @@ Este guia lista os diferentes eventos de webhook do Logto e explica quando cada ### Papel (Role) \{#role} -| Tipo de evento | Descrição | -| ------------------- | ----------------------------------------------------------------------------------------------------- | -| Role.Created | Um novo papel é criado. | -| Role.Deleted | Um papel é excluído. | -| Role.Data.Updated | Os dados de um papel são atualizados, por exemplo, nome do papel, descrição e status de papel padrão. | -| Role.Scopes.Updated | Permissões atribuídas a um papel são adicionadas ou removidas. | +| Tipo de evento | Descrição | +| ------------------- | -------------------------------------------------------------------------------------------- | +| Role.Created | Um novo papel é criado. | +| Role.Deleted | Um papel é excluído. | +| Role.Data.Updated | Os dados de um papel são atualizados, por exemplo, nome do papel, descrição e status padrão. | +| Role.Scopes.Updated | Permissões atribuídas a um papel são adicionadas ou removidas. | ### Permissão (Escopo) \{#permission-scope} -| Tipo de evento | Descrição | -| ------------------ | -------------------------------------------------------------------------------------- | -| Scope.Created | Uma nova permissão de API é criada. | -| Scope.Deleted | Uma permissão de API é excluída. | -| Scope.Data.Updated | Os dados de uma permissão de API são atualizados, por exemplo, descrição da permissão. | +| Tipo de evento | Descrição | +| ------------------ | ------------------------------------------------------------------------- | +| Scope.Created | Uma nova permissão de API é criada. | +| Scope.Deleted | Uma permissão de API é excluída. | +| Scope.Data.Updated | Os dados de uma permissão de API são atualizados, por exemplo, descrição. | ### Organização \{#organization} -| Tipo de evento | Descrição | -| ------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| Organization.Created | Uma nova organização é criada. | -| Organization.Deleted | Uma organização é excluída. | -| Organization.Data.Updated | Os dados de uma organização são atualizados, por exemplo, nome da organização, descrição, custom.data, etc. | -| Organization.Membership.Updated | Membros são adicionados ou removidos de uma organização. | +| Tipo de evento | Descrição | +| ------------------------------- | -------------------------------------------------------------------------------------------- | +| Organization.Created | Uma nova organização é criada. | +| Organization.Deleted | Uma organização é excluída. | +| Organization.Data.Updated | Os dados de uma organização são atualizados, por exemplo, nome, descrição, custom.data, etc. | +| Organization.Membership.Updated | Membros são adicionados ou removidos de uma organização. | -### Papel da organização \{#organization-role} +### Papel da organização (Organization role) \{#organization-role} -| Tipo de evento | Descrição | -| ------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | Um novo papel de organização é criado. | -| OrganizationRole.Deleted | Um papel de organização é excluído. | -| OrganizationRole.Data.Updated | Os dados de um papel de organização são atualizados, por exemplo, nome e descrição do papel de organização. | -| OrganizationRole.Scopes.Updated | Permissões atribuídas a um papel de organização são adicionadas ou removidas. | +| Tipo de evento | Descrição | +| ------------------------------- | ----------------------------------------------------------------------------------- | +| OrganizationRole.Created | Um novo papel de organização é criado. | +| OrganizationRole.Deleted | Um papel de organização é excluído. | +| OrganizationRole.Data.Updated | Os dados de um papel de organização são atualizados, por exemplo, nome e descrição. | +| OrganizationRole.Scopes.Updated | Permissões atribuídas a um papel de organização são adicionadas ou removidas. | ### Permissão da organização (escopo) \{#organization-permission-scope} -| Tipo de evento | Descrição | -| ------------------------------ | ------------------------------------------------------------------------------------------------------------- | -| OrganizationScope.Created | Uma nova permissão de organização é criada. | -| OrganizationScope.Deleted | Uma permissão de organização é excluída. | -| OrganizationScope.Data.Updated | Os dados de uma permissão de organização são atualizados, por exemplo, descrição da permissão de organização. | +| Tipo de evento | Descrição | +| ------------------------------ | ---------------------------------------------------------------------------------------------- | +| OrganizationScope.Created | Uma nova permissão de organização é criada. | +| OrganizationScope.Deleted | Uma permissão de organização é excluída. | +| OrganizationScope.Data.Updated | Os dados de uma permissão de organização são atualizados, por exemplo, descrição da permissão. | -### Eventos acionados pela Management API \{#management-api-triggered-events} +### Eventos disparados pela Management API \{#management-api-triggered-events} | Endpoint da API | Evento | | ---------------------------------------------------------- | ----------------------------------------------------------- | @@ -106,25 +106,33 @@ Este guia lista os diferentes eventos de webhook do Logto e explica quando cada | POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated | | DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated | -### Eventos acionados pela Interaction API \{#interaction-api-triggered-events} +### Eventos disparados pela Interaction API \{#interaction-api-triggered-events} | Ação de interação do usuário | Evento | | --------------------------------------- | ----------------- | | Vinculação de email/telefone do usuário | User.Data.Updated | -| Vinculação de MFAs do usuário | User.Data.Updated | +| Vinculação de MFA do usuário | User.Data.Updated | | Vinculação social/SSO do usuário | User.Data.Updated | | Redefinição de senha do usuário | User.Data.Updated | | Registro de usuário | User.Created | -## Perguntas frequentes \{#faqs} +## Eventos de hook de exceção \{#exception-hook-events} + +### Segurança \{#security} + +| Tipo de evento | Descrição | +| ------------------ | ---------------------------------------------------------------------------- | +| Identifier.Lockout | Uma conta de usuário é bloqueada devido a várias tentativas de login falhas. | + +## Perguntas frequentes (FAQs) \{#faqs}
-### Qual é a diferença entre `PostRegister` e `User.Created`? \{#whats-the-difference-between-postregister-and-usercreated} +### Qual a diferença entre `PostRegister` e `User.Created`? \{#whats-the-difference-between-postregister-and-usercreated} -`PostRegister` é acionado quando um usuário cria com sucesso uma nova conta através do fluxo de inscrição do usuário; `User.Created` é acionado quando uma nova conta de usuário é criada através da Management API. +`PostRegister` é disparado quando um usuário cria com sucesso uma nova conta pelo fluxo de cadastro do usuário; `User.Created` é disparado quando uma nova conta de usuário é criada através da Management API.
diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 56d3900df21..611a2caea62 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -1,29 +1,29 @@ --- id: webhooks-request -title: Solicitação de Webhooks -sidebar_label: Solicitação de Webhooks +title: Requisição de Webhooks +sidebar_label: Requisição de Webhooks sidebar_position: 4 --- -# Solicitação de Webhooks +# Requisição de Webhooks -Uma vez que um evento de hook válido é emitido, o Logto encontrará os webhooks correspondentes e enviará uma solicitação POST por configuração de hook. +Uma vez que um evento de hook válido é emitido, o Logto encontrará os webhooks correspondentes e enviará uma requisição POST por configuração de hook. -## Cabeçalhos da solicitação \{#request-headers} +## Cabeçalhos da requisição \{#request-headers} -| Chave | Personalizável | Notas | -| ----------------------- | -------------- | -------------------------------------------------------------------------------------------------------------- | -| user-agent | ✅ | `Logto (https://logto.io/)` por padrão. | -| content-type | ✅ | `application/json` por padrão. | -| logto-signature-sha-256 | | a assinatura do corpo da solicitação, consulte [securing your webhooks](/developers/webhooks/secure-webhooks). | +| Chave | Personalizável | Observações | +| ----------------------- | -------------- | --------------------------------------------------------------------------------------------------------------- | +| user-agent | ✅ | `Logto (https://logto.io/)` por padrão. | +| content-type | ✅ | `application/json` por padrão. | +| logto-signature-sha-256 | | a assinatura do corpo da requisição, consulte [protegendo seus webhooks](/developers/webhooks/secure-webhooks). | -Você pode sobrescrever cabeçalhos personalizáveis [customizando cabeçalhos de solicitação](/developers/webhooks/configure-webhooks/#secure-webhook) com a mesma chave. +Você pode sobrescrever cabeçalhos personalizáveis [personalizando os cabeçalhos da requisição](/developers/webhooks/configure-webhooks/#secure-webhook) com a mesma chave. -## Corpo da solicitação de eventos de hook de interação \{#interaction-hook-events-request-body} +## Corpo da requisição de eventos de interaction hook \{#interaction-hook-events-request-body} Eventos disponíveis: `PostRegister`, `PostSignIn`, `PostResetPassword` -O corpo da solicitação é um objeto JSON que contém três tipos de campo de dados: +O corpo da requisição é um objeto JSON que contém três tipos de campo de dados: ```tsx type UserEntity = { @@ -43,77 +43,87 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| Campo | Tipo | Opcional | Notas | -| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------- | -| hookId | `string` | | O identificador no Logto. | -| event | `string` | | Qual evento aciona este hook. | -| createdAt | `string` | | O tempo de criação do payload em formato ISO. | -| interactionEvent | `string` | | O evento de interação que aciona este hook. | -| sessionId | `string` | ✅ | O ID da Sessão (não o ID de Interação) para este evento, se aplicável. | -| userAgent | `string` | ✅ | O user-agent para a solicitação que aciona este hook. | -| userIp | `string` | ✅ | O endereço IP para a solicitação que aciona este hook. | -| userId | `string` | ✅ | O ID do Usuário relacionado para este evento, se aplicável. | -| user | `UserEntity` | ✅ | A entidade de usuário relacionada para este evento, se aplicável. | -| applicationId | `string` | ✅ | O ID do Aplicativo relacionado para este evento, se aplicável. | -| application | `ApplicationEntity` | ✅ | As informações do aplicativo relacionadas para este evento, se aplicável. | +| Campo | Tipo | Opcional | Observações | +| ---------------- | ------------------- | -------- | ---------------------------------------------------------------------- | +| hookId | `string` | | O identificador no Logto. | +| event | `string` | | Qual evento disparou este hook. | +| createdAt | `string` | | O horário de criação do payload em formato ISO. | +| interactionEvent | `string` | | O evento de interação que disparou este hook. | +| sessionId | `string` | ✅ | O ID da sessão (não o ID de interação) para este evento, se aplicável. | +| userAgent | `string` | ✅ | O user-agent da requisição que disparou este hook. | +| userIp | `string` | ✅ | O endereço IP da requisição que disparou este hook. | +| userId | `string` | ✅ | O ID do usuário relacionado a este evento, se aplicável. | +| user | `UserEntity` | ✅ | A entidade de usuário relacionada a este evento, se aplicável. | +| applicationId | `string` | ✅ | O ID do aplicativo relacionado a este evento, se aplicável. | +| application | `ApplicationEntity` | ✅ | As informações do aplicativo relacionado a este evento, se aplicável. | -Consulte as referências de [Usuários](/user-management/user-data) e [Aplicativos](/integrate-logto/application-data-structure) para explicações detalhadas dos campos. +Veja as referências de [Usuários](/user-management/user-data) e [Aplicativos](/integrate-logto/application-data-structure) para explicações detalhadas dos campos. -## Corpo da solicitação de eventos de mutação de dados \{#data-mutation-hook-events-request-body} +## Corpo da requisição de eventos de data mutation hook \{#data-mutation-hook-events-request-body} -### Campos padrão do corpo da solicitação \{#standard-request-body-fields} +### Campos padrão do corpo da requisição \{#standard-request-body-fields} -| Campo | Tipo | Opcional | Notas | -| --------- | -------- | -------- | --------------------------------------------- | -| hookId | `string` | | O identificador no Logto. | -| event | `string` | | Qual evento aciona este hook. | -| createdAt | `string` | | O tempo de criação do payload em formato ISO. | -| userAgent | `string` | ✅ | O user-agent para a solicitação. | -| ip | `string` | ✅ | O endereço IP para a solicitação. | +| Campo | Tipo | Opcional | Observações | +| --------- | -------- | -------- | ----------------------------------------------- | +| hookId | `string` | | O identificador no Logto. | +| event | `string` | | Qual evento disparou este hook. | +| createdAt | `string` | | O horário de criação do payload em formato ISO. | +| userAgent | `string` | ✅ | O user-agent da requisição. | +| ip | `string` | ✅ | O endereço IP da requisição. | -### Campos do corpo do contexto da API de interação \{#interaction-api-context-body-fields} +### Campos de contexto de Interaction API no corpo \{#interaction-api-context-body-fields} -Eventos de mutação de dados que são acionados por chamadas de API de interação do usuário. +Eventos de data mutation hook disparados por chamadas de API de interação do usuário. Eventos disponíveis: `User.Created`, `User.Data.Updated` -| Campo | Tipo | Opcional | Notas | -| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------- | -| interactionEvent | `string` | ✅ | O evento de interação que aciona este hook. | -| sessionId | `string` | ✅ | O ID da Sessão (não o ID de Interação) para este evento, se aplicável. | -| applicationId | `string` | ✅ | O ID do Aplicativo relacionado para este evento, se aplicável. | -| application | `ApplicationEntity` | ✅ | As informações do aplicativo relacionadas para este evento, se aplicável. | +| Campo | Tipo | Opcional | Observações | +| ---------------- | ------------------- | -------- | ---------------------------------------------------------------------- | +| interactionEvent | `string` | ✅ | O evento de interação que disparou este hook. | +| sessionId | `string` | ✅ | O ID da sessão (não o ID de interação) para este evento, se aplicável. | +| applicationId | `string` | ✅ | O ID do aplicativo relacionado a este evento, se aplicável. | +| application | `ApplicationEntity` | ✅ | As informações do aplicativo relacionado a este evento, se aplicável. | -### Campos do corpo do contexto da Management API \{#management-api-context-body-fields} +### Campos de contexto de Management API no corpo \{#management-api-context-body-fields} -Eventos de mutação de dados que são acionados por chamadas da Management API. +Eventos de data mutation hook disparados por chamadas de Management API. -| Campo | Tipo | Opcional | Notas | -| ------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| path | `string` | ✅ | O caminho da chamada de API que aciona este hook. | -| method | `string` | ✅ | O método da chamada de API que aciona este hook. | -| status | `number` | ✅ | O código de status da resposta da chamada de API que aciona este hook. | -| params | `object` | ✅ | Os parâmetros de caminho koa da solicitação da chamada de API que aciona este hook. | -| matchedRoute | `string` | ✅ | A rota koa correspondente da chamada de API que aciona este hook. O Logto usa este campo para corresponder aos eventos de hook habilitados. | +| Campo | Tipo | Opcional | Observações | +| ------------ | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | +| path | `string` | ✅ | O caminho da chamada de API que disparou este hook. | +| method | `string` | ✅ | O método da chamada de API que disparou este hook. | +| status | `number` | ✅ | O código de status da resposta da chamada de API que disparou este hook. | +| params | `object` | ✅ | Os parâmetros de caminho koa da chamada de API que disparou este hook. | +| matchedRoute | `string` | ✅ | A rota koa correspondente da chamada de API que disparou este hook. O Logto usa este campo para corresponder eventos habilitados. | -### Campos do corpo do payload de dados \{#data-payload-body-fields} +### Campos de payload de dados no corpo \{#data-payload-body-fields} -**Eventos de Usuário** +**Eventos de usuário** -| Evento | Campo | Tipo | Opcional | Notas | +| Evento | Campo | Tipo | Opcional | Observações | | ----------------- | ----- | ---------- | -------- | -------------------------------------------------- | | User.Created | data | UserEntity | | A entidade de usuário criada para este evento. | | User.Data.Updated | data | UserEntity | | A entidade de usuário atualizada para este evento. | | User.Deleted | data | null | / | | -**Eventos de Papel (Role)** +**Eventos de papel (Role)** ```tsx type Role = { @@ -135,23 +145,23 @@ type Scope = { }; ``` -| Evento | Campo | Tipo | Opcional | Notas | -| ------------------ | ------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Role.Created | data | Role | | A entidade de papel criada para este evento. | -| Role.Data.Updated | data | Role | | A entidade de papel atualizada para este evento. | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | Os escopos atualizados atribuídos ao papel. | -| Role.Scope.Updated | roleId | string | ✅ | O ID do papel ao qual os escopos são atribuídos. (Disponível apenas quando o evento foi acionado pela criação de novo papel com escopos pré-atribuídos) | +| Evento | Campo | Tipo | Opcional | Observações | +| ------------------ | ------ | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Role.Created | data | Role | | A entidade de papel criada para este evento. | +| Role.Data.Updated | data | Role | | A entidade de papel atualizada para este evento. | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | Os escopos atualizados atribuídos ao papel. | +| Role.Scope.Updated | roleId | string | ✅ | O ID do papel ao qual os escopos estão atribuídos. (Disponível apenas quando o evento foi disparado por criação de novo papel com escopos pré-atribuídos) | -**Eventos de Permissão (Scope)** +**Eventos de permissão (Scope)** -| Evento | Campo | Tipo | Opcional | Notas | +| Evento | Campo | Tipo | Opcional | Observações | | ------------------ | ----- | ----- | -------- | ------------------------------------------------- | | Scope.Created | data | Scope | | A entidade de escopo criada para este evento. | | Scope.Data.Updated | data | Scope | | A entidade de escopo atualizada para este evento. | | Scope.Deleted | data | null | / | | -**Eventos de Organização (Organization)** +**Eventos de organização (Organization)** ```tsx type Organization = { @@ -163,14 +173,14 @@ type Organization = { }; ``` -| Evento | Campo | Tipo | Opcional | Notas | +| Evento | Campo | Tipo | Opcional | Observações | | ------------------------------- | ----- | ------------ | -------- | ------------------------------------------------------ | | Organization.Created | data | Organization | | A entidade de organização criada para este evento. | | Organization.Data.Updated | data | Organization | | A entidade de organização atualizada para este evento. | | Organization.Deleted | data | null | / | | | Organization.Membership.Updated | data | null | / | | -**Eventos de Papel da Organização (OrganizationRole)** +**Eventos de OrganizationRole** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Evento | Campo | Tipo | Opcional | Notas | -| ------------------------------ | ------------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | A entidade de papel da organização criada para este evento. | -| OrganizationRole.Data.Updated | data | OrganizationRole | | A entidade de papel da organização atualizada para este evento. | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | O ID do papel ao qual os escopos são atribuídos. (Disponível apenas quando o evento foi acionado pela criação de novo papel com escopos pré-atribuídos) | +| Evento | Campo | Tipo | Opcional | Observações | +| ------------------------------ | ------------------ | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | data | OrganizationRole | | A entidade de papel de organização criada para este evento. | +| OrganizationRole.Data.Updated | data | OrganizationRole | | A entidade de papel de organização atualizada para este evento. | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | O ID do papel ao qual os escopos estão atribuídos. (Disponível apenas quando o evento foi disparado por criação de novo papel com escopos pré-atribuídos) | -**Eventos de Permissão da Organização (OrganizationScope)** +**Eventos de permissão de organização (OrganizationScope)** -| Evento | Campo | Tipo | Opcional | Notas | +| Evento | Campo | Tipo | Opcional | Observações | | ------------------------------ | ----- | ----------------- | -------- | ----------------------------------------------- | -| OrganizationScope.Created | data | OrganizationScope | | A entidade de escopo da organização criada. | -| OrganizationScope.Data.Updated | data | OrganizationScope | | A entidade de escopo da organização atualizada. | +| OrganizationScope.Created | data | OrganizationScope | | A entidade de escopo de organização criada. | +| OrganizationScope.Data.Updated | data | OrganizationScope | | A entidade de escopo de organização atualizada. | | OrganizationScope.Deleted | data | null | / | | + +## Corpo da requisição de eventos de exception hook \{#exception-hook-events-request-body} + +Eventos disponíveis: `Identifier.Lockout` + +O corpo da requisição é um objeto JSON que contém os campos padrão do corpo da requisição e campos adicionais conforme abaixo: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| Campo | Tipo | Opcional | Observações | +| ---------------- | ------------------- | -------- | ------------------------------------------------------------------------------------ | +| hookId | `string` | | O identificador no Logto. | +| event | `string` | | Qual evento disparou este hook. | +| createdAt | `string` | | O horário de criação do payload em formato ISO. | +| userAgent | `string` | ✅ | O user-agent da requisição. | +| ip | `string` | ✅ | O endereço IP da requisição. | +| interactionEvent | `string` | ✅ | O evento de interação que disparou este hook. | +| sessionId | `string` | ✅ | O ID da sessão (não o ID de interação) para este evento, se aplicável. | +| applicationId | `string` | ✅ | O ID do aplicativo relacionado a este evento, se aplicável. | +| application | `ApplicationEntity` | ✅ | As informações do aplicativo relacionado a este evento, se aplicável. | +| type | `SignInIdentifier` | | O tipo de identificador do usuário, por exemplo, email, telefone ou nome de usuário. | +| value | `string` | | O valor do identificador do usuário que disparou o bloqueio. | diff --git a/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index d76ed849480..4c05c94b843 100644 --- a/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -7,7 +7,7 @@ sidebar_position: 3 # เหตุการณ์ Webhooks -คู่มือนี้จะแสดงรายการเหตุการณ์ webhook ของ Logto ที่แตกต่างกันและอธิบายว่าแต่ละเหตุการณ์เกิดขึ้นเมื่อใด +คู่มือนี้จะแสดงรายการเหตุการณ์ webhook ของ Logto ที่แตกต่างกัน และอธิบายว่าแต่ละเหตุการณ์เกิดขึ้นเมื่อใด ## เหตุการณ์ hook จากการโต้ตอบของผู้ใช้ \{#user-interaction-hook-events} @@ -21,12 +21,12 @@ sidebar_position: 3 ### ผู้ใช้ \{#user} -| ประเภทเหตุการณ์ | คำอธิบาย | -| ----------------------------- | ---------------------------------------------------------------------------------- | -| User.Created | มีการสร้างบัญชีผู้ใช้ใหม่ | -| User.Deleted | มีการลบบัญชีผู้ใช้ออก | -| User.Data.Updated | ข้อมูลโปรไฟล์ผู้ใช้ถูกอัปเดต เช่น อีเมล รูปประจำตัว custom.data ตัวระบุโซเชียล ฯลฯ | -| User.SuspensionStatus.Updated | สถานะการระงับบัญชีผู้ใช้ถูกเปลี่ยน (ระงับหรือเปิดใช้งานใหม่) | +| ประเภทเหตุการณ์ | คำอธิบาย | +| ----------------------------- | ------------------------------------------------------------------------------ | +| User.Created | มีการสร้างบัญชีผู้ใช้ใหม่ | +| User.Deleted | มีการลบบัญชีผู้ใช้ออก | +| User.Data.Updated | ข้อมูลโปรไฟล์ผู้ใช้ถูกอัปเดต เช่น อีเมล อวาตาร์ custom.data ตัวระบุโซเชียล ฯลฯ | +| User.SuspensionStatus.Updated | สถานะการระงับบัญชีผู้ใช้ถูกเปลี่ยน (ระงับหรือเปิดใช้งานใหม่) | ### บทบาท (Role) \{#role} @@ -37,7 +37,7 @@ sidebar_position: 3 | Role.Data.Updated | ข้อมูลของบทบาทถูกอัปเดต เช่น ชื่อบทบาท คำอธิบาย และสถานะบทบาทเริ่มต้น | | Role.Scopes.Updated | มีการเพิ่มหรือลบสิทธิ์ (permissions) ที่กำหนดให้กับบทบาท | -### สิทธิ์ (ขอบเขต; Permission / Scope) \{#permission-scope} +### สิทธิ์ (Permission; Scope) \{#permission-scope} | ประเภทเหตุการณ์ | คำอธิบาย | | ------------------ | ------------------------------------------------- | @@ -52,18 +52,18 @@ sidebar_position: 3 | Organization.Created | มีการสร้างองค์กรใหม่ | | Organization.Deleted | มีการลบองค์กรออก | | Organization.Data.Updated | ข้อมูลขององค์กรถูกอัปเดต เช่น ชื่อองค์กร คำอธิบาย custom.data ฯลฯ | -| Organization.Membership.Updated | มีการเพิ่มหรือลบสมาชิกออกจากองค์กร | +| Organization.Membership.Updated | มีการเพิ่มหรือลบสมาชิกในองค์กร | ### บทบาทขององค์กร (Organization role) \{#organization-role} | ประเภทเหตุการณ์ | คำอธิบาย | | ------------------------------- | ------------------------------------------------------------- | | OrganizationRole.Created | มีการสร้างบทบาทขององค์กรใหม่ | -| OrganizationRole.Deleted | มีการลบบทบาทขององค์กรออก | +| OrganizationRole.Deleted | มีการลบบทบาทขององค์กร | | OrganizationRole.Data.Updated | ข้อมูลของบทบาทองค์กรถูกอัปเดต เช่น ชื่อบทบาทองค์กรและคำอธิบาย | | OrganizationRole.Scopes.Updated | มีการเพิ่มหรือลบสิทธิ์ที่กำหนดให้กับบทบาทขององค์กร | -### สิทธิ์ขององค์กร (ขอบเขต; Organization permission / scope) \{#organization-permission-scope} +### สิทธิ์ขององค์กร (Organization permission; scope) \{#organization-permission-scope} | ประเภทเหตุการณ์ | คำอธิบาย | | ------------------------------ | -------------------------------------------------------------- | @@ -116,6 +116,14 @@ sidebar_position: 3 | การรีเซ็ตรหัสผ่านผู้ใช้ | User.Data.Updated | | การลงทะเบียนผู้ใช้ | User.Created | +## เหตุการณ์ hook ข้อยกเว้น \{#exception-hook-events} + +### ความปลอดภัย \{#security} + +| ประเภทเหตุการณ์ | คำอธิบาย | +| ------------------ | ---------------------------------------------------------- | +| Identifier.Lockout | บัญชีผู้ใช้ถูกล็อกเนื่องจากพยายามลงชื่อเข้าใช้ผิดหลายครั้ง | + ## คำถามที่พบบ่อย \{#faqs}
diff --git a/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 357e7eed684..1848cf3aa04 100644 --- a/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/th/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -17,13 +17,13 @@ sidebar_position: 4 | content-type | ✅ | ค่าเริ่มต้นคือ `application/json` | | logto-signature-sha-256 | | ลายเซ็นของเนื้อหา request ดูที่ [การรักษาความปลอดภัย webhook ของคุณ](/developers/webhooks/secure-webhooks) | -คุณสามารถเขียนทับส่วนหัวที่ปรับแต่งได้โดย [ปรับแต่ง request](/developers/webhooks/configure-webhooks/#secure-webhook) ด้วย key เดียวกัน +คุณสามารถเขียนทับ header ที่ปรับแต่งได้โดย [ปรับแต่ง request](/developers/webhooks/configure-webhooks/#secure-webhook) header ด้วย key เดียวกัน ## เนื้อหาคำขอของเหตุการณ์ interaction hook \{#interaction-hook-events-request-body} เหตุการณ์ที่ใช้ได้: `PostRegister`, `PostSignIn`, `PostResetPassword` -เนื้อหาคำขอเป็นวัตถุ JSON ที่มีข้อมูล 3 ประเภทดังนี้: +เนื้อหาคำขอเป็นอ็อบเจกต์ JSON ที่มีข้อมูล 3 ประเภทดังนี้: ```tsx type UserEntity = { @@ -43,8 +43,18 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; @@ -64,7 +74,7 @@ type ApplicationEntity = { | applicationId | `string` | ✅ | Application ID ที่เกี่ยวข้องกับเหตุการณ์นี้ (ถ้ามี) | | application | `ApplicationEntity` | ✅ | ข้อมูลแอปพลิเคชันที่เกี่ยวข้องกับเหตุการณ์นี้ (ถ้ามี) | -ดูข้อมูลอ้างอิง [ผู้ใช้](/user-management/user-data) และ [แอปพลิเคชัน](/integrate-logto/application-data-structure) สำหรับคำอธิบายแต่ละฟิลด์โดยละเอียด +ดูข้อมูลอ้างอิง [ผู้ใช้](/user-management/user-data) และ [แอปพลิเคชัน](/integrate-logto/application-data-structure) สำหรับคำอธิบาย field โดยละเอียด ## เนื้อหาคำขอของเหตุการณ์ data mutation hook \{#data-mutation-hook-events-request-body} @@ -78,7 +88,7 @@ type ApplicationEntity = { | userAgent | `string` | ✅ | user-agent ของคำขอ | | ip | `string` | ✅ | ที่อยู่ IP ของคำขอ | -### ฟิลด์ context body ของ Interaction API \{#interaction-api-context-body-fields} +### ฟิลด์ context ของ Interaction API \{#interaction-api-context-body-fields} เหตุการณ์ data mutation hook ที่ถูกเรียกโดยการเรียก API interaction ของผู้ใช้ @@ -91,7 +101,7 @@ type ApplicationEntity = { | applicationId | `string` | ✅ | Application ID ที่เกี่ยวข้องกับเหตุการณ์นี้ (ถ้ามี) | | application | `ApplicationEntity` | ✅ | ข้อมูลแอปพลิเคชันที่เกี่ยวข้องกับเหตุการณ์นี้ (ถ้ามี) | -### ฟิลด์ context body ของ Management API \{#management-api-context-body-fields} +### ฟิลด์ context ของ Management API \{#management-api-context-body-fields} เหตุการณ์ data mutation hook ที่ถูกเรียกโดยการเรียก Management API @@ -101,9 +111,9 @@ type ApplicationEntity = { | method | `string` | ✅ | method ของ API call ที่เรียกใช้ hook นี้ | | status | `number` | ✅ | รหัสสถานะตอบกลับของ API call ที่เรียกใช้ hook นี้ | | params | `object` | ✅ | koa path params ของ API call ที่เรียกใช้ hook นี้ | -| matchedRoute | `string` | ✅ | koa matched route ของ API call ที่เรียกใช้ hook นี้ Logto ใช้ฟิลด์นี้เพื่อจับคู่กับเหตุการณ์ hook ที่เปิดใช้งาน | +| matchedRoute | `string` | ✅ | koa matched route ของ API call ที่เรียกใช้ hook นี้ Logto ใช้ field นี้เพื่อจับคู่กับ hook events ที่เปิดใช้งาน | -### ฟิลด์เนื้อหาข้อมูล (data payload body fields) \{#data-payload-body-fields} +### ฟิลด์เนื้อหาข้อมูล (Data payload body fields) \{#data-payload-body-fields} **เหตุการณ์ผู้ใช้** @@ -135,20 +145,20 @@ type Scope = { }; ``` -| Event | Field | Type | Optional | หมายเหตุ | -| ------------------ | ------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------ | -| Role.Created | data | Role | | entity บทบาทที่ถูกสร้างสำหรับเหตุการณ์นี้ | -| Role.Data.Updated | data | Role | | entity บทบาทที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | scopes ที่ถูกอัปเดตและกำหนดให้กับบทบาทนี้ | -| Role.Scope.Updated | roleId | string | ✅ | role ID ที่ scopes ถูกกำหนดให้ (มีเฉพาะเมื่อเหตุการณ์ถูกเรียกโดยการสร้างบทบาทใหม่พร้อมกำหนด scopes ล่วงหน้า) | +| Event | Field | Type | Optional | หมายเหตุ | +| ------------------ | ------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------- | +| Role.Created | data | Role | | role entity ที่ถูกสร้างสำหรับเหตุการณ์นี้ | +| Role.Data.Updated | data | Role | | role entity ที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | scopes ที่ถูกอัปเดตและกำหนดให้กับ role | +| Role.Scope.Updated | roleId | string | ✅ | role ID ที่ scopes ถูกกำหนดให้ (มีเฉพาะเมื่อเหตุการณ์ถูกเรียกโดยการสร้าง role ใหม่พร้อมกำหนด scopes ล่วงหน้า) | **เหตุการณ์สิทธิ์ (Permission / Scope events)** | Event | Field | Type | Optional | หมายเหตุ | | ------------------ | ----- | ----- | -------- | ------------------------------------------- | -| Scope.Created | data | Scope | | entity scope ที่ถูกสร้างสำหรับเหตุการณ์นี้ | -| Scope.Data.Updated | data | Scope | | entity scope ที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | +| Scope.Created | data | Scope | | scope entity ที่ถูกสร้างสำหรับเหตุการณ์นี้ | +| Scope.Data.Updated | data | Scope | | scope entity ที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | | Scope.Deleted | data | null | / | | **เหตุการณ์องค์กร (Organization events)** @@ -163,12 +173,12 @@ type Organization = { }; ``` -| Event | Field | Type | Optional | หมายเหตุ | -| ------------------------------- | ----- | ------------ | -------- | ------------------------------------------- | -| Organization.Created | data | Organization | | entity องค์กรที่ถูกสร้างสำหรับเหตุการณ์นี้ | -| Organization.Data.Updated | data | Organization | | entity องค์กรที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| Event | Field | Type | Optional | หมายเหตุ | +| ------------------------------- | ----- | ------------ | -------- | -------------------------------------------------- | +| Organization.Created | data | Organization | | organization entity ที่ถูกสร้างสำหรับเหตุการณ์นี้ | +| Organization.Data.Updated | data | Organization | | organization entity ที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | **เหตุการณ์ OrganizationRole** @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Event | Field | Type | Optional | หมายเหตุ | -| ------------------------------ | ------------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------ | -| OrganizationRole.Created | data | OrganizationRole | | entity บทบาทองค์กรที่ถูกสร้างสำหรับเหตุการณ์นี้ | -| OrganizationRole.Data.Updated | data | OrganizationRole | | entity บทบาทองค์กรที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | role ID ที่ scopes ถูกกำหนดให้ (มีเฉพาะเมื่อเหตุการณ์ถูกเรียกโดยการสร้างบทบาทใหม่พร้อมกำหนด scopes ล่วงหน้า) | +| Event | Field | Type | Optional | หมายเหตุ | +| ------------------------------ | ------------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | data | OrganizationRole | | organization role entity ที่ถูกสร้างสำหรับเหตุการณ์นี้ | +| OrganizationRole.Data.Updated | data | OrganizationRole | | organization role entity ที่ถูกอัปเดตสำหรับเหตุการณ์นี้ | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | role ID ที่ scopes ถูกกำหนดให้ (มีเฉพาะเมื่อเหตุการณ์ถูกเรียกโดยการสร้าง role ใหม่พร้อมกำหนด scopes ล่วงหน้า) | **เหตุการณ์สิทธิ์ขององค์กร (Organization permission / OrganizationScope events)** -| Event | Field | Type | Optional | หมายเหตุ | -| ------------------------------ | ----- | ----------------- | -------- | ---------------------------------- | -| OrganizationScope.Created | data | OrganizationScope | | entity scope ขององค์กรที่ถูกสร้าง | -| OrganizationScope.Data.Updated | data | OrganizationScope | | entity scope ขององค์กรที่ถูกอัปเดต | -| OrganizationScope.Deleted | data | null | / | | +| Event | Field | Type | Optional | หมายเหตุ | +| ------------------------------ | ----- | ----------------- | -------- | -------------------------------------- | +| OrganizationScope.Created | data | OrganizationScope | | organization scope entity ที่ถูกสร้าง | +| OrganizationScope.Data.Updated | data | OrganizationScope | | organization scope entity ที่ถูกอัปเดต | +| OrganizationScope.Deleted | data | null | / | | + +## เนื้อหาคำขอของเหตุการณ์ exception hook \{#exception-hook-events-request-body} + +เหตุการณ์ที่ใช้ได้: `Identifier.Lockout` + +เนื้อหาคำขอเป็นอ็อบเจกต์ JSON ที่มีฟิลด์มาตรฐานของเนื้อหาคำขอและฟิลด์เพิ่มเติมดังนี้: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| Field | Type | Optional | หมายเหตุ | +| ---------------- | ------------------- | -------- | ------------------------------------------------------------- | +| hookId | `string` | | ตัวระบุใน Logto | +| event | `string` | | เหตุการณ์ที่เรียกใช้ hook นี้ | +| createdAt | `string` | | เวลาสร้าง payload ในรูปแบบ ISO | +| userAgent | `string` | ✅ | user-agent ของคำขอ | +| ip | `string` | ✅ | ที่อยู่ IP ของคำขอ | +| interactionEvent | `string` | ✅ | เหตุการณ์ interaction ที่เรียกใช้ hook นี้ | +| sessionId | `string` | ✅ | Session ID (ไม่ใช่ Interaction ID) สำหรับเหตุการณ์นี้ (ถ้ามี) | +| applicationId | `string` | ✅ | Application ID ที่เกี่ยวข้องกับเหตุการณ์นี้ (ถ้ามี) | +| application | `ApplicationEntity` | ✅ | ข้อมูลแอปพลิเคชันที่เกี่ยวข้องกับเหตุการณ์นี้ (ถ้ามี) | +| type | `SignInIdentifier` | | ประเภท identifier ของผู้ใช้ เช่น email, phone หรือ username | +| value | `string` | | ค่า identifier ของผู้ใช้ที่ทำให้เกิด lockout | diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index 61797c1c5e4..5c6a1100879 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -1,79 +1,79 @@ --- id: webhooks-events -title: Webhooks events -sidebar_label: Webhooks events +title: Webhook 事件 +sidebar_label: Webhook 事件 sidebar_position: 3 --- -# Webhooks events +# Webhook 事件 -本指南列出了不同的 Logto Webhook 事件,并解释了每个事件发生的时间。 +本指南列出了不同的 Logto Webhook 事件,并解释了每个事件发生的时机。 ## 用户交互钩子事件 \{#user-interaction-hook-events} -| 事件类型 | 描述 | -| ----------------- | -------------------------------------- | -| PostRegister | 用户通过 UI 界面成功创建一个新账户。 | -| PostSignIn | 用户通过 UI 界面成功登录。 | -| PostResetPassword | 用户的密码通过“忘记密码”流程成功重置。 | +| 事件类型 | 描述 | +| ----------------- | ------------------------------------ | +| PostRegister | 用户通过 UI 界面成功创建新账户。 | +| PostSignIn | 用户通过 UI 界面成功登录。 | +| PostResetPassword | 用户通过“忘记密码”流程成功重置密码。 | ## 数据变更钩子事件 \{#data-mutation-hook-events} ### 用户 \{#user} -| 事件类型 | 描述 | -| ----------------------------- | --------------------------------------------------------------------- | -| User.Created | 创建了一个新的用户账户。 | -| User.Deleted | 用户账户被删除。 | -| User.Data.Updated | 用户资料数据被更新,例如,电子邮件、头像、custom.data、社交标识符等。 | -| User.SuspensionStatus.Updated | 用户的暂停状态被更改(暂停或重新激活)。 | +| 事件类型 | 描述 | +| ----------------------------- | ------------------------------------------------------------- | +| User.Created | 创建了一个新用户账户。 | +| User.Deleted | 用户账户被删除。 | +| User.Data.Updated | 用户资料数据被更新,例如邮箱、头像、custom.data、社交标识等。 | +| User.SuspensionStatus.Updated | 用户的封禁状态发生变化(被封禁或重新激活)。 | -### 角色 \{#role} +### 角色 (Role) \{#role} -| 事件类型 | 描述 | -| ------------------- | ------------------------------------------------------ | -| Role.Created | 创建了一个新的角色。 | -| Role.Deleted | 角色被删除。 | -| Role.Data.Updated | 角色的数据被更新,例如,角色名称、描述和默认角色状态。 | -| Role.Scopes.Updated | 分配给角色的权限被添加或移除。 | +| 事件类型 | 描述 | +| ------------------- | ------------------------------------------------------------ | +| Role.Created | 创建了一个新角色 (Role)。 | +| Role.Deleted | 角色 (Role) 被删除。 | +| Role.Data.Updated | 角色 (Role) 的数据被更新,例如角色名称、描述和默认角色状态。 | +| Role.Scopes.Updated | 分配给角色 (Role) 的权限 (Permissions) 被添加或移除。 | -### 权限(Scope) \{#permission-scope} +### 权限 (Scope) \{#permission-scope} -| 事件类型 | 描述 | -| ------------------ | -------------------------------------- | -| Scope.Created | 创建了一个新的 API 权限。 | -| Scope.Deleted | API 权限被删除。 | -| Scope.Data.Updated | API 权限的数据被更新,例如,权限描述。 | +| 事件类型 | 描述 | +| ------------------ | -------------------------------------------------- | +| Scope.Created | 创建了一个新的 API 权限 (Permission)。 | +| Scope.Deleted | API 权限 (Permission) 被删除。 | +| Scope.Data.Updated | API 权限 (Permission) 的数据被更新,例如权限描述。 | -### 组织 \{#organization} +### 组织 (Organization) \{#organization} -| 事件类型 | 描述 | -| ------------------------------- | -------------------------------------------------------- | -| Organization.Created | 创建了一个新的组织。 | -| Organization.Deleted | 组织被删除。 | -| Organization.Data.Updated | 组织的数据被更新,例如,组织名称、描述、custom.data 等。 | -| Organization.Membership.Updated | 成员被添加或从组织中移除。 | +| 事件类型 | 描述 | +| ------------------------------- | ---------------------------------------------------------------------- | +| Organization.Created | 创建了一个新组织 (Organization)。 | +| Organization.Deleted | 组织 (Organization) 被删除。 | +| Organization.Data.Updated | 组织 (Organization) 的数据被更新,例如组织名称、描述、custom.data 等。 | +| Organization.Membership.Updated | 组织 (Organization) 的成员被添加或移除。 | -### 组织角色 \{#organization-role} +### 组织角色 (Organization role) \{#organization-role} -| 事件类型 | 描述 | -| ------------------------------- | ------------------------------------------------ | -| OrganizationRole.Created | 创建了一个新的组织角色。 | -| OrganizationRole.Deleted | 组织角色被删除。 | -| OrganizationRole.Data.Updated | 组织角色的数据被更新,例如,组织角色名称和描述。 | -| OrganizationRole.Scopes.Updated | 分配给组织角色的权限被添加或移除。 | +| 事件类型 | 描述 | +| ------------------------------- | ---------------------------------------------------------------------- | +| OrganizationRole.Created | 创建了一个新的组织角色 (Organization role)。 | +| OrganizationRole.Deleted | 组织角色 (Organization role) 被删除。 | +| OrganizationRole.Data.Updated | 组织角色 (Organization role) 的数据被更新,例如组织角色名称和描述。 | +| OrganizationRole.Scopes.Updated | 分配给组织角色 (Organization role) 的权限 (Permissions) 被添加或移除。 | -### 组织权限(scope) \{#organization-permission-scope} +### 组织权限 (Organization permission, scope) \{#organization-permission-scope} -| 事件类型 | 描述 | -| ------------------------------ | ------------------------------------------ | -| OrganizationScope.Created | 创建了一个新的组织权限。 | -| OrganizationScope.Deleted | 组织权限被删除。 | -| OrganizationScope.Data.Updated | 组织权限的数据被更新,例如,组织权限描述。 | +| 事件类型 | 描述 | +| ------------------------------ | ------------------------------------------------------------------- | +| OrganizationScope.Created | 创建了一个新的组织权限 (Organization permission)。 | +| OrganizationScope.Deleted | 组织权限 (Organization permission) 被删除。 | +| OrganizationScope.Data.Updated | 组织权限 (Organization permission) 的数据被更新,例如组织权限描述。 | -### Management API 触发的事件 \{#management-api-triggered-events} +### Management API 触发事件 \{#management-api-triggered-events} -| API 端点 | 事件 | +| API endpoint | 事件 | | ---------------------------------------------------------- | ----------------------------------------------------------- | | POST /users | User.Created | | DELETE /users/:userId | User.Deleted | @@ -106,25 +106,33 @@ sidebar_position: 3 | POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated | | DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated | -### Interaction API 触发的事件 \{#interaction-api-triggered-events} +### Interaction API 触发事件 \{#interaction-api-triggered-events} -| 用户交互操作 | 事件 | -| --------------------- | ----------------- | -| 用户邮箱 / 手机号绑定 | User.Data.Updated | -| 用户 MFA 绑定 | User.Data.Updated | -| 用户社交 / SSO 绑定 | User.Data.Updated | -| 用户密码重置 | User.Data.Updated | -| 用户注册 | User.Created | +| 用户交互操作 | 事件 | +| ------------------- | ----------------- | +| 用户邮箱/手机号绑定 | User.Data.Updated | +| 用户 MFA 绑定 | User.Data.Updated | +| 用户社交/SSO 绑定 | User.Data.Updated | +| 用户密码重置 | User.Data.Updated | +| 用户注册 | User.Created | + +## 异常钩子事件 \{#exception-hook-events} + +### 安全 \{#security} + +| 事件类型 | 描述 | +| ------------------ | ---------------------------------- | +| Identifier.Lockout | 由于多次登录失败,用户账户被锁定。 | ## 常见问题 \{#faqs}
-### `PostRegister` 和 `User.Created` 之间有什么区别? \{#whats-the-difference-between-postregister-and-usercreated} +### `PostRegister` 和 `User.Created` 有什么区别?\{#whats-the-difference-between-postregister-and-usercreated} -`PostRegister` 是在用户通过用户注册流程成功创建新账户时触发的;`User.Created` 是在通过 Management API 创建新用户账户时触发的。 +`PostRegister` 在用户通过用户注册流程成功创建新账户时触发;`User.Created` 在通过 Management API 创建新用户账户时触发。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 5fb5d22c5ca..17695e64de8 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -1,29 +1,29 @@ --- id: webhooks-request -title: Webhooks 请求 -sidebar_label: Webhooks 请求 +title: Webhook 请求 +sidebar_label: Webhook 请求 sidebar_position: 4 --- -# Webhooks 请求 +# Webhook 请求 -一旦有效的 hook 事件被触发,Logto 将找到相应的 webhooks,并根据每个 hook 配置发送一个 POST 请求。 +当一个有效的 hook 事件被触发后,Logto 会查找对应的 webhook,并根据每个 hook 配置发送一个 POST 请求。 ## 请求头 \{#request-headers} -| Key | Customizable | Notes | -| ----------------------- | ------------ | ------------------------------------------------------------------------------ | -| user-agent | ✅ | 默认是 `Logto (https://logto.io/)`。 | -| content-type | ✅ | 默认是 `application/json`。 | -| logto-signature-sha-256 | | 请求体的签名,参考 [保护你的 webhooks](/developers/webhooks/secure-webhooks)。 | +| Key | 可自定义 | 说明 | +| ----------------------- | -------- | ---------------------------------------------------------------------------- | +| user-agent | ✅ | 默认值为 `Logto (https://logto.io/)`。 | +| content-type | ✅ | 默认值为 `application/json`。 | +| logto-signature-sha-256 | | 请求体的签名,详见[保护你的 webhook](/developers/webhooks/secure-webhooks)。 | -你可以通过使用相同的 key [自定义请求](/developers/webhooks/configure-webhooks/#secure-webhook) 头来覆盖可自定义的头。 +你可以通过[自定义请求](/developers/webhooks/configure-webhooks/#secure-webhook)头部并使用相同的 key 来覆盖可自定义的请求头。 ## 交互 hook 事件请求体 \{#interaction-hook-events-request-body} -可用事件:`PostRegister`,`PostSignIn`,`PostResetPassword` +可用事件:`PostRegister`、`PostSignIn`、`PostResetPassword` -请求体是一个包含三种类型数据字段的 JSON 对象: +请求体是一个包含三类数据字段的 JSON 对象: ```tsx type UserEntity = { @@ -43,77 +43,87 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| Field | Type | Optional | Notes | -| ---------------- | ------------------- | -------- | ------------------------------------------ | -| hookId | `string` | | 在 Logto 中的标识符。 | -| event | `string` | | 触发此 hook 的事件。 | -| createdAt | `string` | | 负载的创建时间,ISO 格式。 | -| interactionEvent | `string` | | 触发此 hook 的交互事件。 | -| sessionId | `string` | ✅ | 此事件的会话 ID(不是交互 ID),如果适用。 | -| userAgent | `string` | ✅ | 触发此 hook 的请求的 user-agent。 | -| userIp | `string` | ✅ | 触发此 hook 的请求的 IP 地址。 | -| userId | `string` | ✅ | 此事件相关的用户 ID,如果适用。 | -| user | `UserEntity` | ✅ | 此事件相关的用户实体,如果适用。 | -| applicationId | `string` | ✅ | 此事件相关的应用 ID,如果适用。 | -| application | `ApplicationEntity` | ✅ | 此事件相关的应用信息,如果适用。 | - -参见 [用户](/user-management/user-data) 和 [应用](/integrate-logto/application-data-structure) 参考以获取详细的字段解释。 +| 字段 | 类型 | 可选 | 说明 | +| ---------------- | ------------------- | ---- | ---------------------------------------------------- | +| hookId | `string` | | Logto 中的标识符。 | +| event | `string` | | 触发此 hook 的事件。 | +| createdAt | `string` | | 负载的创建时间,ISO 格式。 | +| interactionEvent | `string` | | 触发此 hook 的交互事件。 | +| sessionId | `string` | ✅ | 此事件的 Session ID(不是 Interaction ID),如适用。 | +| userAgent | `string` | ✅ | 触发此 hook 的请求的 user-agent。 | +| userIp | `string` | ✅ | 触发此 hook 的请求的 IP 地址。 | +| userId | `string` | ✅ | 此事件相关的用户 ID,如适用。 | +| user | `UserEntity` | ✅ | 此事件相关的用户实体,如适用。 | +| applicationId | `string` | ✅ | 此事件相关的应用 ID,如适用。 | +| application | `ApplicationEntity` | ✅ | 此事件相关的应用信息,如适用。 | + +详细字段说明请参见 [用户](/user-management/user-data) 和 [应用](/integrate-logto/application-data-structure) 参考文档。 ## 数据变更 hook 事件请求体 \{#data-mutation-hook-events-request-body} ### 标准请求体字段 \{#standard-request-body-fields} -| Field | Type | Optional | Notes | -| --------- | -------- | -------- | -------------------------- | -| hookId | `string` | | 在 Logto 中的标识符。 | -| event | `string` | | 触发此 hook 的事件。 | -| createdAt | `string` | | 负载的创建时间,ISO 格式。 | -| userAgent | `string` | ✅ | 请求的 user-agent。 | -| ip | `string` | ✅ | 请求的 IP 地址。 | +| 字段 | 类型 | 可选 | 说明 | +| --------- | -------- | ---- | -------------------------- | +| hookId | `string` | | Logto 中的标识符。 | +| event | `string` | | 触发此 hook 的事件。 | +| createdAt | `string` | | 负载的创建时间,ISO 格式。 | +| userAgent | `string` | ✅ | 请求的 user-agent。 | +| ip | `string` | ✅ | 请求的 IP 地址。 | ### 交互 API 上下文体字段 \{#interaction-api-context-body-fields} 由用户交互 API 调用触发的数据变更 hook 事件。 -可用事件:`User.Created`,`User.Data.Updated` +可用事件:`User.Created`、`User.Data.Updated` -| Field | Type | Optional | Notes | -| ---------------- | ------------------- | -------- | ------------------------------------------ | -| interactionEvent | `string` | ✅ | 触发此 hook 的交互事件。 | -| sessionId | `string` | ✅ | 此事件的会话 ID(不是交互 ID),如果适用。 | -| applicationId | `string` | ✅ | 此事件相关的应用 ID,如果适用。 | -| application | `ApplicationEntity` | ✅ | 此事件相关的应用信息,如果适用。 | +| 字段 | 类型 | 可选 | 说明 | +| ---------------- | ------------------- | ---- | ---------------------------------------------------- | +| interactionEvent | `string` | ✅ | 触发此 hook 的交互事件。 | +| sessionId | `string` | ✅ | 此事件的 Session ID(不是 Interaction ID),如适用。 | +| applicationId | `string` | ✅ | 此事件相关的应用 ID,如适用。 | +| application | `ApplicationEntity` | ✅ | 此事件相关的应用信息,如适用。 | -### 管理 API 上下文体字段 \{#management-api-context-body-fields} +### Management API 上下文体字段 \{#management-api-context-body-fields} -由管理 API 调用触发的数据变更 hook 事件。 +由 Management API 调用触发的数据变更 hook 事件。 -| Field | Type | Optional | Notes | -| ------------ | -------- | -------- | -------------------------------------------------------------------------------- | -| path | `string` | ✅ | 触发此 hook 的 API 调用路径。 | -| method | `string` | ✅ | 触发此 hook 的 API 调用方法。 | -| status | `number` | ✅ | 触发此 hook 的 API 调用的响应状态码。 | -| params | `object` | ✅ | 触发此 hook 的 API 调用的请求 koa 路径参数。 | -| matchedRoute | `string` | ✅ | 触发此 hook 的 API 调用的 koa 匹配路由。Logto 使用此字段来匹配启用的 hook 事件。 | +| 字段 | 类型 | 可选 | 说明 | +| ------------ | -------- | ---- | -------------------------------------------------------------------------------- | +| path | `string` | ✅ | 触发此 hook 的 API 调用路径。 | +| method | `string` | ✅ | 触发此 hook 的 API 调用方法。 | +| status | `number` | ✅ | 触发此 hook 的 API 调用响应状态码。 | +| params | `object` | ✅ | 触发此 hook 的 API 调用的 koa 路径参数。 | +| matchedRoute | `string` | ✅ | 触发此 hook 的 API 调用的 koa 匹配路由。Logto 使用此字段匹配已启用的 hook 事件。 | ### 数据负载体字段 \{#data-payload-body-fields} **用户事件** -| Event | Field | Type | Optional | Notes | -| ----------------- | ----- | ---------- | -------- | ---------------------- | -| User.Created | data | UserEntity | | 此事件创建的用户实体。 | -| User.Data.Updated | data | UserEntity | | 此事件更新的用户实体。 | -| User.Deleted | data | null | / | | +| 事件 | 字段 | 类型 | 可选 | 说明 | +| ----------------- | ---- | ---------- | ---- | ---------------------- | +| User.Created | data | UserEntity | | 此事件创建的用户实体。 | +| User.Data.Updated | data | UserEntity | | 此事件更新的用户实体。 | +| User.Deleted | data | null | / | | -**角色事件** +**角色 (Role) 事件** ```tsx type Role = { @@ -135,23 +145,23 @@ type Scope = { }; ``` -| Event | Field | Type | Optional | Notes | -| ------------------ | ------ | ------- | -------- | --------------------------------------------------------------------- | -| Role.Created | data | Role | | 此事件创建的角色实体。 | -| Role.Data.Updated | data | Role | | 此事件更新的角色实体。 | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | 分配给角色的更新权限。 | -| Role.Scope.Updated | roleId | string | ✅ | 分配权限的角色 ID。(仅在事件由创建具有预分配权限的新角色触发时可用) | +| 事件 | 字段 | 类型 | 可选 | 说明 | +| ------------------ | ------ | ------- | ---- | ------------------------------------------------------------------------------------- | +| Role.Created | data | Role | | 此事件创建的角色 (Role) 实体。 | +| Role.Data.Updated | data | Role | | 此事件更新的角色 (Role) 实体。 | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | 分配给角色 (Role) 的已更新权限 (Scope)。 | +| Role.Scope.Updated | roleId | string | ✅ | 分配权限 (Scope) 的角色 (Role) ID。(仅当事件由创建带有预分配权限的新角色触发时可用) | -**权限(Scope)事件** +**权限 (Scope) 事件** -| Event | Field | Type | Optional | Notes | -| ------------------ | ----- | ----- | -------- | ---------------------- | -| Scope.Created | data | Scope | | 此事件创建的权限实体。 | -| Scope.Data.Updated | data | Scope | | 此事件更新的权限实体。 | -| Scope.Deleted | data | null | / | | +| 事件 | 字段 | 类型 | 可选 | 说明 | +| ------------------ | ---- | ----- | ---- | ------------------------------- | +| Scope.Created | data | Scope | | 此事件创建的权限 (Scope) 实体。 | +| Scope.Data.Updated | data | Scope | | 此事件更新的权限 (Scope) 实体。 | +| Scope.Deleted | data | null | / | | -**组织事件** +**组织 (Organization) 事件** ```tsx type Organization = { @@ -163,14 +173,14 @@ type Organization = { }; ``` -| Event | Field | Type | Optional | Notes | -| ------------------------------- | ----- | ------------ | -------- | ---------------------- | -| Organization.Created | data | Organization | | 此事件创建的组织实体。 | -| Organization.Data.Updated | data | Organization | | 此事件更新的组织实体。 | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| 事件 | 字段 | 类型 | 可选 | 说明 | +| ------------------------------- | ---- | ------------ | ---- | -------------------------------------- | +| Organization.Created | data | Organization | | 此事件创建的组织 (Organization) 实体。 | +| Organization.Data.Updated | data | Organization | | 此事件更新的组织 (Organization) 实体。 | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | -**组织角色事件** +**组织角色 (OrganizationRole) 事件** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| Event | Field | Type | Optional | Notes | -| ------------------------------ | ------------------ | ---------------- | -------- | --------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | 此事件创建的组织角色实体。 | -| OrganizationRole.Data.Updated | data | OrganizationRole | | 此事件更新的组织角色实体。 | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | 分配权限的角色 ID。(仅在事件由创建具有预分配权限的新角色触发时可用) | - -**组织权限(OrganizationScope)事件** - -| Event | Field | Type | Optional | Notes | -| ------------------------------ | ----- | ----------------- | -------- | -------------------- | -| OrganizationScope.Created | data | OrganizationScope | | 创建的组织权限实体。 | -| OrganizationScope.Data.Updated | data | OrganizationScope | | 更新的组织权限实体。 | -| OrganizationScope.Deleted | data | null | / | | +| 事件 | 字段 | 类型 | 可选 | 说明 | +| ------------------------------ | ------------------ | ---------------- | ---- | ----------------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | data | OrganizationRole | | 此事件创建的组织角色 (OrganizationRole) 实体。 | +| OrganizationRole.Data.Updated | data | OrganizationRole | | 此事件更新的组织角色 (OrganizationRole) 实体。 | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | 分配权限 (Scope) 的组织角色 (OrganizationRole) ID。(仅当事件由创建带有预分配权限的新角色触发时可用) | + +**组织权限 (OrganizationScope) 事件** + +| 事件 | 字段 | 类型 | 可选 | 说明 | +| ------------------------------ | ---- | ----------------- | ---- | ----------------------------------------- | +| OrganizationScope.Created | data | OrganizationScope | | 创建的组织权限 (OrganizationScope) 实体。 | +| OrganizationScope.Data.Updated | data | OrganizationScope | | 更新的组织权限 (OrganizationScope) 实体。 | +| OrganizationScope.Deleted | data | null | / | | + +## 异常 hook 事件请求体 \{#exception-hook-events-request-body} + +可用事件:`Identifier.Lockout` + +请求体是一个包含标准请求体字段和如下附加字段的 JSON 对象: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| 字段 | 类型 | 可选 | 说明 | +| ---------------- | ------------------- | ---- | ---------------------------------------------------- | +| hookId | `string` | | Logto 中的标识符。 | +| event | `string` | | 触发此 hook 的事件。 | +| createdAt | `string` | | 负载的创建时间,ISO 格式。 | +| userAgent | `string` | ✅ | 请求的 user-agent。 | +| ip | `string` | ✅ | 请求的 IP 地址。 | +| interactionEvent | `string` | ✅ | 触发此 hook 的交互事件。 | +| sessionId | `string` | ✅ | 此事件的 Session ID(不是 Interaction ID),如适用。 | +| applicationId | `string` | ✅ | 此事件相关的应用 ID,如适用。 | +| application | `ApplicationEntity` | ✅ | 此事件相关的应用信息,如适用。 | +| type | `SignInIdentifier` | | 用户的标识符类型,例如 email、phone 或 username。 | +| value | `string` | | 触发锁定的用户标识符值。 | diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx index 46fd53f49c1..dc1afd1caf2 100644 --- a/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/events.mdx @@ -1,79 +1,79 @@ --- id: webhooks-events -title: Webhooks 事件 -sidebar_label: Webhooks 事件 +title: Webhook 事件 (Webhooks events) +sidebar_label: Webhook 事件 (Webhooks events) sidebar_position: 3 --- -# Webhooks 事件 +# Webhook 事件 (Webhooks events) -本指南列出不同的 Logto Webhook 事件並解釋每個事件發生的時機。 +本指南列出各種 Logto Webhook 事件,並說明每個事件發生的時機。 -## 使用者互動 Hook 事件 \{#user-interaction-hook-events} +## 使用者互動 Hook 事件 (User interaction hook events) \{#user-interaction-hook-events} -| 事件類型 | 描述 | -| ----------------- | ------------------------------------------ | -| PostRegister | 使用者透過 UI 介面成功創建新帳戶。 | -| PostSignIn | 使用者透過 UI 介面成功登入。 | -| PostResetPassword | 使用者的密碼透過「忘記密碼」流程成功重設。 | +| 事件類型 (Event type) | 說明 (Description) | +| --------------------- | ---------------------------------------- | +| PostRegister | 使用者透過 UI 介面成功建立新帳號。 | +| PostSignIn | 使用者透過 UI 介面成功登入。 | +| PostResetPassword | 使用者透過「忘記密碼」流程成功重設密碼。 | -## 資料變更 Hook 事件 \{#data-mutation-hook-events} +## 資料變更 Hook 事件 (Data mutation hook events) \{#data-mutation-hook-events} -### 使用者 \{#user} +### 使用者 (User) \{#user} -| 事件類型 | 描述 | -| ----------------------------- | ----------------------------------------------------------------- | -| User.Created | 新的使用者帳戶被創建。 | -| User.Deleted | 使用者帳戶被刪除。 | -| User.Data.Updated | 使用者資料被更新,例如電子郵件、頭像、custom.data、社交識別符等。 | -| User.SuspensionStatus.Updated | 使用者的停權狀態被更改(停權或重新啟用)。 | +| 事件類型 (Event type) | 說明 (Description) | +| ----------------------------- | ------------------------------------------------------------------- | +| User.Created | 建立新使用者帳號。 | +| User.Deleted | 刪除使用者帳號。 | +| User.Data.Updated | 更新使用者個人資料,例如電子郵件、頭像、custom.data、社交識別碼等。 | +| User.SuspensionStatus.Updated | 使用者停權狀態變更(停權或重新啟用)。 | -### 角色 \{#role} +### 角色 (Role) \{#role} -| 事件類型 | 描述 | -| ------------------- | -------------------------------------------------- | -| Role.Created | 新的角色被創建。 | -| Role.Deleted | 角色被刪除。 | -| Role.Data.Updated | 角色資料被更新,例如角色名稱、描述和預設角色狀態。 | -| Role.Scopes.Updated | 分配給角色的權限被新增或移除。 | +| 事件類型 (Event type) | 說明 (Description) | +| --------------------- | ------------------------------------------------ | +| Role.Created | 建立新角色。 | +| Role.Deleted | 刪除角色。 | +| Role.Data.Updated | 更新角色資料,例如角色名稱、描述、預設角色狀態。 | +| Role.Scopes.Updated | 新增或移除指派給角色的權限。 | -### 權限(權限範圍)\{#permission-scope} +### 權限(Scope)(Permission (Scope)) \{#permission-scope} -| 事件類型 | 描述 | -| ------------------ | ------------------------------------ | -| Scope.Created | 新的 API 權限被創建。 | -| Scope.Deleted | API 權限被刪除。 | -| Scope.Data.Updated | API 權限的資料被更新,例如權限描述。 | +| 事件類型 (Event type) | 說明 (Description) | +| --------------------- | --------------------------------- | +| Scope.Created | 建立新的 API 權限。 | +| Scope.Deleted | 刪除 API 權限。 | +| Scope.Data.Updated | 更新 API 權限資料,例如權限描述。 | -### 組織 \{#organization} +### 組織 (Organization) \{#organization} -| 事件類型 | 描述 | -| ------------------------------- | ------------------------------------------------------ | -| Organization.Created | 新的組織被創建。 | -| Organization.Deleted | 組織被刪除。 | -| Organization.Data.Updated | 組織的資料被更新,例如組織名稱、描述、custom.data 等。 | -| Organization.Membership.Updated | 組織中的成員被新增或移除。 | +| 事件類型 (Event type) | 說明 (Description) | +| ------------------------------- | -------------------------------------------------- | +| Organization.Created | 建立新組織。 | +| Organization.Deleted | 刪除組織。 | +| Organization.Data.Updated | 更新組織資料,例如組織名稱、描述、custom.data 等。 | +| Organization.Membership.Updated | 新增或移除組織成員。 | -### 組織角色 \{#organization-role} +### 組織角色 (Organization role) \{#organization-role} -| 事件類型 | 描述 | -| ------------------------------- | ---------------------------------------------- | -| OrganizationRole.Created | 新的組織角色被創建。 | -| OrganizationRole.Deleted | 組織角色被刪除。 | -| OrganizationRole.Data.Updated | 組織角色的資料被更新,例如組織角色名稱和描述。 | -| OrganizationRole.Scopes.Updated | 分配給組織角色的權限被新增或移除。 | +| 事件類型 (Event type) | 說明 (Description) | +| ------------------------------- | ------------------------------------------ | +| OrganizationRole.Created | 建立新組織角色。 | +| OrganizationRole.Deleted | 刪除組織角色。 | +| OrganizationRole.Data.Updated | 更新組織角色資料,例如組織角色名稱與描述。 | +| OrganizationRole.Scopes.Updated | 新增或移除指派給組織角色的權限。 | -### 組織權限(權限範圍)\{#organization-permission-scope} +### 組織權限(Scope)(Organization permission (scope)) \{#organization-permission-scope} -| 事件類型 | 描述 | -| ------------------------------ | ---------------------------------------- | -| OrganizationScope.Created | 新的組織權限被創建。 | -| OrganizationScope.Deleted | 組織權限被刪除。 | -| OrganizationScope.Data.Updated | 組織權限的資料被更新,例如組織權限描述。 | +| 事件類型 (Event type) | 說明 (Description) | +| ------------------------------ | ------------------------------------ | +| OrganizationScope.Created | 建立新組織權限。 | +| OrganizationScope.Deleted | 刪除組織權限。 | +| OrganizationScope.Data.Updated | 更新組織權限資料,例如組織權限描述。 | -### Management API 觸發的事件 \{#management-api-triggered-events} +### Management API 觸發事件 (Management API triggered events) \{#management-api-triggered-events} -| API 端點 | 事件 | +| API endpoint | 事件 (Event) | | ---------------------------------------------------------- | ----------------------------------------------------------- | | POST /users | User.Created | | DELETE /users/:userId | User.Deleted | @@ -106,25 +106,33 @@ sidebar_position: 3 | POST /organization-roles/:id/scopes | OrganizationRole.Scopes.Updated | | DELETE /organization-roles/:id/scopes/:organizationScopeId | OrganizationRole.Scopes.Updated | -### Interaction API 觸發的事件 \{#interaction-api-triggered-events} +### Interaction API 觸發事件 (Interaction API triggered events) \{#interaction-api-triggered-events} -| 使用者互動操作 | 事件 | -| -------------------------------- | ----------------- | -| 使用者電子郵件 / 電話連結 | User.Data.Updated | -| 使用者 MFA 連結 | User.Data.Updated | -| 使用者社交 / 單一登入 (SSO) 連結 | User.Data.Updated | -| 使用者密碼重設 | User.Data.Updated | -| 使用者註冊 | User.Created | +| 使用者互動行為 (User interaction action) | 事件 (Event) | +| ---------------------------------------- | ----------------- | +| 使用者電子郵件/電話綁定 | User.Data.Updated | +| 使用者 MFA 綁定 | User.Data.Updated | +| 使用者社交/單一登入 (SSO) 綁定 | User.Data.Updated | +| 使用者密碼重設 | User.Data.Updated | +| 使用者註冊 | User.Created | -## 常見問題 \{#faqs} +## 例外 Hook 事件 (Exception hook events) \{#exception-hook-events} + +### 安全性 (Security) \{#security} + +| 事件類型 (Event type) | 說明 (Description) | +| --------------------- | -------------------------------- | +| Identifier.Lockout | 使用者帳號因多次登入失敗被鎖定。 | + +## 常見問題 (FAQs) \{#faqs}
-### `PostRegister` 和 `User.Created` 有什麼區別?\{#whats-the-difference-between-postregister-and-usercreated} +### `PostRegister` 與 `User.Created` 有什麼不同?(What's the difference between `PostRegister` and `User.Created`?) \{#whats-the-difference-between-postregister-and-usercreated} -`PostRegister` 是在使用者透過使用者註冊流程成功創建新帳戶時觸發;`User.Created` 是在透過 Management API 創建新使用者帳戶時觸發。 +`PostRegister` 於使用者透過註冊流程成功建立新帳號時觸發;`User.Created` 則於透過 Management API 建立新使用者帳號時觸發。
diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx index 9808e15cf16..861012c0358 100644 --- a/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/developers/webhooks/request.mdx @@ -1,29 +1,29 @@ --- id: webhooks-request -title: Webhooks 請求 -sidebar_label: Webhooks 請求 +title: Webhooks 請求 (Webhooks request) +sidebar_label: Webhooks 請求 (Webhooks request) sidebar_position: 4 --- -# Webhooks 請求 +# Webhooks 請求 (Webhooks request) -一旦發出有效的 hook 事件,Logto 將尋找相應的 webhooks 並根據每個 hook 配置發送 POST 請求。 +當有效的 hook 事件被觸發時,Logto 會尋找對應的 webhook,並依每個 hook 設定發送一個 POST 請求。 ## 請求標頭 \{#request-headers} -| Key | 可自訂 | 備註 | -| ----------------------- | ------ | -------------------------------------------------------------------------------- | -| user-agent | ✅ | 預設為 `Logto (https://logto.io/)`。 | -| content-type | ✅ | 預設為 `application/json`。 | -| logto-signature-sha-256 | | 請求主體的簽名,參考 [保護你的 webhooks](/developers/webhooks/secure-webhooks)。 | +| Key | 可自訂 | 說明 | +| ----------------------- | ------ | ------------------------------------------------------------------------------ | +| user-agent | ✅ | 預設為 `Logto (https://logto.io/)`。 | +| content-type | ✅ | 預設為 `application/json`。 | +| logto-signature-sha-256 | | 請求主體的簽章,詳見[保護你的 webhook](/developers/webhooks/secure-webhooks)。 | -你可以透過 [自訂請求](/developers/webhooks/configure-webhooks/#secure-webhook) 標頭來覆寫可自訂的標頭。 +你可以透過[自訂請求標頭](/developers/webhooks/configure-webhooks/#secure-webhook)(key 相同時)覆寫可自訂的標頭。 ## 互動 hook 事件請求主體 \{#interaction-hook-events-request-body} 可用事件:`PostRegister`、`PostSignIn`、`PostResetPassword` -請求主體是一個包含三種類型資料欄位的 JSON 物件: +請求主體是一個 JSON 物件,包含三種類型的資料欄位: ```tsx type UserEntity = { @@ -43,75 +43,85 @@ type UserEntity = { ``` ```tsx +enum ApplicationType { + Native = 'Native', + SPA = 'SPA', + Traditional = 'Traditional', + MachineToMachine = 'MachineToMachine', + Protected = 'Protected', + SAML = 'SAML', +} + type ApplicationEntity = { id: string; + type: ApplicationType; name: string; description?: string; }; ``` -| 欄位 | 類型 | 可選擇 | 備註 | -| ---------------- | ------------------- | ------ | -------------------------------------------------- | -| hookId | `string` | | Logto 中的識別符。 | -| event | `string` | | 觸發此 hook 的事件。 | -| createdAt | `string` | | 負載的建立時間,ISO 格式。 | -| interactionEvent | `string` | | 觸發此 hook 的互動事件。 | -| sessionId | `string` | ✅ | 此事件的 Session ID(非 Interaction ID),若適用。 | -| userAgent | `string` | ✅ | 觸發此 hook 的請求的 user-agent。 | -| userIp | `string` | ✅ | 觸發此 hook 的請求的 IP 位址。 | -| userId | `string` | ✅ | 此事件相關的使用者 ID,若適用。 | -| user | `UserEntity` | ✅ | 此事件相關的使用者實體,若適用。 | -| applicationId | `string` | ✅ | 此事件相關的應用程式 ID,若適用。 | -| application | `ApplicationEntity` | ✅ | 此事件相關的應用程式資訊,若適用。 | - -詳細欄位說明請參閱 [使用者](/user-management/user-data) 和 [應用程式](/integrate-logto/application-data-structure) 參考資料。 +| 欄位 | 型別 | 選填 | 說明 | +| ---------------- | ------------------- | ---- | -------------------------------------------------- | +| hookId | `string` | | Logto 中的識別碼。 | +| event | `string` | | 觸發此 hook 的事件。 | +| createdAt | `string` | | 負載建立時間(ISO 格式)。 | +| interactionEvent | `string` | | 觸發此 hook 的互動事件。 | +| sessionId | `string` | ✅ | 此事件的 Session ID(非 Interaction ID),如適用。 | +| userAgent | `string` | ✅ | 觸發此 hook 請求的 user-agent。 | +| userIp | `string` | ✅ | 觸發此 hook 請求的 IP 位址。 | +| userId | `string` | ✅ | 此事件相關的 User ID,如適用。 | +| user | `UserEntity` | ✅ | 此事件相關的使用者實體,如適用。 | +| applicationId | `string` | ✅ | 此事件相關的 Application ID,如適用。 | +| application | `ApplicationEntity` | ✅ | 此事件相關的應用程式資訊,如適用。 | + +詳細欄位說明請參閱 [使用者](/user-management/user-data)與[應用程式](/integrate-logto/application-data-structure)參考文件。 ## 資料變更 hook 事件請求主體 \{#data-mutation-hook-events-request-body} ### 標準請求主體欄位 \{#standard-request-body-fields} -| 欄位 | 類型 | 可選擇 | 備註 | -| --------- | -------- | ------ | -------------------------- | -| hookId | `string` | | Logto 中的識別符。 | -| event | `string` | | 觸發此 hook 的事件。 | -| createdAt | `string` | | 負載的建立時間,ISO 格式。 | -| userAgent | `string` | ✅ | 請求的 user-agent。 | -| ip | `string` | ✅ | 請求的 IP 位址。 | +| 欄位 | 型別 | 選填 | 說明 | +| --------- | -------- | ---- | -------------------------- | +| hookId | `string` | | Logto 中的識別碼。 | +| event | `string` | | 觸發此 hook 的事件。 | +| createdAt | `string` | | 負載建立時間(ISO 格式)。 | +| userAgent | `string` | ✅ | 請求的 user-agent。 | +| ip | `string` | ✅ | 請求的 IP 位址。 | -### 互動 API 上下文主體欄位 \{#interaction-api-context-body-fields} +### 互動 API context 主體欄位 \{#interaction-api-context-body-fields} 由使用者互動 API 呼叫觸發的資料變更 hook 事件。 可用事件:`User.Created`、`User.Data.Updated` -| 欄位 | 類型 | 可選擇 | 備註 | -| ---------------- | ------------------- | ------ | -------------------------------------------------- | -| interactionEvent | `string` | ✅ | 觸發此 hook 的互動事件。 | -| sessionId | `string` | ✅ | 此事件的 Session ID(非 Interaction ID),若適用。 | -| applicationId | `string` | ✅ | 此事件相關的應用程式 ID,若適用。 | -| application | `ApplicationEntity` | ✅ | 此事件相關的應用程式資訊,若適用。 | +| 欄位 | 型別 | 選填 | 說明 | +| ---------------- | ------------------- | ---- | -------------------------------------------------- | +| interactionEvent | `string` | ✅ | 觸發此 hook 的互動事件。 | +| sessionId | `string` | ✅ | 此事件的 Session ID(非 Interaction ID),如適用。 | +| applicationId | `string` | ✅ | 此事件相關的 Application ID,如適用。 | +| application | `ApplicationEntity` | ✅ | 此事件相關的應用程式資訊,如適用。 | -### Management API 上下文主體欄位 \{#management-api-context-body-fields} +### Management API context 主體欄位 \{#management-api-context-body-fields} 由 Management API 呼叫觸發的資料變更 hook 事件。 -| 欄位 | 類型 | 可選擇 | 備註 | -| ------------ | -------- | ------ | --------------------------------------------------------------------------------- | -| path | `string` | ✅ | 觸發此 hook 的 API 呼叫路徑。 | -| method | `string` | ✅ | 觸發此 hook 的 API 呼叫方法。 | -| status | `number` | ✅ | 觸發此 hook 的 API 呼叫的回應狀態碼。 | -| params | `object` | ✅ | 觸發此 hook 的 API 呼叫的請求 koa 路徑參數。 | -| matchedRoute | `string` | ✅ | 觸發此 hook 的 API 呼叫的 koa 匹配路由。 Logto 使用此欄位來匹配啟用的 hook 事件。 | +| 欄位 | 型別 | 選填 | 說明 | +| ------------ | -------- | ---- | ------------------------------------------------------------------------------ | +| path | `string` | ✅ | 觸發此 hook 的 API 呼叫路徑。 | +| method | `string` | ✅ | 觸發此 hook 的 API 呼叫方法。 | +| status | `number` | ✅ | 觸發此 hook 的 API 呼叫回應狀態碼。 | +| params | `object` | ✅ | 觸發此 hook 的 API 請求 koa 路徑參數。 | +| matchedRoute | `string` | ✅ | 觸發此 hook 的 API 呼叫 koa 匹配路由。Logto 會用此欄位比對已啟用的 hook 事件。 | ### 資料負載主體欄位 \{#data-payload-body-fields} **使用者事件** -| 事件 | 欄位 | 類型 | 可選擇 | 備註 | -| ----------------- | ---- | ---------- | ------ | ------------------------ | -| User.Created | data | UserEntity | | 此事件創建的使用者實體。 | -| User.Data.Updated | data | UserEntity | | 此事件更新的使用者實體。 | -| User.Deleted | data | null | / | | +| 事件 | 欄位 | 型別 | 選填 | 說明 | +| ----------------- | ---- | ---------- | ---- | ------------------------ | +| User.Created | data | UserEntity | | 此事件建立的使用者實體。 | +| User.Data.Updated | data | UserEntity | | 此事件更新的使用者實體。 | +| User.Deleted | data | null | / | | **角色事件** @@ -135,23 +145,23 @@ type Scope = { }; ``` -| 事件 | 欄位 | 類型 | 可選擇 | 備註 | -| ------------------ | ------ | ------- | ------ | --------------------------------------------------------------------------------- | -| Role.Created | data | Role | | 此事件創建的角色實體。 | -| Role.Data.Updated | data | Role | | 此事件更新的角色實體。 | -| Role.Deleted | data | null | | | -| Role.Scope.Updated | data | Scope[] | | 分配給角色的更新後的權限範圍。 | -| Role.Scope.Updated | roleId | string | ✅ | 權限範圍分配到的角色 ID。(僅在事件由創建具有預先分配權限範圍的新角色觸發時可用) | +| 事件 | 欄位 | 型別 | 選填 | 說明 | +| ------------------ | ------ | ------- | ---- | ------------------------------------------------------------------------------------ | +| Role.Created | data | Role | | 此事件建立的角色 (Role) 實體。 | +| Role.Data.Updated | data | Role | | 此事件更新的角色 (Role) 實體。 | +| Role.Deleted | data | null | | | +| Role.Scope.Updated | data | Scope[] | | 指派給角色 (Role) 的最新權限範圍 (Scopes)。 | +| Role.Scope.Updated | roleId | string | ✅ | 權限範圍 (Scopes) 指派到的角色 (Role) ID。(僅於建立新角色並預先指派權限範圍時提供) | **權限(Scope)事件** -| 事件 | 欄位 | 類型 | 可選擇 | 備註 | -| ------------------ | ---- | ----- | ------ | -------------------------- | -| Scope.Created | data | Scope | | 此事件創建的權限範圍實體。 | -| Scope.Data.Updated | data | Scope | | 此事件更新的權限範圍實體。 | -| Scope.Deleted | data | null | / | | +| 事件 | 欄位 | 型別 | 選填 | 說明 | +| ------------------ | ---- | ----- | ---- | ----------------------------------- | +| Scope.Created | data | Scope | | 此事件建立的權限範圍 (Scope) 實體。 | +| Scope.Data.Updated | data | Scope | | 此事件更新的權限範圍 (Scope) 實體。 | +| Scope.Deleted | data | null | / | | -**組織事件** +**組織 (Organization) 事件** ```tsx type Organization = { @@ -163,14 +173,14 @@ type Organization = { }; ``` -| 事件 | 欄位 | 類型 | 可選擇 | 備註 | -| ------------------------------- | ---- | ------------ | ------ | ---------------------- | -| Organization.Created | data | Organization | | 此事件創建的組織實體。 | -| Organization.Data.Updated | data | Organization | | 此事件更新的組織實體。 | -| Organization.Deleted | data | null | / | | -| Organization.Membership.Updated | data | null | / | | +| 事件 | 欄位 | 型別 | 選填 | 說明 | +| ------------------------------- | ---- | ------------ | ---- | -------------------------------------- | +| Organization.Created | data | Organization | | 此事件建立的組織 (Organization) 實體。 | +| Organization.Data.Updated | data | Organization | | 此事件更新的組織 (Organization) 實體。 | +| Organization.Deleted | data | null | / | | +| Organization.Membership.Updated | data | null | / | | -**組織角色事件** +**組織角色 (OrganizationRole) 事件** ```tsx type OrganizationRole = { @@ -188,18 +198,46 @@ type OrganizationScope = { }; ``` -| 事件 | 欄位 | 類型 | 可選擇 | 備註 | -| ------------------------------ | ------------------ | ---------------- | ------ | --------------------------------------------------------------------------------- | -| OrganizationRole.Created | data | OrganizationRole | | 此事件創建的組織角色實體。 | -| OrganizationRole.Data.Updated | data | OrganizationRole | | 此事件更新的組織角色實體。 | -| OrganizationRole.Deleted | data | null | / | | -| OrganizationRole.Scope.Updated | data | null | / | | -| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | 權限範圍分配到的角色 ID。(僅在事件由創建具有預先分配權限範圍的新角色觸發時可用) | +| 事件 | 欄位 | 型別 | 選填 | 說明 | +| ------------------------------ | ------------------ | ---------------- | ---- | ---------------------------------------------------------------------------------------------------- | +| OrganizationRole.Created | data | OrganizationRole | | 此事件建立的組織角色 (OrganizationRole) 實體。 | +| OrganizationRole.Data.Updated | data | OrganizationRole | | 此事件更新的組織角色 (OrganizationRole) 實體。 | +| OrganizationRole.Deleted | data | null | / | | +| OrganizationRole.Scope.Updated | data | null | / | | +| OrganizationRole.Scope.Updated | organizationRoleId | string | ✅ | 權限範圍 (Scopes) 指派到的組織角色 (OrganizationRole) ID。(僅於建立新角色並預先指派權限範圍時提供) | **組織權限(OrganizationScope)事件** -| 事件 | 欄位 | 類型 | 可選擇 | 備註 | -| ------------------------------ | ---- | ----------------- | ------ | ------------------------ | -| OrganizationScope.Created | data | OrganizationScope | | 創建的組織權限範圍實體。 | -| OrganizationScope.Data.Updated | data | OrganizationScope | | 更新的組織權限範圍實體。 | -| OrganizationScope.Deleted | data | null | / | | +| 事件 | 欄位 | 型別 | 選填 | 說明 | +| ------------------------------ | ---- | ----------------- | ---- | --------------------------------------------------- | +| OrganizationScope.Created | data | OrganizationScope | | 此事件建立的組織權限範圍 (OrganizationScope) 實體。 | +| OrganizationScope.Data.Updated | data | OrganizationScope | | 此事件更新的組織權限範圍 (OrganizationScope) 實體。 | +| OrganizationScope.Deleted | data | null | / | | + +## 例外 hook 事件請求主體 \{#exception-hook-events-request-body} + +可用事件:`Identifier.Lockout` + +請求主體是一個 JSON 物件,包含標準請求主體欄位與下列額外欄位: + +```tsx +enum SignInIdentifier { + Email = 'email', + Phone = 'phone', + Username = 'username', +} +``` + +| 欄位 | 型別 | 選填 | 說明 | +| ---------------- | ------------------- | ---- | -------------------------------------------------- | +| hookId | `string` | | Logto 中的識別碼。 | +| event | `string` | | 觸發此 hook 的事件。 | +| createdAt | `string` | | 負載建立時間(ISO 格式)。 | +| userAgent | `string` | ✅ | 請求的 user-agent。 | +| ip | `string` | ✅ | 請求的 IP 位址。 | +| interactionEvent | `string` | ✅ | 觸發此 hook 的互動事件。 | +| sessionId | `string` | ✅ | 此事件的 Session ID(非 Interaction ID),如適用。 | +| applicationId | `string` | ✅ | 此事件相關的 Application ID,如適用。 | +| application | `ApplicationEntity` | ✅ | 此事件相關的應用程式資訊,如適用。 | +| type | `SignInIdentifier` | | 使用者的識別類型,例如 email、phone 或 username。 | +| value | `string` | | 觸發鎖定的使用者識別值。 |