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