LibreCat::Auth::Bag - A LibreCat authentication package backed by a Catmandu::Store::Bag
use Catmandu;
use LibreCat::Auth::Bag;
Catmandu->config->{store}{users} = {
package => Hash,
options => {
init_data => {
login => 'demo'
password => 's3cret',
},
},
};
my $auth = LibreCat::Auth::Bag->new(
store => 'users',
username_param => 'login',
);
if ($auth->authenticate({username => 'demo',
password => 's3cret')) {
say "logged in";
}
else {
say "error";
}
Name of the store in the Catmandu config. Default is the Catmandu default store.
Name of the bag. Default is the store's default bag.
Name of the attribute containing the username. Default is 'username'.
Name of the attribute containing the password. Default is 'password'.