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