NAME
PAGI::FastAPI::Security::HTTPBasic - HTTP Basic authentication scheme for PAGI::FastAPI
VERSION
Version v0.0.2
SYNOPSIS
use PAGI::FastAPI::Security::HTTPBasic;
my $basic = PAGI::FastAPI::Security::HTTPBasic->new(realm => 'my-api');
$app->get('/admin',
dependencies => [ $basic->depends(key => 'creds') ],
handler => async sub ($c) {
my ($user, $pass) = @{ $c->stash->{creds} }{qw(username password)};
# ... verify $user/$pass yourself ...
return { ok => 1 };
},
);
DESCRIPTION
Grabs username/password information from an Authorization: Basic <base64(user:pass)> request header. This class just extracts the information, verification of the information is the user’s responsibility (user should verify the information against the database comparing it to password hashed with some hashing algorithm, an example could be Crypt::Bcrypt/Crypt::Argon2.
Upon success, a dependency resolves to a HashRef:
C<< { username => $user, password => $pass } >>.
CONSTRUCTOR OPTIONS
realm- (Optional) Realm string sent in theWWW-Authenticatechallenge header on failure. Default:'Restricted'.auto_error- (Optional) See PAGI::FastAPI::Security::Base. Default: true.
AUTHOR
Mohammad Sajid Anwar, <mohammad.anwar at yahoo.com>
REPOSITORY
https://github.com/manwar/PAGI-FastAPI-Security
BUGS
Please report any bugs or feature requests through the web interface at https://github.com/manwar/PAGI-FastAPI-Security/issues. I will be notified and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc PAGI::FastAPI::Security::HTTPBasic
You can also look for information at:
BUG Report
CPAN Ratings
Search MetaCPAN
LICENSE AND COPYRIGHT
Copyright (C) 2026 Mohammad Sajid Anwar.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License (2.0). You may obtain a copy of the full license at: