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