dbba67c635e1bbb17b472d7cbf3b7cbf8ab370d6
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / RemoteTestApp1.pm
1 package RemoteTestApp1;
2
3 use Catalyst qw/
4    Authentication
5 /;
6
7 use base qw/Catalyst/;
8 __PACKAGE__->engine_class('RemoteTestEngine');
9 __PACKAGE__->config(
10     'Plugin::Authentication' => {
11         default_realm => 'remote',
12         realms => {
13             remote => {
14                 credential => {
15                     class => 'Remote',
16                     allow_regexp => '^(bob|john|CN=.*)$',
17                     deny_regexp=> 'denied',
18                     cutname_regexp=> 'CN=(.*)/OU=Test',
19                 },
20                 store => {
21                     class => 'Null',
22                 },
23             },
24         },
25     },
26 );
27
28 sub default : Local {
29     my ( $self, $c ) = @_;
30     if ($c->authenticate()) {
31         $c->res->body('User:' . $c->user->{username});
32     }
33     else {
34         $c->res->body('FAIL');
35         $c->res->status(403);
36     }
37 }
38
39 sub public : Local {
40     my ( $self, $c ) = @_;
41     $c->res->body('OK');
42 }
43
44 __PACKAGE__->setup;
45