LibreCat::Auth - LibreCat authentication role
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;
This is a Moo::Role for all authentication packages. It requires authenticate
method.
An array ref of params to obfuscate in logging or error reporting with '********'. The default obfuscates 'password'.
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.
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.
LibreCat::Auth::Multi, LibreCat::Auth::LDAP, LibreCat::Auth::Bag