NAME
Airlock::Role::Endpoints - The two machine endpoints of Airlock, framework-neutral and as PSGI
VERSION
version 0.001
SYNOPSIS
# PSGI
builder { mount '/airlock' => $airlock->to_app; mount '/' => $app };
# anything else
my ( $status, $headers, $json ) = @{ $airlock->respond( 'POST', '/device', \%params, { ip => $ip, ua => $ua } ) };
DESCRIPTION
The device authorization endpoint and the token endpoint of RFC 8628, answered in one place: "respond". "to_app" is a thin PSGI skin over it that needs neither Plack nor any other framework. Airlock::HTTPMessage is the same for HTTP::Request and HTTP::Response.
Routes are matched on the last path segment, so the endpoints can be mounted anywhere: POST .../device and POST .../token.
max_body
Largest request body, in bytes, the endpoints read. 16384.
respond
my ( $status, $headers, $json ) = @{ $airlock->respond( $method, $path, \%params, \%origin ) };
Answers one request. %params are the decoded form parameters, or anything that is not a hash when the body could not be parsed. Returns the HTTP status, a hash of headers and the response body as a data structure.
encode_body
my $bytes = $airlock->encode_body($json);
The response body as JSON bytes.
parse_form
my $params = $airlock->parse_form($body);
Decodes an application/x-www-form-urlencoded body. Returns nothing when a parameter appears twice, which RFC 6749 forbids.
to_app
my $app = $airlock->to_app;
The two endpoints as a PSGI application.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-airlock/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.