minor updates
[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
b003080b 13 $c->default_auth_store(
54c8dc06 14 Catalyst::Plugin::Authentication::Store::Minimal::Backend->new(
62f27384 15 $c->config->{authentication}, $c
b003080b 16 )
17 );
06675d2e 18
b003080b 19 $c->NEXT::setup(@_);
06675d2e 20}
21
22__PACKAGE__;
23
24__END__
25
26=pod
27
28=head1 NAME
29
30Catalyst::Plugin::Authentication::Store::Minimal - Authentication
3bb6fd27 31database in C<< $c->config >>.
06675d2e 32
33=head1 SYNOPSIS
34
35 use Catalyst qw/
36 Authentication
06675d2e 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
3bb6fd27 58You will need to include the Authentication plugin, and at least one Credential
59plugin to use this Store. Credential::Password is reccommended.
60
06675d2e 61It's purpose is mainly for testing, and it should probably be replaced by a
62more "serious" store for production.
63
64The hash in the config, as well as the user objects/hashes are freely mutable
65at runtime.
66
3bb6fd27 67=head1 CONFIGURATION
68
69=over 4
70
71=item users
72
73This is a simple hash of users, the keys are the usenames, and the values are
74hashrefs containing a password key/value pair, and optionally, a roles/list
75of role-names pair. If using roles, you will also need to add the
76Authorization::Roles plugin.
77
78See the SYNOPSIS for an example.
79
2bcde605 80=back
81
3bb6fd27 82=head1 INTERNAL METHODS
06675d2e 83
84=over 4
85
86=item setup
87
88This method will popultate C<< $c->config->{authentication}{store} >> so that
7d0922d8 89L<Catalyst::Plugin::Authentication/default_auth_store> can use it.
06675d2e 90
91=back
92
93=cut
94
95