Commit | Line | Data |
06675d2e |
1 | #!/usr/bin/perl |
2 | |
3 | package Catalyst::Plugin::Authentication::Store::Minimal; |
4 | use base qw/Catalyst::Plugin::Authentication::Store/; |
5 | |
6 | use strict; |
7 | use warnings; |
8 | |
9 | use Catalyst::Plugin::Authentication::Store::Minimal::Backend; |
10 | |
11 | sub 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 | |
28 | Catalyst::Plugin::Authentication::Store::Minimal - Authentication |
29 | database 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 | |
55 | This authentication store plugin lets you create a very quick and dirty user |
56 | database in your application's config hash. |
57 | |
58 | It's purpose is mainly for testing, and it should probably be replaced by a |
59 | more "serious" store for production. |
60 | |
61 | The hash in the config, as well as the user objects/hashes are freely mutable |
62 | at runtime. |
63 | |
64 | This plugin inherits L<Catalyst::Plugin::Authentication::Store>. |
65 | |
66 | =head1 METHODS |
67 | |
68 | =over 4 |
69 | |
70 | =item setup |
71 | |
72 | This method will popultate C<< $c->config->{authentication}{store} >> so that |
73 | L<Catalyst::Plugin::Authentication::Store> can use it. |
74 | |
75 | =back |
76 | |
77 | =cut |
78 | |
79 | |