Catalyst::Authentication::Store::DBI - Storage class for Catalyst Authentication using DBI
use Catalyst qw(Authentication); __PACKAGE__->config->{'authentication'} = { 'default_realm' => 'default', 'realms' => { 'default' => { 'credential' => { 'class' => 'Password', 'password_field' => 'password', 'password_type' => 'hashed', 'password_hash_type' => 'SHA-1', }, 'store' => { 'class' => 'DBI', 'user_table' => 'login', 'user_key' => 'id', 'user_name' => 'name', 'role_table' => 'authority', 'role_key' => 'id', 'role_name' => 'name', 'user_role_table' => 'competence', 'user_role_user_key' => 'login', 'user_role_role_key' => 'authority', }, }, }, }; sub login :Global { my ($self, $c) = @_; my $req = $c->request(); # catch login failures unless ($c->authenticate({ 'name' => $req->param('name'), 'password' => $req->param('password'), })) { ... } ... } sub something :Path { my ($self, $c) = @_; # handle missing role case unless ($c->check_user_roles('editor')) { ... } ... }
This module implements the Catalyst::Authentication API using Catalyst::Model::DBI.
It uses DBI to let your application authenticate users against a database and it provides support for Catalyst::Plugin::Authorization::Roles.
Simon Bertrang, <simon.bertrang@puzzworks.com>
Copyright (c) 2008 PuzzWorks OHG, http://puzzworks.com/
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Authentication::Store::DBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Authentication::Store::DBI
CPAN shell
perl -MCPAN -e shell install Catalyst::Authentication::Store::DBI
For more information on module installation, please visit the detailed CPAN module installation guide.