NAME

LibreCat::Auth - LibreCat authentication role

SYNOPSIS

    package MyAuth;

    use Moo;

    with 'LibreCat::Auth';

    sub authenticate {
        my ($self, $params) = @_;
        my $authenticated = $params->{password} eq 'secret';

        $authenticated ?
            +{ uid => $params->{username}, package => __PACKAGE__, package_id => $self->id } :
            undef;
    }

    1;

DESCRIPTION

This is a Moo::Role for all authentication packages. It requires authenticate method.

CONFIG

obfuscate_params

An array ref of params to obfuscate in logging or error reporting with '********'. The default obfuscates 'password'.

id

identifier of the authentication module. Defaults to the package name. This is handy when using LibreCat::Auth::Multi ( where multiple versions of the same authentication package can be used ) and you need to known exactly which package authenticated the user.

METHODS

authenticate(\%params)

All authentication packages need to implement this method. Returns a hash on success, undef on failure.

This hash contains information about the user, and the module that authenticated:

    { uid => "njfranck", package => "LibreCat::Auth::Bag", package_id => "LibreCat::Auth::Bag" }

This "package_id" is used to distinguish between instances of the same package.

SEE ALSO

LibreCat::Auth::Multi, LibreCat::Auth::LDAP, LibreCat::Auth::Bag