Make error more useful
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / RemoteTestApp2.pm
CommitLineData
b94c4996 1package RemoteTestApp2;
2
3use Catalyst qw/
4 Authentication
5/;
6
7use 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 source => 'SSL_CLIENT_S_DN',
20 },
21 store => {
22 class => 'Null',
23 },
24 },
25 },
26 },
27);
28
29sub default : Local {
30 my ( $self, $c ) = @_;
31 if ($c->authenticate()) {
32 $c->res->body('User:' . $c->user->{id});
33 }
34 else {
35 $c->res->body('FAIL');
36 $c->res->status(403);
37 }
38}
39
40sub public : Local {
41 my ( $self, $c ) = @_;
42 $c->res->body('OK');
43}
44
45__PACKAGE__->setup;
46