NAME
Dancer::Plugin::Authorize::Credentials::Config - Dancer::Plugin::Authorize authentication via the Dancer configuration file!
VERSION
version 0.01
SYNOPSIS
my $datastore = {
accounts => {
user01 => {
password => '****',
roles => [qw/
guest
user
/]
},
user02 => {
password => '****',
roles => [qw/
admin
/]
}
}
};
my $class = "Dancer::Plugin::Authorize::Credentials::Config";
print 'logged in' if $class->new->authorize($datastore, 'user01', '****');
The Dancer application configuration file will be used as the user accounts datastore, the accounts should be defined in the configuration file as follows:
plugins:
Authorize:
auth: # keyword allows one to setup multiple authentication schemes
credentials:
class: Config
options: # under credentials options accounts is where user accounts should be defined
accounts:
user01:
name: Joe Schmoe
password: foobar
roles:
- guest
- user
user02:
name: Jacque Fock
password: barbaz
roles:
- admin
DESCRIPTION
Dancer::Plugin::Authorize::Credentials::Config uses your Dancer application configuration file as the datastore where the application's user accounts are stored and retrieved from.
METHODS
authorize
The authorize method (found in every authentication class) validates a user against the defined datastore using the supplied arguments and configuration file options.
METHODS
AUTHOR
Al Newkirk <awncorp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by awncorp.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.