NAME

Net::Async::Authentik::API - authentik REST API v3, asynchronously, with idempotent ensure methods

VERSION

version 0.001

SYNOPSIS

my $api = $ak->api;

my $user = await $api->find_user_f('alice');
my $r    = await $api->ensure_user_f( username => 'alice', name => 'Alice', group_names => ['staff'] );
print $r->{changed};        # 'created', 'updated' or ''

DESCRIPTION

The asynchronous WWW::Authentik::API: every method with _f, returning a future of what the synchronous method returns. The rules of the ensure_*_f methods are the same, the comparison is the same WWW::Authentik::Diff, and names are resolved from the same table, so both clients do the same thing to an authentik.

Nothing throws. A missing argument, a missing token or a name nothing matches fails the future.

base_url

Required. The authentik URL without /api/v3.

token

The API token, sent as a bearer token with every call. Without it every method fails with a validation error.

http

Required. The Net::Async::HTTP to send through.

page_size

How many objects a list_*_f asks for per request. Default 100.

diff_class

The class the ensure_*_f methods compare with, WWW::Authentik::Diff — the synchronous client's, so the two cannot drift.

resolvable_fields

uuid_pattern

integer_pattern

The table "resolve_f" works from and the two shapes it takes for an identifier, all three taken from WWW::Authentik::API rather than written again, so that what counts as an identifier is decided in one place. The lookup method named in the table is used with _f appended.

api_url

print $api->api_url;   # https://id.example.org/api/v3

call_f

my $result = await $api->call_f( GET => '/core/users/?username=alice' );
my $result = await $api->call_f( POST => '/core/groups/', { name => 'staff' } );

One request against the API, as call in WWW::Authentik::API. Mind the trailing slash: authentik answers a path without one with 404.

version_f

config_f

settings_f

me_f

As in WWW::Authentik::API.

list_users_f

find_user_f

get_user_f

create_user_f

update_user_f

delete_user_f

set_password_f

create_service_account_f

list_authenticators_f

As in WWW::Authentik::API. find_user_f matches the username exactly and case-sensitively.

list_groups_f

find_group_f

get_group_f

create_group_f

update_group_f

delete_group_f

add_user_to_group_f

remove_user_from_group_f

As in WWW::Authentik::API.

list_tokens_f

find_token_f

get_token_f

create_token_f

update_token_f

delete_token_f

view_token_key_f

set_token_key_f

As in WWW::Authentik::API. expires cannot be chosen; authentik sets it from default_token_duration.

list_applications_f

find_application_f

create_application_f

update_application_f

delete_application_f

check_access_f

As in WWW::Authentik::API, including what a stale for_user does.

list_oauth2_providers_f

find_oauth2_provider_f

get_oauth2_provider_f

create_oauth2_provider_f

update_oauth2_provider_f

delete_oauth2_provider_f

provider_setup_urls_f

preview_user_f

As in WWW::Authentik::API.

list_scope_mappings_f

find_scope_mapping_f

find_scope_mappings_by_scope_f

get_scope_mapping_f

create_scope_mapping_f

update_scope_mapping_f

delete_scope_mapping_f

test_property_mapping_f

As in WWW::Authentik::API.

list_flows_f

find_flow_f

create_flow_f

update_flow_f

delete_flow_f

export_flow_f

As in WWW::Authentik::API. export_flow_f gives the YAML back as a string.

stage_types_f

list_stages_f

find_stage_f

get_stage_f

create_stage_f

update_stage_f

delete_stage_f

As in WWW::Authentik::API. $type is the path under /stages/; all is refused, because that endpoint can only be read.

list_bindings_f

my $bindings = await $api->list_bindings_f( flow => 'my-flow' );

get_binding_f

create_binding_f

update_binding_f

delete_binding_f

As in WWW::Authentik::API.

list_brands_f

current_brand_f

The brand that applies to this request, as the public view: it has neither brand_uuid nor domain, so it cannot be handed to "update_brand_f". Take the brand from "list_brands_f" to change one, as in "current_brand" in WWW::Authentik::API.

update_brand_f

list_certificates_f

find_certificate_f

list_blueprints_f

get_blueprint_f

create_blueprint_f

apply_blueprint_f

delete_blueprint_f

As in WWW::Authentik::API.

resolve_f

my $rep = await $api->resolve_f( { authorization_flow => 'default-authentication-flow' } );

As resolve in WWW::Authentik::API, and from the same table: for every field one shape counts as the identifier and everything else is a name, with <field>_name or <field>_slug forcing the lookup. See "resolve" in WWW::Authentik::API for the table itself.

ensure_user_f

ensure_group_f

ensure_token_f

ensure_application_f

ensure_oauth2_provider_f

ensure_scope_mapping_f

ensure_flow_f

ensure_stage_f

ensure_binding_f

As the ensure_* methods of WWW::Authentik::API, returning a future of { object => \%rep, changed => 'created' | 'updated' | '' }. The same keys are looked up, the same comparison is made, and the same things are refused.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-net-async-authentik/issues.

IRC

Join #kubernetes on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.