WWW-Authentik

 view release on metacpan or  search on metacpan

docs/superpowers/specs/2026-10-04-www-authentik-design.md  view on Meta::CPAN

| `POST /core/users/{pk}/set_password/` `{"password": …}` | 204, auch für `"a"` |
| `POST /core/users/{pk}/recovery/` | 400 `{"non_field_errors":"No recovery flow set."}` |
| `POST /core/users/service_account/` `{"name","create_group":false}` | 200 `{"username","user_uid","user_pk","token"}`; Nutzer `type: service_account`, `path: goauthentik.io/service-accounts` |
| `DELETE /core/users/{pk}/` zweimal | 204 / 404 |
| `GET /core/groups/?name=x`, `POST /core/groups/` | 200 / 201 (`pk` UUID, `num_pk`, `users`, `users_obj`, `parents`, `children`); zweites Mal 400 `{"name":["Group with this name already exists."]}` |
| `PATCH` / `PUT /core/groups/{uuid}/` | 200 / 200; `PUT` mit nur `name` lässt `attributes` stehen |
| `POST /core/groups/{uuid}/add_user/` `{"pk": N}`, `…/remove_user/` | 204 / 204, `remove_user` auch für Nicht-Mitglied 204 |
| `PATCH /core/users/{pk}/` `{"groups": [uuid]}` | 200; Mitgliedschaft auch von der Nutzerseite setzbar |
| `DELETE /core/groups/{uuid}/` zweimal | 204 / 404 |
| `GET /core/tokens/` | 200; `authentik-bootstrap-token` mit `intent: api`, `expiring: false` |
| `POST /core/tokens/` (`identifier`, `intent: api`, `expiring: false`) | 201; zweites Mal 400 `{"identifier":["Token with this identifier already exists."]}` |
| `POST /core/tokens/` mit `expires` +3 s; `PATCH` mit `expires` +2 h | 201 / 200; `expires` beide Male jetzt + 1 Tag |
| `GET /core/tokens/{id}/view_key/`, `POST …/set_key/` `{"key": …}` | 200 `{"key"}` / 204; der gesetzte Schlüssel ist sofort als Bearer gültig |
| `POST /core/tokens/` `intent: app_password` | 201; `view_key` 60 Zeichen |
| `PATCH` / `PUT /core/tokens/{id}/`, `DELETE` zweimal | 200 / 200 / 204 / 404 |
| `GET /core/applications/`, `POST /core/applications/` (`name`, `slug`, ohne `provider`) | 200 / 201 (`pk` = `pbm_uuid`, `provider: null`, `launch_url`, `meta_*`, `policy_engine_mode: any`) |
| `POST /core/applications/` zweites Mal | 400 `{"slug":["Application with this slug already exists."]}`; gleicher `name` mit anderem Slug 201 |
| `POST /core/applications/` `{}` / `slug: "Bad Slug!"` | 400 `{"name":[…],"slug":[…]}` / 400 `{"slug":["Enter a valid “slug” …"]}` |
| `GET /core/applications/{slug}/`, `?slug=x` / `?slug=teil` | 200 / 1 / 0 Treffer |
| `PATCH /core/applications/{slug}/` (`meta_description`, `provider: N`, `slug` umbenennen) | 200; nach dem Umbenennen alter Slug 404 |
| `POST /core/applications/` mit schon vergebenem `provider` | 400 `{"provider":["Application with this provider already exists."]}` |
| `GET /core/applications/{slug}/check_access/` | 200 `{"passing":true,"messages":[],"log_messages":[]}` |
| `DELETE /core/applications/{slug}/` unbekannt | 404 |
| `PUT /core/transactional/applications/` (`app`, `provider_model`, `provider`) | 200 `{"applied":true,"logs":[]}`; zweites Mal 400 `{"app":{"slug":[…already exists.]}}` – nicht wiederholbar |
| `GET /providers/oauth2/`, `POST /providers/oauth2/` `{"name"}` | 200 / 400 `{"authorization_flow":[required],"invalidation_flow":[required],"redirect_uris":[required]}` |
| `POST /providers/oauth2/` vollständig | 201; `pk` Integer, `client_id` 40 Zeichen, `client_secret` 128 Zeichen im Klartext, `grant_types: []`, `redirect_uris[*].redirect_uri_type: "authorization"` ergänzt, `property_mappings` umsortiert |
| `POST /providers/oauth2/` zweites Mal | 400 `{"name":["provider with this name already exists."], …}` |
| `GET /providers/oauth2/?name=x` / `?name=teil` / `?search=teil` | 1 / 0 / 1 Treffer |
| `PATCH /providers/oauth2/{pk}/` `redirect_uris` umgekehrt / `client_secret` / `grant_types` / `issuer_mode` | 200; Reihenfolge der `redirect_uris` und `grant_types` bleibt; `grant_types: ["device_code"]` 400 `{"3":["\"device_code\" is not a valid c...
| `PUT /providers/oauth2/{pk}/` ohne `redirect_uris` / mit `GET`-Body | 400 / 200 |
| `GET /providers/oauth2/{pk}/setup_urls/` vor / nach Zuordnung zur Application | 200 `issuer: null` / 200 mit `issuer`, `provider_info`, `jwks`, `logout`, `dcr_registration` |
| `GET /providers/oauth2/{pk}/preview_user/?for_user=N` | 200 `{"preview": {iss, sub, aud, acr, auth_time, email, …}}` |
| `GET /providers/oauth2/{pk}/used_by/`, `GET /providers/all/` | 200 |
| `DELETE /providers/oauth2/{pk}/` | 204 |
| `GET /propertymappings/provider/scope/` | 200; 9 Default-Mappings mit `managed: goauthentik.io/providers/oauth2/scope-<name>` (dazu eines des Proxy-Providers), `scope_name`, `expression` |
| `POST /propertymappings/provider/scope/` (`name`, `scope_name`, `expression`) | 201 (`pk` UUID, `managed: null`); gleicher `name` 400 `{"name":["Property Mapping with this name already exists."]}`; gleicher `scope_name` 201 |
| `POST …/scope/` mit `expression: "return {"` | 400 `{"expression":["Expression Syntax Error: …"]}` |
| `GET …/scope/?name=x` / `?scope_name=x` / `?managed=…` | 200 |
| `PATCH` / `PUT …/scope/{uuid}/`, `DELETE` | 200 / 200 / 204 |
| `POST /propertymappings/all/{uuid}/test/` `{"user": N}` | 200 `{"result":"{\"probe\": true}","successful":true}` |
| `GET /propertymappings/all/types/`, `GET /propertymappings/all/?managed__isnull=true` | 200 |
| `GET /flows/instances/` | 200; 15 Default-Flows mit `slug`, `designation`, `authentication`, `stages` (UUIDs) |
| `POST /flows/instances/` (`name`, `slug`, `title`, `designation`) | 201 (`pk` UUID, `stages: []`, `layout: stacked`, `denied_action: message_continue`); zweites Mal 400 `{"slug":["Flow with this slug already exists."]}` |
| `PATCH` / `PUT /flows/instances/{slug}/`, `PUT` mit `GET`-Body | 200 |
| `GET /flows/instances/{slug}/export/` | 200, `content-type: text/html`, Body YAML (`version`, `entries`) |
| `DELETE /flows/instances/{slug}/` zweimal | 204 / 404 |
| `GET /stages/all/types/`, `GET /stages/all/`, `GET /stages/all/?name=x`, `GET /stages/all/{uuid}/` | 200; 25 Typen; `{uuid}` liefert nur `pk`, `name`, `component`, `verbose_name`, `meta_model_name`, `flow_set`, keine typisierten Felder |
| `PATCH /stages/all/{uuid}/` | 405 |
| `POST /stages/password/` (`name`, `backends`) | 201; gleicher `name` 400 `{"name":["stage with this name already exists."]}`, auch an `/stages/user_login/` |
| `PATCH` / `PUT /stages/password/{uuid}/` | 200; `backends`-Reihenfolge bleibt |
| `GET /stages/authenticator/validate/`, `/stages/password/`, `/stages/identification/`, `/stages/authenticator/totp/`, `/stages/user_login/` | 200, typisierte Felder (`not_configured_action: skip`, `device_classes`, `last_auth_threshold`, `backends`...
| `PATCH /stages/authenticator/validate/{uuid}/` `{"not_configured_action":"deny"}` | 200 |
| dasselbe mit `"configure"` ohne `configuration_stages` / mit beiden Feldern in einem `PATCH` | 400 `{"not_configured_action":["When \"Not configured action\" is set to \"Configure\", you must set a configuration stage."]}` / 200 |
| `PUT /stages/authenticator/validate/{uuid}/` mit `GET`-Body | 200 |
| `DELETE /stages/password/{uuid}/` mit Binding | 204; Binding danach weg |
| `GET /flows/bindings/?target=<slug>` / `?target=<uuid>` | 400 `{"target":["… is not a valid UUID."]}` / 200 mit `order`, `stage`, `stage_obj`, `evaluate_on_plan`, `re_evaluate_policies` |
| `POST /flows/bindings/` (`target`, `stage`, `order`) | 201; gleiche drei 400 `{"non_field_errors":["The fields target, stage, order must make a unique set."]}`; andere `order` 201 |
| `PATCH` / `PUT /flows/bindings/{uuid}/`, `DELETE` | 200 / 200 / 204 |
| `GET /policies/bindings/` | 200 (`target`, `policy`, `group`, `user`, `order`, `enabled`) |
| `GET /core/brands/`, `PATCH /core/brands/{uuid}/` `{"flow_device_code": uuid}`, `PUT` mit `GET`-Body | 200 / 200 / 200 |
| `GET /crypto/certificatekeypairs/` | 200; `authentik Self-signed Certificate`, `private_key_available: true` |
| `GET /managed/blueprints/`, `GET …/available/` | 200; 31 Instanzen, 45 Dateien |
| `POST /managed/blueprints/` mit `content` (Inline-YAML, Gruppe `state: present`) | 201 `status: unknown` |
| `POST /managed/blueprints/{uuid}/apply/` | 200, `status` noch `unknown`; 3 s später `successful`, `last_applied`, Gruppe vorhanden; zweites `apply` ändert nichts, Gruppe weiter genau einmal |
| `POST /managed/blueprints/` mit unbekanntem Model | 400 `{"content":["Failed to validate blueprint","- App or Model does not exist",…]}` |
| `GET /oauth2/access_tokens/`, `GET /oauth2/refresh_tokens/` | 200; `scope` als Liste, `revoked`, `expires`, `id_token`; das Token selbst wird nicht ausgegeben |
| `GET /authenticators/admin/totp/?user=N`, `GET /authenticators/admin/all/?user=N` | 200 |
| `POST /authenticators/admin/totp/` `{"name"}` | 500, leerer Body (`IntegrityError: null value in column "user_id"`) |
| `POST /core/groups/` als Formular statt JSON / mit kaputtem JSON | 415 / 400 `{"detail":"JSON parse error - …"}` |
| `GET /core/users` ohne Schrägstrich | 404 |
| `OPTIONS /core/users/{pk}/` | `allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS` |

### 8.2 OIDC

| Aufruf | Antwort |
|---|---|
| `GET /application/o/{slug}/.well-known/openid-configuration` | 200; `issuer` mit Slug, `device_authorization_endpoint`, `introspection_endpoint`, `revocation_endpoint`, `end_session_endpoint` mit Slug, `grant_types_supported` folgt den `grant_types...
| Discovery für unbekannten Slug / Application ohne Provider | 404 / 404 |
| `GET /application/o/{slug}/jwks/` | 200; ein RSA-Schlüssel mit `kid`, `x5c` |
| `POST /application/o/token/` `client_credentials` an Provider mit `grant_types: []` | 400 `invalid_grant` |
| `POST /application/o/token/` `client_credentials` + `client_secret` | 200 `{access_token, id_token, token_type, scope, expires_in: 300}`; Nutzer `ak-<provider>-client_credentials` wird angelegt (`type: service_account`, `path: goauthentik.io/apps/<...
| dasselbe mit `-u client_id:client_secret` (Basic) | 200 |
| `client_credentials` + `username`/`password` (Service-Account, App-Password-Token) | 200; `sub` des Service-Accounts |
| `grant_type=password` mit Service-Account / mit normalem Nutzer | 200 / 400 `invalid_grant` |
| falsches Secret / unbekannter Client / `grant_type=banana` / Refresh-Token `garbage` / Code `garbage` | 400 `invalid_grant` / 400 `invalid_client` / 400 `unsupported_grant_type` / 400 `invalid_grant` / 400 `invalid_grant` |
| `GET /application/o/authorize/?response_type=code…` ohne Sitzung | 302 nach `/if/flow/default-authentication-flow/?…&next=…` |
| dasselbe mit Sitzung (implicit consent) | 302 `https://app.example.org/cb?code=…&state=…` |
| dasselbe mit `max_age=0` / `acr_values=…` | 302 mit Code, kein neuer Login |
| `POST /application/o/token/` `authorization_code` | 200 `{access_token, id_token, refresh_token, scope, token_type, expires_in}`; `refresh_token` 128 Zeichen, kein JWT; Code zweites Mal 400 `invalid_grant` |
| `GET /application/o/userinfo/` Bearer / `POST` mit `access_token` | 200 / 200 `{sub, email, name, preferred_username, groups, nonce}` |
| Userinfo mit ungültigem Token | 401, leerer Body, `WWW-Authenticate: error="invalid_token"` |
| `POST /application/o/introspect/` Access-Token / Refresh-Token / ID-Token | 200 `{active: true, scope, client_id, amr, acr, auth_time, …}` / 200 `active: true` / 200 `{"active":false}` |
| Introspect mit falschem Secret | 200 `{"active":false}` (kein 401) |
| `POST /application/o/token/` `refresh_token` | 200, neues Refresh-Token; das alte danach 400 `invalid_grant`; `scope=openid` als Teilmenge 400 `invalid_scope`; das alte Access-Token bleibt bis `exp` gültig |
| `POST /application/o/revoke/` Access-Token / zweites Mal / `garbage` / falsches Secret | 200 `{}` / 200 / 200 / 401 `invalid_client` |
| Introspect / Userinfo nach Revoke | `{"active":false}` / 401 |
| `POST /application/o/device/` `client_id`, `scope` | 200 `{device_code (128 Zeichen), user_code (9 Ziffern), verification_uri: <base_url>/device, verification_uri_complete: <base_url>/device?code=<user_code>, expires_in: 60, interval: 5}`; unbekann...
| `POST /application/o/token/` `device_code` vor Bestätigung / sofort noch einmal / nach Bestätigung / danach / nach 60 s | 400 `authorization_pending` / 400 `authorization_pending` (kein `slow_down`) / 200 mit `amr: ["pwd"]` / 400 `invalid_grant` ...
| `GET /device?code=…` ohne / mit Sitzung | 302 `/flows/-/default/authentication/?next=…` / 302 `/if/flow/default-provider-authorization-implicit-consent/?code=…` |
| `GET /application/o/{slug}/end-session/` mit Sitzung | 302 `/if/flow/default-provider-invalidation-flow/`; die Sitzung lebt, bis der Flow ausgeführt ist |

### 8.3 Login über die Flow-Executor-API

Der Browser-Login ist eine JSON-API und ließ sich vollständig per HTTP fahren. Cookie-Jar
nötig (`authentik_session`, `authentik_csrf`); der CSRF-Wert geht als Header
`X-authentik-CSRF` mit. Jede Antwort `302` heißt „nächste Stage“: ihr `Location` ist
dieselbe Executor-Adresse, die man dann mit `GET` holt.

```
GET  /api/v3/flows/executor/default-authentication-flow/?query=
     200 {"component":"ak-stage-identification", "user_fields":["email","username"], …}
POST …  {"component":"ak-stage-identification","uid_field":"probe-alice"}
     302 → GET: 200 {"component":"ak-stage-password","pending_user":"probe-alice"}
POST …  {"component":"ak-stage-password","password":"…"}
     302 → GET: 302 → GET: 200 {"component":"xak-flow-redirect","to":"/","final_redirect":true}
GET  /api/v3/core/users/me/ (mit Cookies)   200 {"user":{"username":"probe-alice"}}
```

Mit eingerichtetem TOTP kommt nach dem Passwort statt der zweiten 302:

```



( run in 0.482 second using v1.01-cache-2.11-cpan-8379b9b8ec2 )