updates to auth draft
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Plugin / Authentication / Store / Minimal.pm
CommitLineData
06675d2e 1#!/usr/bin/perl
2
3package Catalyst::Plugin::Authentication::Store::Minimal;
06675d2e 4
5use strict;
6use warnings;
7
8use Catalyst::Plugin::Authentication::Store::Minimal::Backend;
9
10sub setup {
11 my $c = shift;
12
13 $c->config->{authentication}{store} =
14 Catalyst::Plugin::Authentication::Store::Minimal::Backend->new(
15 $c->config->{authentication}{users} );
16
17}
18
19__PACKAGE__;
20
21__END__
22
23=pod
24
25=head1 NAME
26
27Catalyst::Plugin::Authentication::Store::Minimal - Authentication
28database in C<<$c->config>>.
29
30=head1 SYNOPSIS
31
32 use Catalyst qw/
33 Authentication
34 Authentication::Store::Minimal
35 Authentication::Credential::Password
36 /;
37
38 __PACKAGE__->config->{authentication}{users} = {
39 name => {
40 password => "s3cr3t",
41 roles => [qw/admin editor/],
42 ...
43 },
44 };
45
46 sub login : Global {
47 my ( $self, $c ) = @_;
48
49 $c->login( $c->req->param("login"), $c->req->param("password"), );
50 }
51
52=head1 DESCRIPTION
53
54This authentication store plugin lets you create a very quick and dirty user
55database in your application's config hash.
56
57It's purpose is mainly for testing, and it should probably be replaced by a
58more "serious" store for production.
59
60The hash in the config, as well as the user objects/hashes are freely mutable
61at runtime.
62
06675d2e 63=head1 METHODS
64
65=over 4
66
67=item setup
68
69This method will popultate C<< $c->config->{authentication}{store} >> so that
7d0922d8 70L<Catalyst::Plugin::Authentication/default_auth_store> can use it.
06675d2e 71
72=back
73
74=cut
75
76