[Catalyst-commits] r8904 - in trunk/examples: . ProgressiveAuth
ProgressiveAuth/lib ProgressiveAuth/lib/ProgressiveAuth
ProgressiveAuth/lib/ProgressiveAuth/Controller
ProgressiveAuth/lib/ProgressiveAuth/View ProgressiveAuth/root
ProgressiveAuth/root/auth ProgressiveAuth/root/static
ProgressiveAuth/script ProgressiveAuth/t
jshirley at dev.catalyst.perl.org
jshirley at dev.catalyst.perl.org
Thu Dec 18 00:08:34 GMT 2008
Author: jshirley
Date: 2008-12-18 00:08:34 +0000 (Thu, 18 Dec 2008)
New Revision: 8904
Added:
trunk/examples/ProgressiveAuth/
trunk/examples/ProgressiveAuth/Changes
trunk/examples/ProgressiveAuth/META.yml
trunk/examples/ProgressiveAuth/Makefile.PL
trunk/examples/ProgressiveAuth/README
trunk/examples/ProgressiveAuth/lib/
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth.pm
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Auth.pm
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Root.pm
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmd.tmp
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmi.tmp
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Model/
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/View/
trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/View/TT.pm
trunk/examples/ProgressiveAuth/progressiveauth.conf
trunk/examples/ProgressiveAuth/root/
trunk/examples/ProgressiveAuth/root/auth/
trunk/examples/ProgressiveAuth/root/auth/failed.tt
trunk/examples/ProgressiveAuth/root/auth/index.tt
trunk/examples/ProgressiveAuth/root/auth/logout.tt
trunk/examples/ProgressiveAuth/root/auth/success.tt
trunk/examples/ProgressiveAuth/root/favicon.ico
trunk/examples/ProgressiveAuth/root/static/
trunk/examples/ProgressiveAuth/root/static/images/
trunk/examples/ProgressiveAuth/script/
trunk/examples/ProgressiveAuth/script/progressiveauth_cgi.pl
trunk/examples/ProgressiveAuth/script/progressiveauth_create.pl
trunk/examples/ProgressiveAuth/script/progressiveauth_fastcgi.pl
trunk/examples/ProgressiveAuth/script/progressiveauth_server.pl
trunk/examples/ProgressiveAuth/script/progressiveauth_test.pl
trunk/examples/ProgressiveAuth/t/
trunk/examples/ProgressiveAuth/t/01app.t
trunk/examples/ProgressiveAuth/t/02pod.t
trunk/examples/ProgressiveAuth/t/03podcoverage.t
trunk/examples/ProgressiveAuth/t/controller_Auth.t
trunk/examples/ProgressiveAuth/t/view_TT.t
Log:
Adding progressive realm example application, with OpenID and local passwords.
Added: trunk/examples/ProgressiveAuth/Changes
===================================================================
--- trunk/examples/ProgressiveAuth/Changes (rev 0)
+++ trunk/examples/ProgressiveAuth/Changes 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension ProgressiveAuth.
+
+0.01 2008-12-16 15:46:39
+ - initial revision, generated by Catalyst
Added: trunk/examples/ProgressiveAuth/META.yml
===================================================================
--- trunk/examples/ProgressiveAuth/META.yml (rev 0)
+++ trunk/examples/ProgressiveAuth/META.yml 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,27 @@
+---
+abstract: 'Catalyst example application for progressive authentication'
+author:
+ - 'Jay Shirley C<< <jshirley at coldhardcode.com> >>'
+distribution_type: module
+generated_by: 'Module::Install version 0.77'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: ProgressiveAuth
+no_index:
+ directory:
+ - inc
+ - t
+requires:
+ Catalyst::Action::RenderView: 0
+ Catalyst::Authentication::Credential::OpenID: 0
+ Catalyst::Plugin::Authentication: 0.100091
+ Catalyst::Plugin::ConfigLoader: 0
+ Catalyst::Plugin::Static::Simple: 0
+ Catalyst::Runtime: 5.7014
+ Config::General: 0
+ parent: 0
+resources:
+ license: http://dev.perl.org/licenses/
+version: 0.01
Added: trunk/examples/ProgressiveAuth/Makefile.PL
===================================================================
--- trunk/examples/ProgressiveAuth/Makefile.PL (rev 0)
+++ trunk/examples/ProgressiveAuth/Makefile.PL 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,28 @@
+# IMPORTANT: if you delete this file your app will not work as
+# expected. you have been warned
+use inc::Module::Install;
+
+name 'ProgressiveAuth';
+all_from 'lib/ProgressiveAuth.pm';
+
+requires 'Catalyst::Runtime' => '5.7014';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+
+requires 'Catalyst::Plugin::Authentication' => '0.100091';
+
+requires 'Catalyst::Authentication::Credential::OpenID';
+
+requires 'parent';
+
+# This should reflect the config file format you've chosen
+# See Catalyst::Plugin::ConfigLoader for supported formats
+requires 'Config::General';
+
+
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
Added: trunk/examples/ProgressiveAuth/README
===================================================================
--- trunk/examples/ProgressiveAuth/README (rev 0)
+++ trunk/examples/ProgressiveAuth/README 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,40 @@
+NAME
+ ProgressiveAuth - Catalyst example application for progressive
+ authentication
+
+SYNOPSIS
+ This application was built for the 2008 Catalyst Advent Calendar,
+ available at <http://www.catalystframework.org/calendar/2008/>
+
+ To start the server, simply run:
+
+ script/progressiveauth_server.pl
+
+ Then, in your web-browser load:
+
+ http://localhost:3000/login
+
+ You are then able to login via OpenID or local store
+
+DESCRIPTION
+ This application is designed to demonstrate how to use the Progressive
+ authentication system so that you can have multiple types of logins and
+ "fall through" by order of precedence.
+
+SEE ALSO
+ Catalyst::Plugin::Authentication
+ The documentation for authentication
+
+ Catalyst::Plugin::Authentication::Realm::Progressive
+ The documentation for the progressive realm
+
+ Catalyst
+ Catalyst, where all the magic happens.
+
+AUTHOR
+ Jay Shirley "<jshirley at coldhardcode.com>"
+
+LICENSE
+ This library is free software, you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
Added: trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Auth.pm
===================================================================
--- trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Auth.pm (rev 0)
+++ trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Auth.pm 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,69 @@
+package ProgressiveAuth::Controller::Auth;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Controller';
+
+=head1 NAME
+
+ProgressiveAuth::Controller::Auth - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub index : Path :Args(0) { }
+sub logout : Local Args(0) {
+ my ( $self, $c ) = @_;
+ $c->logout;
+}
+
+sub do_login : Local Args(0) {
+ my ( $self, $c ) = @_;
+ my $data = $c->req->params;
+
+ $c->res->status( 304 );
+ my $uri = $c->req->uri;
+
+ if ( $c->authenticate( $data ) ) {
+ $c->res->status( 304 );
+ $uri = $c->uri_for($c->controller('Auth')->action_for('success'));
+ } else {
+ $uri = $c->uri_for($c->controller('Auth')->action_for('failed'));
+ }
+ $c->res->redirect( $uri );
+}
+
+sub success : Local Args(0) {
+ my ( $self, $c ) = @_;
+ unless ( $c->user_exists ) {
+ $c->res->redirect(
+ $c->uri_for( $c->controller('Auth')->action_for('failed') )
+ );
+ $c->detach;
+ }
+}
+
+sub failed : Local Args(0) { }
+
+=head1 AUTHOR
+
+Jay Shirley C<< <jshirley at gmail.com> >>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Root.pm
===================================================================
--- trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Root.pm (rev 0)
+++ trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/Root.pm 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,60 @@
+package ProgressiveAuth::Controller::Root;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Controller';
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config->{namespace} = '';
+
+=head1 NAME
+
+ProgressiveAuth::Controller::Root - Root Controller for ProgressiveAuth
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=cut
+
+=head2 index
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ $c->res->redirect( $c->uri_for( $c->controller('Auth')->action_for('index') ) );
+}
+
+sub default :Path {
+ my ( $self, $c ) = @_;
+ $c->response->body( 'Page not found' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+=head1 AUTHOR
+
+Jay Shirley
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmd.tmp
===================================================================
--- trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmd.tmp (rev 0)
+++ trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmd.tmp 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,2 @@
+
+.
Added: trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmi.tmp
===================================================================
--- trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmi.tmp (rev 0)
+++ trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/Controller/pod2htmi.tmp 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,2 @@
+
+.
Added: trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/View/TT.pm
===================================================================
--- trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/View/TT.pm (rev 0)
+++ trunk/examples/ProgressiveAuth/lib/ProgressiveAuth/View/TT.pm 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,31 @@
+package ProgressiveAuth::View::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
+
+=head1 NAME
+
+ProgressiveAuth::View::TT - TT View for ProgressiveAuth
+
+=head1 DESCRIPTION
+
+TT View for ProgressiveAuth.
+
+=head1 AUTHOR
+
+=head1 SEE ALSO
+
+L<ProgressiveAuth>
+
+Jay Shirley
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: trunk/examples/ProgressiveAuth/lib/ProgressiveAuth.pm
===================================================================
--- trunk/examples/ProgressiveAuth/lib/ProgressiveAuth.pm (rev 0)
+++ trunk/examples/ProgressiveAuth/lib/ProgressiveAuth.pm 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,114 @@
+package ProgressiveAuth;
+
+use strict;
+use warnings;
+
+use Catalyst::Runtime '5.70';
+
+use parent qw/Catalyst/;
+
+use Catalyst qw/
+ ConfigLoader Static::Simple
+ Authentication Session Session::Store::FastMmap Session::State::Cookie
+/;
+
+our $VERSION = '0.01';
+
+# Our member hash, which is going to be passed into the simple store for
+# password authentication
+my $members = {
+ bob => { password => "s00p3r" },
+ bill => { password => "s3kr1t" },
+};
+
+
+__PACKAGE__->config(
+ name => 'ProgressiveAuth',
+ 'Plugin::Authentication' => {
+ default_realm => 'progressive',
+ realms => {
+ progressive => {
+ class => 'Progressive',
+ realms => [ 'openid', 'local' ],
+ },
+ 'openid' => {
+ credential => {
+ class => 'OpenID'
+ },
+ store => {
+ class => 'Null',
+ }
+ },
+ 'local' => {
+ credential => {
+ class => 'Password',
+ password_field => 'password',
+ password_type => 'clear'
+ },
+ store => {
+ class => 'Minimal',
+ users => $members
+ }
+ },
+ }
+ }
+);
+
+# Start the application
+__PACKAGE__->setup();
+
+=head1 NAME
+
+ProgressiveAuth - Catalyst example application for progressive authentication
+
+=head1 SYNOPSIS
+
+This application was built for the 2008 Catalyst Advent Calendar, available
+at L<http://www.catalystframework.org/calendar/2008/>
+
+To start the server, simply run:
+
+ script/progressiveauth_server.pl
+
+Then, in your web-browser load:
+
+ http://localhost:3000/login
+
+You are then able to login via OpenID or local store
+
+=head1 DESCRIPTION
+
+This application is designed to demonstrate how to use the Progressive
+authentication system so that you can have multiple types of logins and
+"fall through" by order of precedence.
+
+=head1 SEE ALSO
+
+=over
+
+=item L<Catalyst::Plugin::Authentication>
+
+The documentation for authentication
+
+=item L<Catalyst::Plugin::Authentication::Realm::Progressive>
+
+The documentation for the progressive realm
+
+=item L<Catalyst>
+
+Catalyst, where all the magic happens.
+
+=back
+
+=head1 AUTHOR
+
+Jay Shirley C<< <jshirley at coldhardcode.com> >>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: trunk/examples/ProgressiveAuth/progressiveauth.conf
===================================================================
--- trunk/examples/ProgressiveAuth/progressiveauth.conf (rev 0)
+++ trunk/examples/ProgressiveAuth/progressiveauth.conf 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,3 @@
+# rename this file to ProgressiveAuth.yml and put a : in front of "name" if
+# you want to use yaml like in old versions of Catalyst
+name ProgressiveAuth
Added: trunk/examples/ProgressiveAuth/root/auth/failed.tt
===================================================================
--- trunk/examples/ProgressiveAuth/root/auth/failed.tt (rev 0)
+++ trunk/examples/ProgressiveAuth/root/auth/failed.tt 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,3 @@
+<h1>Oh no</h1>
+<p>We couldn't authenticate you. Please check your credentials and try again.</p>
+[% PROCESS "auth/index.tt" %]
Added: trunk/examples/ProgressiveAuth/root/auth/index.tt
===================================================================
--- trunk/examples/ProgressiveAuth/root/auth/index.tt (rev 0)
+++ trunk/examples/ProgressiveAuth/root/auth/index.tt 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,18 @@
+<form action="[% c.uri_for( c.controller('Auth').action_for('do_login') ) %]" method="post">
+ <h2>OpenID...</h2>
+ <p>
+ <label for="openid">Enter an OpenID URL:</label>
+ <input type="text" name="openid_identifier" id="openid">
+ </p>
+ <h2>Username and Password</h2>
+ <p>
+ <label for="username">Username:</label>
+ <input type="text" name="username" id="username">
+ <br>
+ <label for="password">Password:</label>
+ <input type="password" name="password" id="password">
+ </p>
+ <p>
+ <input type="submit" value="Login">
+ </p>
+</form>
Added: trunk/examples/ProgressiveAuth/root/auth/logout.tt
===================================================================
--- trunk/examples/ProgressiveAuth/root/auth/logout.tt (rev 0)
+++ trunk/examples/ProgressiveAuth/root/auth/logout.tt 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,3 @@
+<h1>You made it out!</h1>
+<p>A treacherous journey, clicking that link... care to do it again?</p>
+[% PROCESS "auth/index.tt" %]
Added: trunk/examples/ProgressiveAuth/root/auth/success.tt
===================================================================
--- trunk/examples/ProgressiveAuth/root/auth/success.tt (rev 0)
+++ trunk/examples/ProgressiveAuth/root/auth/success.tt 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,28 @@
+[%~
+
+USE Dumper;
+
+~%]
+<h1>Congratulations! You logged in!</h1>
+<p>You can <a href="[% c.uri_for( c.controller('Auth').action_for('logout') ) %]">logout</a> now, since this app doesn't do much.</p>
+[% IF c.user_in_realm('openid') %]
+<p>Hey OpenID User! Here's your info from your OpenID provider</p>
+<table border="1">
+ <tr><th>Field</th><th>Value</th></tr>
+ <tr><td>URL</td><td>[% c.user.url || "None" %]</td></tr>
+ <tr><td>Display</td><td>[% c.user.display || "None" %]</td></tr>
+ <tr><td>RSS</td><td>[% c.user.rss || "None" %]</td></tr>
+ <tr><td>Atom</td><td>[% c.user.atom || "None" %]</td></tr>
+ <tr><td>FoaF</td><td>[% c.user.foaf || "None" %]</td></tr>
+ <tr><td>Declared RSS</td><td>[% c.user.declared_rss || "None" %]</td></tr>
+ <tr><td>Declared Atom</td><td>[% c.user.declared_atom || "None" %]</td></tr>
+ <tr><td>Declared FoaF</td><td>[% c.user.declared_foaf || "None" %]</td></tr>
+ <tr><td>FoaF Maker</td><td>[% c.user.foafmaker || "None" %]</td></tr>
+</table>
+
+[% ELSIF c.user_in_realm('local') %]
+<p>
+ Hey local user, isn't it boring just using normal passwords? Try logging in
+ with <a href="http://openid.net">OpenID</a> for extra goodies</a>
+</p>
+[% END %]
Added: trunk/examples/ProgressiveAuth/root/favicon.ico
===================================================================
(Binary files differ)
Property changes on: trunk/examples/ProgressiveAuth/root/favicon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/ProgressiveAuth/script/progressiveauth_cgi.pl
===================================================================
--- trunk/examples/ProgressiveAuth/script/progressiveauth_cgi.pl (rev 0)
+++ trunk/examples/ProgressiveAuth/script/progressiveauth_cgi.pl 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+
+BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' }
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use ProgressiveAuth;
+
+ProgressiveAuth->run;
+
+1;
+
+=head1 NAME
+
+progressiveauth_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/ProgressiveAuth/script/progressiveauth_cgi.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/ProgressiveAuth/script/progressiveauth_create.pl
===================================================================
--- trunk/examples/ProgressiveAuth/script/progressiveauth_create.pl (rev 0)
+++ trunk/examples/ProgressiveAuth/script/progressiveauth_create.pl 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,74 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use Catalyst::Helper;
+
+my $force = 0;
+my $mech = 0;
+my $help = 0;
+
+GetOptions(
+ 'nonew|force' => \$force,
+ 'mech|mechanize' => \$mech,
+ 'help|?' => \$help
+ );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } );
+
+pod2usage(1) unless $helper->mk_component( 'ProgressiveAuth', @ARGV );
+
+1;
+
+=head1 NAME
+
+progressiveauth_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+progressiveauth_create.pl [options] model|view|controller name [helper] [options]
+
+ Options:
+ -force don't create a .new file where a file to be created exists
+ -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
+ -help display this help and exits
+
+ Examples:
+ progressiveauth_create.pl controller My::Controller
+ progressiveauth_create.pl controller My::Controller BindLex
+ progressiveauth_create.pl -mechanize controller My::Controller
+ progressiveauth_create.pl view My::View
+ progressiveauth_create.pl view MyView TT
+ progressiveauth_create.pl view TT TT
+ progressiveauth_create.pl model My::Model
+ progressiveauth_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+ dbi:SQLite:/tmp/my.db
+ progressiveauth_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
+ dbi:Pg:dbname=foo root 4321
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Create a new Catalyst Component.
+
+Existing component files are not overwritten. If any of the component files
+to be created already exist the file will be written with a '.new' suffix.
+This behavior can be suppressed with the C<-force> option.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/ProgressiveAuth/script/progressiveauth_create.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/ProgressiveAuth/script/progressiveauth_fastcgi.pl
===================================================================
--- trunk/examples/ProgressiveAuth/script/progressiveauth_fastcgi.pl (rev 0)
+++ trunk/examples/ProgressiveAuth/script/progressiveauth_fastcgi.pl 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+
+BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use ProgressiveAuth;
+
+my $help = 0;
+my ( $listen, $nproc, $pidfile, $manager, $detach, $keep_stderr );
+
+GetOptions(
+ 'help|?' => \$help,
+ 'listen|l=s' => \$listen,
+ 'nproc|n=i' => \$nproc,
+ 'pidfile|p=s' => \$pidfile,
+ 'manager|M=s' => \$manager,
+ 'daemon|d' => \$detach,
+ 'keeperr|e' => \$keep_stderr,
+);
+
+pod2usage(1) if $help;
+
+ProgressiveAuth->run(
+ $listen,
+ { nproc => $nproc,
+ pidfile => $pidfile,
+ manager => $manager,
+ detach => $detach,
+ keep_stderr => $keep_stderr,
+ }
+);
+
+1;
+
+=head1 NAME
+
+progressiveauth_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+progressiveauth_fastcgi.pl [options]
+
+ Options:
+ -? -help display this help and exits
+ -l -listen Socket path to listen on
+ (defaults to standard input)
+ can be HOST:PORT, :PORT or a
+ filesystem path
+ -n -nproc specify number of processes to keep
+ to serve requests (defaults to 1,
+ requires -listen)
+ -p -pidfile specify filename for pid file
+ (requires -listen)
+ -d -daemon daemonize (requires -listen)
+ -M -manager specify alternate process manager
+ (FCGI::ProcManager sub-class)
+ or empty string to disable
+ -e -keeperr send error messages to STDOUT, not
+ to the webserver
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as fastcgi.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/ProgressiveAuth/script/progressiveauth_fastcgi.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/ProgressiveAuth/script/progressiveauth_server.pl
===================================================================
--- trunk/examples/ProgressiveAuth/script/progressiveauth_server.pl (rev 0)
+++ trunk/examples/ProgressiveAuth/script/progressiveauth_server.pl 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,114 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ $ENV{CATALYST_ENGINE} ||= 'HTTP';
+ $ENV{CATALYST_SCRIPT_GEN} = 31;
+ require Catalyst::Engine::HTTP;
+}
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+my $debug = 0;
+my $fork = 0;
+my $help = 0;
+my $host = undef;
+my $port = $ENV{PROGRESSIVEAUTH_PORT} || $ENV{CATALYST_PORT} || 3000;
+my $keepalive = 0;
+my $restart = $ENV{PROGRESSIVEAUTH_RELOAD} || $ENV{CATALYST_RELOAD} || 0;
+my $restart_delay = 1;
+my $restart_regex = '(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.conf|\.pm)$';
+my $restart_directory = undef;
+my $follow_symlinks = 0;
+
+my @argv = @ARGV;
+
+GetOptions(
+ 'debug|d' => \$debug,
+ 'fork' => \$fork,
+ 'help|?' => \$help,
+ 'host=s' => \$host,
+ 'port=s' => \$port,
+ 'keepalive|k' => \$keepalive,
+ 'restart|r' => \$restart,
+ 'restartdelay|rd=s' => \$restart_delay,
+ 'restartregex|rr=s' => \$restart_regex,
+ 'restartdirectory=s@' => \$restart_directory,
+ 'followsymlinks' => \$follow_symlinks,
+);
+
+pod2usage(1) if $help;
+
+if ( $restart && $ENV{CATALYST_ENGINE} eq 'HTTP' ) {
+ $ENV{CATALYST_ENGINE} = 'HTTP::Restarter';
+}
+if ( $debug ) {
+ $ENV{CATALYST_DEBUG} = 1;
+}
+
+# This is require instead of use so that the above environment
+# variables can be set at runtime.
+require ProgressiveAuth;
+
+ProgressiveAuth->run( $port, $host, {
+ argv => \@argv,
+ 'fork' => $fork,
+ keepalive => $keepalive,
+ restart => $restart,
+ restart_delay => $restart_delay,
+ restart_regex => qr/$restart_regex/,
+ restart_directory => $restart_directory,
+ follow_symlinks => $follow_symlinks,
+} );
+
+1;
+
+=head1 NAME
+
+progressiveauth_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+progressiveauth_server.pl [options]
+
+ Options:
+ -d -debug force debug mode
+ -f -fork handle each request in a new process
+ (defaults to false)
+ -? -help display this help and exits
+ -host host (defaults to all)
+ -p -port port (defaults to 3000)
+ -k -keepalive enable keep-alive connections
+ -r -restart restart when files get modified
+ (defaults to false)
+ -rd -restartdelay delay between file checks
+ -rr -restartregex regex match files that trigger
+ a restart when modified
+ (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
+ -restartdirectory the directory to search for
+ modified files, can be set mulitple times
+ (defaults to '[SCRIPT_DIR]/..')
+ -follow_symlinks follow symlinks in search directories
+ (defaults to false. this is a no-op on Win32)
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/ProgressiveAuth/script/progressiveauth_server.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/ProgressiveAuth/script/progressiveauth_test.pl
===================================================================
--- trunk/examples/ProgressiveAuth/script/progressiveauth_test.pl (rev 0)
+++ trunk/examples/ProgressiveAuth/script/progressiveauth_test.pl 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Catalyst::Test 'ProgressiveAuth';
+
+my $help = 0;
+
+GetOptions( 'help|?' => \$help );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+print request($ARGV[0])->content . "\n";
+
+1;
+
+=head1 NAME
+
+progressiveauth_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+progressiveauth_test.pl [options] uri
+
+ Options:
+ -help display this help and exits
+
+ Examples:
+ progressiveauth_test.pl http://localhost/some_action
+ progressiveauth_test.pl /some_action
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/ProgressiveAuth/script/progressiveauth_test.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/ProgressiveAuth/t/01app.t
===================================================================
--- trunk/examples/ProgressiveAuth/t/01app.t (rev 0)
+++ trunk/examples/ProgressiveAuth/t/01app.t 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'ProgressiveAuth' }
+
+ok( request('/')->is_success, 'Request should succeed' );
Added: trunk/examples/ProgressiveAuth/t/02pod.t
===================================================================
--- trunk/examples/ProgressiveAuth/t/02pod.t (rev 0)
+++ trunk/examples/ProgressiveAuth/t/02pod.t 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_files_ok();
Added: trunk/examples/ProgressiveAuth/t/03podcoverage.t
===================================================================
--- trunk/examples/ProgressiveAuth/t/03podcoverage.t (rev 0)
+++ trunk/examples/ProgressiveAuth/t/03podcoverage.t 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();
Added: trunk/examples/ProgressiveAuth/t/controller_Auth.t
===================================================================
--- trunk/examples/ProgressiveAuth/t/controller_Auth.t (rev 0)
+++ trunk/examples/ProgressiveAuth/t/controller_Auth.t 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Catalyst::Test', 'ProgressiveAuth' }
+BEGIN { use_ok 'ProgressiveAuth::Controller::Auth' }
+
+ok( request('/auth')->is_success, 'Request should succeed' );
+
+
Added: trunk/examples/ProgressiveAuth/t/view_TT.t
===================================================================
--- trunk/examples/ProgressiveAuth/t/view_TT.t (rev 0)
+++ trunk/examples/ProgressiveAuth/t/view_TT.t 2008-12-18 00:08:34 UTC (rev 8904)
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'ProgressiveAuth::View::TT' }
+
More information about the Catalyst-commits
mailing list