NAME

LibreCat::Auth::Bag - A LibreCat authentication package backed by a Catmandu::Store::Bag

SYNOPSIS

    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";
    }

CONFIG

store

Name of the store in the Catmandu config. Default is the Catmandu default store.

bag

Name of the bag. Default is the store's default bag.

username_attr

Name of the attribute containing the username. Default is 'username'.

password_attr

Name of the attribute containing the password. Default is 'password'.

SEE ALSO

LibreCat::Auth