NAME
Langertha::Knarr::Authorizer::StaticKey - One shared proxy key for every route and model (auth_token)
VERSION
version 1.103
SYNOPSIS
use Langertha::Knarr::Authorizer::StaticKey;
my $knarr = Langertha::Knarr->new(
handler => $handler,
authorizer => Langertha::Knarr::Authorizer::StaticKey->new( key => 'sk-proxy' ),
);
# the same, and what Knarr builds by itself:
my $knarr = Langertha::Knarr->new( handler => $handler, auth_token => 'sk-proxy' );
DESCRIPTION
The Langertha::Knarr::Authorizer behind "auth_token" in Langertha::Knarr: one shared key opens every route and every model. Langertha::Knarr builds one over its auth_token unless it is given another authorizer, and builds it anew when the auth_token changes (an admin push).
Without a "key" every request is let in. With one, a request must present it as Authorization: Bearer key or x-api-key; a header sent twice counts as one value of comma-separated elements, and any one of them may be the key. The key is compared in constant time (both sides through SHA-256, the digests compared whole). The A2A agent card stays anonymous. Anything else gets 401 unauthorized.
The identity is {}: the key says nothing about who asks. Every model may be used and listed, and the client's own provider key may reach a passthrough upstream ("forwards_client_key" is true; Knarr takes this key out of what it forwards).
key
Optional. The shared key; undef or empty lets every request in.
identify
my $result = $authorizer->identify( $http_req, $action );
{ identity => {} } for a request with the key (or for every request without a "key"), { status => 401, message => 'unauthorized' } otherwise.
authorize
Always allows: the key opens every model.
visible_models
Returns the list it is given.
forwards_client_key
True.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-knarr/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.