ory / kratos

The most scalable and customizable identity server on the market. Replace your Homegrown, Auth0, Okta, Firebase with better UX and DX. Has all the tablestakes: Passkeys, Social Sign In, Multi-Factor Auth, SMS, SAML, TOTP, and more. Written in Go, cloud native, headless, API-first. Available as a service on Ory Network and for self-hosters.
https://www.ory.sh/?utm_source=github&utm_medium=banner&utm_campaign=kratos
Apache License 2.0
11.24k stars 963 forks source link

Jsonnet flag to skip triggering of web hook #4130

Open renom opened 1 month ago

renom commented 1 month ago

Preflight checklist

Ory Network Project

No response

Describe your problem

Our project needs to run a web hook for a specific identity schema only.

Describe your ideal solution

Setting a specific key in jsonnet to skip triggering of the web hook, for example:

function(ctx) {
  ory.sh/kratos/skip: ctx.identity.schema_id != "specific_schema_id",
}

Then the web hook will be skipped if schema_id isn't "specific_schema_id".

Workarounds or alternatives

Alternative solution would be adding a list of allowed schemas to web hook config:

  - hook: web_hook
    config:
      url: <web_hook_url>
      method: POST
      body: request-data.jsonnet
+     allowed_schemas: ["schema_id_1", "schema_id_2", ...]

Version

1.3.0

Additional Context

No response

renom commented 1 month ago

Sorry, it seems "interrupting" is a wrong word to describe what I meant here. It should be more like skipping of triggering web hook remote url, without actual interrupting of flow. E.g. a remote url is triggered only for specific schemas, while for the others a web hook will be just skipped without an error or interrupting of the flow. I'll update the description of the issue.

renom commented 1 month ago

Done.