The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PlugAuth::Role::Auth - Role for PlugAuth authentication plugins

VERSION

version 0.17

SYNOPSIS

 package PlugAuth::Plugin::MyAuth;
 
 use Role::Tiny::With;
 
 with 'PlugAuth::Role::Plugin';
 with 'PlugAuth::Role::Auth';
 
 # accept user = larry and pass = wall only.
 sub check_credentials {
   my($self, $user, $pass) = @_;
   return 1 if $user eq 'larry' && $pass eq 'wall';
   return $self->deligate_check_credentials($user, $pass);
 }
 
 # only one user, larry
 sub all_users { qw( larry ) }
 
 1;

DESCRIPTION

Use this role when writing PlugAuth plugins that manage authentication (ie. determine the identify of the user).

REQUIRED ABSTRACT METHODS

These methods must be implemented by your class.

$plugin->check_credentials( $user, $pass )

Return 1 if the password is correct for the given user.

Return 0 otherwise.

OPTIONAL ABSTRACT METHODS

These methods may be implemented by your class.

$plugin->all_users

Returns the list of all users known to your plugin. If this cannot be determined, then return an empty list.

$plugin->create_user( $user, $password )

Create the given user with the given password. Return 1 on success, return 0 on failure.

$plugin->change_password( $user, $password )

Change the password of the given user. Return 1 on success, return 0 on failure.

$plugin->delete_user( $user )

Delete the given user. Return 1 on success, return 0 on failure.

METHODS

$plugin->next_auth

Returns the next authentication plugin. May be undef if there is no next authentication plugin.

$plugin->deligate_check_credentials( $user, $pass )

Delegate to the next authentication plugin. Call this method if your plugins authentication has failed if your plugin is not authoritative.

SEE ALSO

PlugAuth, PlugAuth::Guide::Plugin, Test::PlugAuth::Plugin::Auth

AUTHOR

Graham Ollis <gollis@sesda3.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by NASA GSFC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.