* WIP: docs(proxy): describe proxy settings * fix nginx * refactor (docs): deploy and operate sections * chore: ignore package-lock since we use yarn * chore: update to rc1 * chore: broken links * chore: update yarn * docs: move disclaimer to bottom * chore: fix broken links * Update docs/docs/guides/operate/tls_modes.mdx Co-authored-by: Fabi <[email protected]> * test caddy files * syntax highlight * traefik example * refactor: docs * refactor * working state * got a working state * remove bar * mark rate limits for update * remove zitadel.ch * fix cases * docs: zitadel quickstart * docs: zitadel quickstart * docs: create app and project * docs: move customer portal docs to guides manage cloud * docs: move customer portal docs to guides manage cloud * docs: move customer portal docs to guides manage cloud * docs: add help me choose in the quickstart * docs: broken links * fix broken links * Update knative guide * styling * docs: support customer portal * update to main instead v2-alpha * use version 2 tag * docs: images * docs: move authentication and authorization guides to integrate * docs: quickstart use examples * docs: lb example * fix broken link * docs: update userinfo endpoints * docs: update userinfo endpoints * fix oidc endpoint * docs: remove unused endpoints in app.module Co-authored-by: Fabi <[email protected]> Co-authored-by: Fabienne <[email protected]> Co-authored-by: Livio Amstutz <[email protected]>
3.2 KiB
title
| title |
|---|
| Actions |
This page describes the options you have when writing ZITADEL actions scripts.
Language
ZITADEL interpretes the scripts as JavaScript. Make sure your scripts are ECMAScript 5.1(+) compliant. Go to the goja GitHub page for detailed reference about the underlying library features and limitations.
Actions do not have access to any libraries yet. Also, sending HTTP requests is not supported yet. We plan to add such features in the future.
Flows
Each flow type supports its own set of:
- Triggers
- Readable information
- Writable information
For reading and mutating state, the runtime executes the function that has the same name as the action.
The function receives the JavaScript objects ctx and api.
The object ctx provides readable information as object properties and by callable functions.
The object api provides mutable properties and state mutating functions.
The script of an action called doSomething should have a function called doSomething and look something like this:
function doSomething(ctx, api){
// read from ctx and manipulate with api
}
ZITADEL supports only the external authentication flow at the moment. More flows are coming soon.
External authentication flow triggers
- Post authentication: A user has authenticated externally. ZITADEL retrieved and mapped the external information.
- Pre creation: A user selected Register on the overview page after external authentication. ZITADEL did not create the user yet.
- Post creation: A user selected Register on the overview page after external authentication. ZITADEL created the user.
External authentication flow context
ctx.accessToken string
This can be an opaque token or a JWTctx.idToken stringctx.getClaim(string) any
Returns the requested claimctx.claimsJSON() object
Returns the complete payload of thectx.idToken
External authentication flow api
api.setFirstName(string)api.setLastName(string)api.setNickName(string)api.setDisplayName(string)api.setPreferredLanguage(string)api.setGender(Gender)api.setUsername(string)
This function is only available for the pre creation triggerapi.setPreferredUsername(string)
This function is only available for the post authentication triggerapi.setEmail(string)api.setEmailVerified(bool)api.setPhone(string)api.setPhoneVerified(bool)api.metadata array<Metadata>
Push entries.api.userGrants array<UserGrant>
Push entries.
This field is only available for the post creation trigger
External authentication flow types
Genderis a code number
| code | gender |
|---|---|
| 0 | unspecified |
| 1 | female |
| 2 | male |
| 3 | diverse |
UserGrantis a JavaScript object
{
ProjectID: string,
ProjectGrantID: string,
Roles: Array<string>,
}
Metadatais a JavaScript object with string values. The string values must be Base64 encoded