[Catalyst-commits] r10305 - in
branches/Catalyst-Plugin-Authentication/credential_remote/t: . lib
kmx at dev.catalyst.perl.org
kmx at dev.catalyst.perl.org
Tue May 26 23:44:05 GMT 2009
Author: kmx
Date: 2009-05-26 23:44:05 +0000 (Tue, 26 May 2009)
New Revision: 10305
Added:
branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestApp.pm
branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestEngine.pm
branches/Catalyst-Plugin-Authentication/credential_remote/t/live_app_remote.t
Log:
branch Credential::Remote - test draft, t0m's idea of subclassing ::Engine (not working)
Added: branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestApp.pm
===================================================================
--- branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestApp.pm (rev 0)
+++ branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestApp.pm 2009-05-26 23:44:05 UTC (rev 10305)
@@ -0,0 +1,30 @@
+package RemoteTestApp;
+
+use Catalyst qw/
+ Authentication
+/;
+
+use base qw/Catalyst/;
+__PACKAGE__->engine_class('RemoteTestEngine');
+__PACKAGE__->config(
+ 'Plugin::Authentication' => {
+ default_realm => 'remote',
+ realms => {
+ remote => {
+ credential => {
+ class => 'Remote',
+ allow_regexp => '^(bob|john|CN=.*)$',
+ deny_regexp=> 'denied',
+ cutname_regexp=> 'CN=(.*),',
+ },
+ store => { class => 'Null', }
+ },
+ },
+ },
+);
+
+sub default : Local {
+ my ( $self, $c ) = @_;
+}
+
+__PACKAGE__->setup;
Added: branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestEngine.pm
===================================================================
--- branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestEngine.pm (rev 0)
+++ branches/Catalyst-Plugin-Authentication/credential_remote/t/lib/RemoteTestEngine.pm 2009-05-26 23:44:05 UTC (rev 10305)
@@ -0,0 +1,8 @@
+package RemoteTestEngine;
+use base 'Catalyst::Engine::HTTP';
+
+our %E = %ENV;
+
+my $env = \%E;
+
+1;
Added: branches/Catalyst-Plugin-Authentication/credential_remote/t/live_app_remote.t
===================================================================
--- branches/Catalyst-Plugin-Authentication/credential_remote/t/live_app_remote.t (rev 0)
+++ branches/Catalyst-Plugin-Authentication/credential_remote/t/live_app_remote.t 2009-05-26 23:44:05 UTC (rev 10305)
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+use Test::More tests => 5;
+
+use lib 't/lib';
+use Catalyst::Test qw/RemoteTestApp/;
+
+$RemoteTestEngine::E{REMOTE_USER} = 'john';
+ok( request('/')->is_success );
+
+$RemoteTestEngine::E{REMOTE_USER} = 'nonexisting';
+ok( !request('/')->is_success );
+
+$RemoteTestEngine::E{REMOTE_USER} = 'denieduser';
+ok( !request('/')->is_success );
+
+$RemoteTestEngine::E{REMOTE_USER} = undef;
+ok( !request('/')->is_success );
+
+$RemoteTestEngine::E{SSL_CLIENT_DN} = 'CN=user, OU=any';
+# will probably fail on 5.80004 and before
+ok( !request('/')->is_success );
Property changes on: branches/Catalyst-Plugin-Authentication/credential_remote/t/live_app_remote.t
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Catalyst-commits
mailing list