WWW-Authentik

 view release on metacpan or  search on metacpan

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

| `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` |

t/50-api.t  view on Meta::CPAN

};

subtest 'brands, certificates and blueprints' => sub {
  ok( $api->current_brand, 'current_brand' );
  ok( scalar @{ $api->list_brands }, 'list_brands' );
  # the public view cannot be written back; the list is where the key is
  my ( $brand ) = grep { $_->{default} } @{ $api->list_brands };
  ok( $brand && $brand->{brand_uuid}, 'the list carries the brand_uuid' );
  is( $api->update_brand( $brand->{brand_uuid}, { branding_title => 'Probe' } )->{branding_title}, 'Probe', 'update_brand' );

  is( $api->find_certificate('authentik Self-signed Certificate')->{private_key_available}, 1, 'find_certificate' );
  is( $api->find_certificate('nope'), undef, 'and nothing for an unknown one' );

  my $blueprint = $api->create_blueprint( { name => 'probe', content => "version: 1\n" } );
  is( $blueprint->{status}, 'unknown', 'a new blueprint has not run yet' );
  is( $api->apply_blueprint( $blueprint->{pk} )->{status}, 'successful', 'apply_blueprint' );
  is( $api->get_blueprint( $blueprint->{pk} )->{status}, 'successful', 'get_blueprint' );
  ok( $api->delete_blueprint( $blueprint->{pk} ), 'delete_blueprint' );
};

done_testing;

t/lib/FakeAuthentik.pm  view on Meta::CPAN

    defaults => { evaluate_on_plan => \0, re_evaluate_policies => \1, policy_engine_mode => 'any', invalid_response_action => 'retry' }
  },
  stages => {
    path => '/api/v3/stages/', detail => 'pk', key => 'name', model => 'Stage', pk => 'uuid',
    required => [qw( name )], duplicate => 'stage with this name already exists.',
    defaults => {}
  },
  certificates => {
    path => '/api/v3/crypto/certificatekeypairs/', detail => 'pk', key => 'name', model => 'CertificateKeyPair', pk => 'uuid',
    required => [qw( name )], duplicate => 'Certificate-Key Pair with this name already exists.',
    defaults => { private_key_available => \1, managed => undef }
  },
  brands => {
    path => '/api/v3/core/brands/', detail => 'brand_uuid', key => 'domain', model => 'Brand', pk => 'uuid',
    required => [qw( domain )], duplicate => 'Brand with this domain already exists.',
    defaults => { default => \0 }
  },
  blueprints => {
    path => '/api/v3/managed/blueprints/', detail => 'pk', key => 'name', model => 'BlueprintInstance', pk => 'uuid',
    required => [qw( name )], duplicate => 'Blueprint Instance with this name already exists.',
    defaults => { enabled => \1, status => 'unknown', managed_models => [], metadata => {}, context => {} }



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