Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/apps-one-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@zitadel/server": minor
"@zitadel/cli": minor
"@zitadel/config": minor
---

Apps: one document per app that holds its clients, the APIs it serves and whether clients may register into it. `POST /apps` creates an app or revises it by slug, and `POST /apps/query`, `GET /apps/{id}` and the revision reads return it with each client's `client_id`. A client keeps the `client_id` the server minted or the one its document chose, for life, states its `type`, and takes RFC 7591's `grant_types`; a confidential client without `grant_types` holds only credentials. Credentials are named and written on their own: `POST /apps/{id}/clients/{client}/credentials` adds a generated secret, shown once, an imported secret or hash, a v4 bcrypt hash included, or a public key, for declared and registered apps alike, and a deploy never removes one; each is listed and revoked on its own. A release declares the developer's own apps from `.zitadel/apps/<slug>.json`, which `zitadel deploy` shows in its diff, and only a release changes them. `zitadel apps create <slug> --preset <preset>` writes that file from one of eight presets, or registers the app through the API with `--registered`; `zitadel apps list` and `apps get` read them, and `@zitadel/config/app` exports the presets. Clients that register themselves through dynamic client registration (RFC 7591) are stored per project under a `dcr_` client_id, with the name, logo and links they claim, and join the app whose API their first authorization request names; one nobody consented to expires an hour after it registered. `POST /client_registrations/query`, `GET /client_registrations/{id}` and `zitadel client-registrations list` and `get` show them, and `DELETE /client_registrations/{id}` or `zitadel client-registrations delete` removes one with the consents users gave it.
7 changes: 7 additions & 0 deletions .redocly.lint-ignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ apps/api/api/openapi/endpoints/schemas/user-schema.yaml:
# a data-format migration.
- '#/properties/objectType'
- '#/properties/metaSchema'
apps/api/api/openapi/endpoints/schemas/app-client-jwk.yaml:
rule/wire-enum-no-camel-case:
# `EdDSA` is the JOSE name of the Ed25519 signature algorithm (RFC 8037), a
# value a JWK carries as written, not a wire enum of ours.
- '#/properties/alg/enum'
apps/api/api/openapi/endpoints/schemas/sso-auth-method.yaml:
no-required-schema-properties-undefined:
# `providers` is defined at the schema root; the if/then/else arms only
Expand All @@ -27,6 +32,8 @@ apps/api/api/openapi/openapi-spec.yaml:
- '#/paths/~1idps~1revisions~1{revision_id}'
# The same for policies, whose ids carry the `pol_` prefix.
- '#/paths/~1policies~1revisions~1{revision_id}'
# The same for apps, whose ids carry the `app_` prefix.
- '#/paths/~1apps~1revisions~1{revision_id}'
apps/api/api/openapi/components/flows/flow-definition-step.yaml:
no-required-schema-properties-undefined:
# Every name is a step property defined at the schema root; each arm of the
Expand Down
21 changes: 21 additions & 0 deletions apps/api/api/cmd/gen_event_schemas/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ var payloadByEventType = map[string]string{

"idp.identity_link.created": "idp-identity-link-created-payload.yaml",

"app.created": "app-payload.yaml",
"app.updated": "app-payload.yaml",
"app.credential.added": "app-credential-payload.yaml",
"app.credential.revoked": "app-credential-payload.yaml",

"client_registration.created": "client-registration-payload.yaml",
"client_registration.deleted": "client-registration-payload.yaml",

"deployment.created": "deployment-created-payload.yaml",

"origin.added": "origin-payload.yaml",
Expand Down Expand Up @@ -185,6 +193,19 @@ var webhookByEventType = map[string]webhookDoc{
"idp.identity_link.created": {description: "A user was linked to an account at an identity provider, " +
"by an SSO sign-in that created the user."},

"app.created": {description: "An app was created, by a release that declares it or through the API."},
"app.updated": {description: "An app was revised. The payload holds the new revision and the fields " +
"that changed."},
"app.credential.added": {description: "A client of an app got a named credential through the API: a " +
"secret the server generated or imported, or a public key."},
"app.credential.revoked": {description: "A credential of a client of an app was revoked; the client's " +
"other credentials keep working."},

"client_registration.created": {description: "A client registered itself through dynamic client " +
"registration (RFC 7591)."},
"client_registration.deleted": {description: "A client registration was deleted, with its consents " +
"and their tokens. A registration purged after its lifetime emits no event."},

"deployment.created": {description: "A release was deployed, or a deployment rolled back. One event " +
"per deployment, however many targets it has."},

Expand Down
2 changes: 1 addition & 1 deletion apps/api/api/cmd/gen_event_schemas/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestPayloadMapCoversDomainEventTypes(t *testing.T) {

eventTypes, err := extractEventTypes(domainEventPath)
require.NoError(t, err)
require.Len(t, eventTypes, 44, "domain EventType constant count changed; update payloadByEventType")
require.Len(t, eventTypes, 50, "domain EventType constant count changed; update payloadByEventType")
require.NoError(t, validateMappings(eventTypes, payloadsDir))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: credential_id
in: path
required: true
description: The id of a credential of the client.
schema:
type: string
example: cred_01KWH3B72K7M7F0N9WD3P2E4YQ
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: client
in: path
required: true
description: The slug of a client of the app.
schema:
type: string
pattern: ^[a-z0-9][a-z0-9_-]*$
maxLength: 64
example: web
7 changes: 7 additions & 0 deletions apps/api/api/openapi/components/parameters/app-id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: id
in: path
required: true
description: The app id, allocated when the app was created.
schema:
type: string
example: app_01KWH3B72K7M7F0N9WD3P2E4YM
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: revision_id
in: path
required: true
description: The id of one revision of an app, the value a release pins.
schema:
type: string
example: apprev_01KWH3B72K7M7F0N9WD3P2E4YN
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: id
in: path
required: true
description: The registration's client_id, which the server minted when the client registered.
schema:
type: string
example: dcr_01KWH3B72K7M7F0N9WD3P2E4YM
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: no API has the identifier

Error code: app.api_not_found
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.api_not_found
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: another client in the project holds the client_id

Error code: app.client_id_taken
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.client_id_taken
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: no client has the client_id

Error code: app.client_not_found
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.client_not_found
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: the client metadata is invalid

Error code: app.client_registration_invalid
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.client_registration_invalid
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: no registered client has the client_id

Error code: app.client_registration_not_found
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.client_registration_not_found
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: the registered client joined another app

Error code: app.client_registration_other_app
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.client_registration_other_app
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: the client secret does not match

Error code: app.client_secret_invalid
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.client_secret_invalid
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: the client holds no credential with the id

Error code: app.credential_not_found
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.credential_not_found
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: another credential of the client has the name or the key id

Error code: app.credential_taken
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.credential_taken
required:
- code
14 changes: 14 additions & 0 deletions apps/api/api/openapi/components/schemas/errors/app-declared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: declared in the release, so only a release changes it

Error code: app.declared
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.declared
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: the field is fixed for the life of the client

Error code: app.field_immutable
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.field_immutable
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: another app in the project holds the API identifier

Error code: app.identifier_taken
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.identifier_taken
required:
- code
14 changes: 14 additions & 0 deletions apps/api/api/openapi/components/schemas/errors/app-invalid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: invalid

Error code: app.invalid
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.invalid
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: a requested scope is unknown or not allowed for the client

Error code: app.invalid_scope
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.invalid_scope
required:
- code
14 changes: 14 additions & 0 deletions apps/api/api/openapi/components/schemas/errors/app-not_found.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: not found

Error code: app.not_found
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.not_found
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: the caller's project role does not allow this operation

Error code: app.permission_denied
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.permission_denied
required:
- code
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by gen_error_schemas; DO NOT EDIT.
description: |
App: another revision of the same app was created at the same instant

Error code: app.revision_conflict
allOf:
- $ref: ../../error-details.yaml
- type: object
properties:
code:
type: string
const: app.revision_conflict
required:
- code
Loading
Loading