NAME

MojoX::Authentication::Model::Role::Local;

SYNOPSIS

package Some::Class;
use Moo;
with 'MojoX::Authentication::Model::Role::Local';
sub load_user_by_name ($self, $controller, $name) { ... }
...

DESCRIPTION

Role to manage local accounts, ensuring the usage of Crypt::Passphrase compatible ways of managing secrets.

This role demands that the class implements method load_user_by_name with the following signature:

sub load_user_by_name ($self, $controller, $name);

where $controller is a Mojolicious::Controller compatible class. The return value from this method MUST be a hash reference holding the secret associated to the user identified by $name in the value corresponding to key secret; this value is supposed to be a valid value previously hashed with Crypt::Passphrase or anything compatible with it.

INTERFACE

crypt_passphrase

my $cp = $provider->crypt_passphrase;

Accessor for the Crypt::Passphrase object passed during construction.

handles_username

my $bool = $provider->handles_username($controller, $username);

Returns a true value if the provider handles the provided username, false otherwise. Useful to figure out what provider supports a username.

hash_secret

my $hashed = $provider->hash_secret($secret);

Wrapper for $provider->crypt_passphrase->hash_password($secret).

validate_user

my $uid = $provider->validate_user($controller, $name, $secret, $extra);

Validate the user identified by $name against the provided $secret. Parameter $extra is ignored and only present to support the right signature.

This method calls method load_user_by_name that must be provided by the class compositing the role.

ANYTHING ELSE (INCLUDING AUTHOR, COPYRIGHT AND LICENSE)

See documentation for MojoX::Authentication.