[Catalyst-commits] r6459 - in trunk/examples: . OpenID OpenID/Consumer OpenID/Consumer/lib OpenID/Consumer/lib/Consumer OpenID/Consumer/lib/Consumer/Controller OpenID/Consumer/lib/Consumer/View OpenID/Consumer/root OpenID/Consumer/root/static OpenID/Consumer/script OpenID/Consumer/t OpenID/Server OpenID/Server/lib OpenID/Server/lib/Catalyst OpenID/Server/lib/Catalyst/Action OpenID/Server/lib/Catalyst/Action/OpenID OpenID/Server/lib/Catalyst/Controller OpenID/Server/lib/OpenID OpenID/Server/lib/OpenID/Controller OpenID/Server/lib/OpenID/View OpenID/Server/root OpenID/Server/root/server OpenID/Server/root/static OpenID/Server/script OpenID/Server/t

edenc at dev.catalyst.perl.org edenc at dev.catalyst.perl.org
Thu Jun 7 00:34:28 GMT 2007


Author: edenc
Date: 2007-06-07 00:34:28 +0100 (Thu, 07 Jun 2007)
New Revision: 6459

Added:
   trunk/examples/OpenID/
   trunk/examples/OpenID/Consumer/
   trunk/examples/OpenID/Consumer/Changes
   trunk/examples/OpenID/Consumer/Makefile.PL
   trunk/examples/OpenID/Consumer/README
   trunk/examples/OpenID/Consumer/consumer.yml
   trunk/examples/OpenID/Consumer/lib/
   trunk/examples/OpenID/Consumer/lib/Consumer.pm
   trunk/examples/OpenID/Consumer/lib/Consumer/
   trunk/examples/OpenID/Consumer/lib/Consumer/Controller/
   trunk/examples/OpenID/Consumer/lib/Consumer/Controller/Root.pm
   trunk/examples/OpenID/Consumer/lib/Consumer/Model/
   trunk/examples/OpenID/Consumer/lib/Consumer/View/
   trunk/examples/OpenID/Consumer/lib/Consumer/View/TT.pm
   trunk/examples/OpenID/Consumer/root/
   trunk/examples/OpenID/Consumer/root/favicon.ico
   trunk/examples/OpenID/Consumer/root/index.tt
   trunk/examples/OpenID/Consumer/root/login.tt
   trunk/examples/OpenID/Consumer/root/static/
   trunk/examples/OpenID/Consumer/root/static/images/
   trunk/examples/OpenID/Consumer/script/
   trunk/examples/OpenID/Consumer/script/consumer_cgi.pl
   trunk/examples/OpenID/Consumer/script/consumer_create.pl
   trunk/examples/OpenID/Consumer/script/consumer_fastcgi.pl
   trunk/examples/OpenID/Consumer/script/consumer_server.pl
   trunk/examples/OpenID/Consumer/script/consumer_test.pl
   trunk/examples/OpenID/Consumer/t/
   trunk/examples/OpenID/Consumer/t/01app.t
   trunk/examples/OpenID/Consumer/t/02pod.t
   trunk/examples/OpenID/Consumer/t/03podcoverage.t
   trunk/examples/OpenID/Consumer/t/view_TT.t
   trunk/examples/OpenID/Server/
   trunk/examples/OpenID/Server/Changes
   trunk/examples/OpenID/Server/Makefile.PL
   trunk/examples/OpenID/Server/README
   trunk/examples/OpenID/Server/lib/
   trunk/examples/OpenID/Server/lib/Catalyst/
   trunk/examples/OpenID/Server/lib/Catalyst/Action/
   trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/
   trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Identity.pm
   trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Server.pm
   trunk/examples/OpenID/Server/lib/Catalyst/Controller/
   trunk/examples/OpenID/Server/lib/Catalyst/Controller/OpenID.pm
   trunk/examples/OpenID/Server/lib/OpenID.pm
   trunk/examples/OpenID/Server/lib/OpenID/
   trunk/examples/OpenID/Server/lib/OpenID/Controller/
   trunk/examples/OpenID/Server/lib/OpenID/Controller/Root.pm
   trunk/examples/OpenID/Server/lib/OpenID/Controller/Server.pm
   trunk/examples/OpenID/Server/lib/OpenID/Model/
   trunk/examples/OpenID/Server/lib/OpenID/View/
   trunk/examples/OpenID/Server/lib/OpenID/View/TT.pm
   trunk/examples/OpenID/Server/openid.yml
   trunk/examples/OpenID/Server/root/
   trunk/examples/OpenID/Server/root/favicon.ico
   trunk/examples/OpenID/Server/root/server/
   trunk/examples/OpenID/Server/root/server/identity.tt
   trunk/examples/OpenID/Server/root/server/server.tt
   trunk/examples/OpenID/Server/root/static/
   trunk/examples/OpenID/Server/root/static/images/
   trunk/examples/OpenID/Server/script/
   trunk/examples/OpenID/Server/script/openid_cgi.pl
   trunk/examples/OpenID/Server/script/openid_create.pl
   trunk/examples/OpenID/Server/script/openid_fastcgi.pl
   trunk/examples/OpenID/Server/script/openid_server.pl
   trunk/examples/OpenID/Server/script/openid_test.pl
   trunk/examples/OpenID/Server/t/
   trunk/examples/OpenID/Server/t/01app.t
   trunk/examples/OpenID/Server/t/02pod.t
   trunk/examples/OpenID/Server/t/03podcoverage.t
   trunk/examples/OpenID/Server/t/04.mockup.t
Log:
draft for openid provider

Added: trunk/examples/OpenID/Consumer/Changes
===================================================================
--- trunk/examples/OpenID/Consumer/Changes	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/Changes	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension Consumer.
+
+0.01  2007-06-05 23:35:46
+        - initial revision, generated by Catalyst

Added: trunk/examples/OpenID/Consumer/Makefile.PL
===================================================================
--- trunk/examples/OpenID/Consumer/Makefile.PL	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/Makefile.PL	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,16 @@
+use inc::Module::Install;
+
+name 'Consumer';
+all_from 'lib/Consumer.pm';
+
+requires 'Catalyst' => '5.7007';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+requires 'YAML'; # This should reflect the config file format you've chosen
+                 # See Catalyst::Plugin::ConfigLoader for supported formats
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;

Added: trunk/examples/OpenID/Consumer/README
===================================================================
--- trunk/examples/OpenID/Consumer/README	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/README	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1 @@
+Run script/consumer_server.pl to test the application.

Added: trunk/examples/OpenID/Consumer/consumer.yml
===================================================================
--- trunk/examples/OpenID/Consumer/consumer.yml	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/consumer.yml	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,2 @@
+---
+name: Consumer

Added: trunk/examples/OpenID/Consumer/lib/Consumer/Controller/Root.pm
===================================================================
--- trunk/examples/OpenID/Consumer/lib/Consumer/Controller/Root.pm	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/lib/Consumer/Controller/Root.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,63 @@
+package Consumer::Controller::Root;
+
+use strict;
+use warnings;
+use base '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
+
+Consumer::Controller::Root - Root Controller for Consumer
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=cut
+
+=head2 default
+
+=cut
+
+sub login : Local Args(0) {
+    my ( $self, $c ) = @_;
+    if ( $c->authenticate_openid ) {
+        $c->res->redirect( $c->uri_for('/') );
+    }
+}
+
+use Data::Dump;
+
+sub index : Local {
+    my ( $self, $c ) = @_;
+    $c->log->debug( Data::Dump::dump( $c->user ) ) if $c->user_exists;
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut 
+
+sub end : ActionClass('RenderView') {
+}
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim,,,
+
+=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/OpenID/Consumer/lib/Consumer/View/TT.pm
===================================================================
--- trunk/examples/OpenID/Consumer/lib/Consumer/View/TT.pm	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/lib/Consumer/View/TT.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,31 @@
+package Consumer::View::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
+
+=head1 NAME
+
+Consumer::View::TT - TT View for Consumer
+
+=head1 DESCRIPTION
+
+TT View for Consumer. 
+
+=head1 AUTHOR
+
+=head1 SEE ALSO
+
+L<Consumer>
+
+Eden Cardoso Cardim,,,
+
+=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/OpenID/Consumer/lib/Consumer.pm
===================================================================
--- trunk/examples/OpenID/Consumer/lib/Consumer.pm	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/lib/Consumer.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,69 @@
+package Consumer;
+
+use strict;
+use warnings;
+
+use Catalyst::Runtime '5.70';
+
+# Set flags and add plugins for the application
+#
+#         -Debug: activates the debug mode for very useful log messages
+#   ConfigLoader: will load the configuration from a YAML file in the
+#                 application's home directory
+# Static::Simple: will serve static files from the application's root
+#                 directory
+
+use Catalyst qw/-Debug ConfigLoader Static::Simple
+    Authentication
+    Authentication::Credential::OpenID
+    Session
+    Session::Store::FastMmap
+    Session::State::Cookie/;
+
+our $VERSION = '0.01';
+
+# Configure the application.
+#
+# Note that settings in Consumer.yml (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with a external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config(
+    name           => 'Consumer',
+    authentication => { openid => { use_session => 1 } }
+);
+
+# Start the application
+__PACKAGE__->setup;
+
+=head1 NAME
+
+Consumer - Catalyst based application
+
+=head1 SYNOPSIS
+
+    script/consumer_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<Consumer::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim,,,
+
+=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/OpenID/Consumer/root/favicon.ico
===================================================================
(Binary files differ)


Property changes on: trunk/examples/OpenID/Consumer/root/favicon.ico
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/examples/OpenID/Consumer/root/index.tt
===================================================================
--- trunk/examples/OpenID/Consumer/root/index.tt	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/root/index.tt	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1 @@
+Hello [% c.user.display %]!
\ No newline at end of file

Added: trunk/examples/OpenID/Consumer/root/login.tt
===================================================================
--- trunk/examples/OpenID/Consumer/root/login.tt	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/root/login.tt	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,4 @@
+<form action="[% c.uri_for(c.action) %]" method="GET">
+    <input type="text" name="claimed_uri" class="openid" />
+    <input type="submit" value="Sign in with OpenID" />
+</form>
\ No newline at end of file

Added: trunk/examples/OpenID/Consumer/script/consumer_cgi.pl
===================================================================
--- trunk/examples/OpenID/Consumer/script/consumer_cgi.pl	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/script/consumer_cgi.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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 Consumer;
+
+Consumer->run;
+
+1;
+
+=head1 NAME
+
+consumer_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+
+=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/OpenID/Consumer/script/consumer_cgi.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Consumer/script/consumer_create.pl
===================================================================
--- trunk/examples/OpenID/Consumer/script/consumer_create.pl	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/script/consumer_create.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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( 'Consumer', @ARGV );
+
+1;
+
+=head1 NAME
+
+consumer_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+consumer_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:
+   consumer_create.pl controller My::Controller
+   consumer_create.pl -mechanize controller My::Controller
+   consumer_create.pl view My::View
+   consumer_create.pl view MyView TT
+   consumer_create.pl view TT TT
+   consumer_create.pl model My::Model
+   consumer_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+   dbi:SQLite:/tmp/my.db
+   consumer_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 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Consumer/script/consumer_create.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Consumer/script/consumer_fastcgi.pl
===================================================================
--- trunk/examples/OpenID/Consumer/script/consumer_fastcgi.pl	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/script/consumer_fastcgi.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,80 @@
+#!/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 Consumer;
+
+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;
+
+Consumer->run( 
+    $listen, 
+    {   nproc   => $nproc,
+        pidfile => $pidfile, 
+        manager => $manager,
+        detach  => $detach,
+	keep_stderr => $keep_stderr,
+    }
+);
+
+1;
+
+=head1 NAME
+
+consumer_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+consumer_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 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Consumer/script/consumer_fastcgi.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Consumer/script/consumer_server.pl
===================================================================
--- trunk/examples/OpenID/Consumer/script/consumer_server.pl	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/script/consumer_server.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,111 @@
+#!/usr/bin/perl -w
+
+BEGIN { 
+    $ENV{CATALYST_ENGINE} ||= 'HTTP';
+    $ENV{CATALYST_SCRIPT_GEN} = 30;
+    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              = 3000;
+my $keepalive         = 0;
+my $restart           = 0;
+my $restart_delay     = 1;
+my $restart_regex     = '\.yml$|\.yaml$|\.pm$';
+my $restart_directory = undef;
+
+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,
+);
+
+pod2usage(1) if $help;
+
+if ( $restart ) {
+    $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 Consumer;
+
+Consumer->run( $port, $host, {
+    argv              => \@argv,
+    'fork'            => $fork,
+    keepalive         => $keepalive,
+    restart           => $restart,
+    restart_delay     => $restart_delay,
+    restart_regex     => qr/$restart_regex/,
+    restart_directory => $restart_directory,
+} );
+
+1;
+
+=head1 NAME
+
+consumer_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+consumer_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$|\.pm$')
+   -restartdirectory  the directory to search for
+                      modified files
+                      (defaults to '../')
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Consumer/script/consumer_server.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Consumer/script/consumer_test.pl
===================================================================
--- trunk/examples/OpenID/Consumer/script/consumer_test.pl	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/script/consumer_test.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Catalyst::Test 'Consumer';
+
+my $help = 0;
+
+GetOptions( 'help|?' => \$help );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+print request($ARGV[0])->content . "\n";
+
+1;
+
+=head1 NAME
+
+consumer_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+consumer_test.pl [options] uri
+
+ Options:
+   -help    display this help and exits
+
+ Examples:
+   consumer_test.pl http://localhost/some_action
+   consumer_test.pl /some_action
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Consumer/script/consumer_test.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Consumer/t/01app.t
===================================================================
--- trunk/examples/OpenID/Consumer/t/01app.t	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/t/01app.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'Consumer' }
+
+ok( request('/')->is_success, 'Request should succeed' );

Added: trunk/examples/OpenID/Consumer/t/02pod.t
===================================================================
--- trunk/examples/OpenID/Consumer/t/02pod.t	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/t/02pod.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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/OpenID/Consumer/t/03podcoverage.t
===================================================================
--- trunk/examples/OpenID/Consumer/t/03podcoverage.t	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/t/03podcoverage.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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/OpenID/Consumer/t/view_TT.t
===================================================================
--- trunk/examples/OpenID/Consumer/t/view_TT.t	                        (rev 0)
+++ trunk/examples/OpenID/Consumer/t/view_TT.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Consumer::View::TT' }
+

Added: trunk/examples/OpenID/Server/Changes
===================================================================
--- trunk/examples/OpenID/Server/Changes	                        (rev 0)
+++ trunk/examples/OpenID/Server/Changes	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension OpenID.
+
+0.01  2007-05-29 00:27:59
+        - initial revision, generated by Catalyst

Added: trunk/examples/OpenID/Server/Makefile.PL
===================================================================
--- trunk/examples/OpenID/Server/Makefile.PL	                        (rev 0)
+++ trunk/examples/OpenID/Server/Makefile.PL	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,17 @@
+use inc::Module::Install;
+
+name 'OpenID';
+all_from 'lib/OpenID.pm';
+
+build_requires 'Test::OpenID::Consumer';
+requires 'Catalyst' => '5.7007';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Net::OpenID::Server';
+requires 'YAML'; # This should reflect the config file format you've chosen
+                 # See Catalyst::Plugin::ConfigLoader for supported formats
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;

Added: trunk/examples/OpenID/Server/README
===================================================================
--- trunk/examples/OpenID/Server/README	                        (rev 0)
+++ trunk/examples/OpenID/Server/README	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1 @@
+Run script/openid_server.pl to test the application.

Added: trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Identity.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Identity.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Identity.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,75 @@
+package Catalyst::Action::OpenID::Identity;
+
+use warnings;
+use strict;
+
+our $VERSION = '0.01';
+
+use base 'Catalyst::Action';
+
+sub execute {
+    my $self = shift;
+    my ( $controller, $c, @args ) = @_;
+
+    # check identity if we're being forwarded to
+    if ( !( $c->action eq $self ) ) {
+
+        # custom identity check
+        $self->NEXT::execute(@_);
+        return if exists $c->stash->{is_identity};
+
+        # default identity check
+        if ( $c->user_exists ) {
+            $c->stash->{is_identity} = ( $c->user->id eq $args[0] );
+        }
+        else {
+            $c->stash->{is_identity} = 0;
+        }
+
+        return;
+    }
+    
+    my $server = $self->attributes->{ServerAction}[0];
+
+    # this has to be resolved on each call since we don't
+    # know the load order for actions
+    my $action = $controller->action_for($server);
+
+    my $openid_var = $self->attributes->{OPENID_VAR} || 'openid_server';
+    my $href = $c->uri_for($action)->as_string;
+
+    $c->stash->{$openid_var} = qq{<link rel="openid.server" href="$href" />};
+}
+
+1;    # Magic true value required at end of module
+__END__
+
+=head1 NAME
+
+Catalyst::Action::OpenID::Identity - OpenID identity as a Catalyst action
+
+=head1 VERSION
+
+This document describes Catalyst::Action::OpenID::Identity version 0.0.1
+
+
+=head1 SYNOPSIS
+
+    use Catalyst::Action::OpenID::Identity;
+  
+=head1 DESCRIPTION
+
+=head1 SEE ALSO
+
+L<Catalyst::Controller::OpenID> L<Catalyst::Action::OpenID::Server>
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim  C<< <edencardim at gmail.com> >>
+
+
+=head1 LICENSE
+
+This library is copyright (C) 2007, PictureTrail.com
+
+=cut

Added: trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Server.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Server.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/Catalyst/Action/OpenID/Server.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,106 @@
+package Catalyst::Action::OpenID::Server;
+
+use warnings;
+use strict;
+use Carp;
+use Smart::Comments;
+
+our $VERSION = '0.01';
+
+use Net::OpenID::Server;
+
+use base 'Catalyst::Action';
+
+sub new {
+    my $self = shift->NEXT::new(@_);
+    $self->attributes->{Args}[0] = 0;
+    return $self;
+}
+
+sub execute {
+    my $self = shift;
+    my ( $controller, $c ) = @_;
+    $self->NEXT::execute(@_);
+    
+    my $nos = Net::OpenID::Server->new(
+        get_args  => $c->req->query_parameters,
+        post_args => $c->req->body_parameters,
+        get_user  => sub {
+            return $c->user if $c->user_exists;
+            return;
+        },
+
+        # check if this id is sane
+        is_identity => sub {
+            my ( $user, $identity ) = @_;
+            return 0 unless $user;
+
+            my $base = $c->req->base;
+            ( my $identity_action = $identity ) =~ s/^$base//;
+            $c->log->debug('checking identity for ' . $user->id);
+            $c->forward("/$identity_action");
+            return $c->stash->{is_identity};
+        },
+
+        # check if the user trusts the current relying party
+        is_trusted => sub {
+            my ( $user, $trust_root, $is_identity ) = @_;
+
+            #TODO check trusts in session
+            return 1;
+        },
+
+        # generate our half of the server secret
+        server_secret => 'secret',
+
+        setup_url =>
+            $c->uri_for( $self, $c->req->query_parameters )->as_string
+    );
+    my ( $type, $data ) = $nos->handle_page();
+    if ( $type eq 'redirect' ) {
+        $c->res->redirect($data);
+    }
+    elsif ( $type eq 'setup' ) {
+
+        # if we get here, authentication or trust has failed in NEXT::execute
+        # try again indefinately...
+        return;
+    }
+    else {
+        $c->res->content_type($type);
+        $c->log->debug("Setting body: $data");
+        $c->res->body($data);
+    }
+}
+
+1;    # Magic true value required at end of module
+__END__
+
+=head1 NAME
+
+Catalyst::Action::OpenID::Server - OpenID server endpoint in a Catalyst action
+
+
+=head1 VERSION
+
+This document describes Catalyst::Action::OpenID::Server version 0.0.1
+
+
+=head1 SYNOPSIS
+
+    use Catalyst::Action::OpenID::Server;  
+
+  
+=head1 DESCRIPTION
+
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim  C<< <edencardim at gmail.com> >>
+
+
+=head1 LICENSE
+
+This library is copyright (C) 2007, PictureTrail.com
+
+=cut

Added: trunk/examples/OpenID/Server/lib/Catalyst/Controller/OpenID.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/Catalyst/Controller/OpenID.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/Catalyst/Controller/OpenID.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,136 @@
+package Catalyst::Controller::OpenID;
+
+use warnings;
+use strict;
+
+our $VERSION = '0.01';
+
+# Module implementation here
+
+# this will register Server and Identity actions shortly
+
+1; # Magic true value required at end of module
+__END__
+
+=head1 NAME
+
+Catalyst::Controller::OpenID - Controller for OpenID authentication
+
+
+=head1 VERSION
+
+This document describes Catalyst::Controller::OpenID version 0.0.1
+
+
+=head1 SYNOPSIS
+
+    use Catalyst::Controller::OpenID;
+
+=for author to fill in:
+    Brief code example(s) here showing commonest usage(s).
+    This section will be as far as many users bother reading
+    so make it as educational and exeplary as possible.
+  
+  
+=head1 DESCRIPTION
+
+=for author to fill in:
+    Write a full description of the module and its features here.
+    Use subsections (=head2, =head3) as appropriate.
+
+
+=head1 INTERFACE 
+
+=for author to fill in:
+    Write a separate section listing the public components of the modules
+    interface. These normally consist of either subroutines that may be
+    exported, or methods that may be called on objects belonging to the
+    classes provided by the module.
+
+
+=head1 DIAGNOSTICS
+
+=for author to fill in:
+    List every single error and warning message that the module can
+    generate (even the ones that will "never happen"), with a full
+    explanation of each problem, one or more likely causes, and any
+    suggested remedies.
+
+=over
+
+=item C<< Error message here, perhaps with %s placeholders >>
+
+[Description of error here]
+
+=item C<< Another error message here >>
+
+[Description of error here]
+
+[Et cetera, et cetera]
+
+=back
+
+
+=head1 CONFIGURATION AND ENVIRONMENT
+
+=for author to fill in:
+    A full explanation of any configuration system(s) used by the
+    module, including the names and locations of any configuration
+    files, and the meaning of any environment variables or properties
+    that can be set. These descriptions must also include details of any
+    configuration language used.
+  
+Catalyst::Controller::OpenID requires no configuration files or environment variables.
+
+
+=head1 DEPENDENCIES
+
+=for author to fill in:
+    A list of all the other modules that this module relies upon,
+    including any restrictions on versions, and an indication whether
+    the module is part of the standard Perl distribution, part of the
+    module's distribution, or must be installed separately. ]
+
+None.
+
+
+=head1 INCOMPATIBILITIES
+
+=for author to fill in:
+    A list of any modules that this module cannot be used in conjunction
+    with. This may be due to name conflicts in the interface, or
+    competition for system or program resources, or due to internal
+    limitations of Perl (for example, many modules that use source code
+    filters are mutually incompatible).
+
+None reported.
+
+
+=head1 BUGS AND LIMITATIONS
+
+=for author to fill in:
+    A list of known problems with the module, together with some
+    indication Whether they are likely to be fixed in an upcoming
+    release. Also a list of restrictions on the features the module
+    does provide: data types that cannot be handled, performance issues
+    and the circumstances in which they may arise, practical
+    limitations on the size of data sets, special cases that are not
+    (yet) handled, etc.
+
+No bugs have been reported.
+
+Please report any bugs or feature requests to
+C<bug-<RT NAME>@rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org>.
+
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim  C<< <edencardim at gmail.com> >>
+
+
+=head1 LICENSE
+
+This library is copyright (C) 2007, PictureTrail.com
+
+=cut

Added: trunk/examples/OpenID/Server/lib/OpenID/Controller/Root.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/OpenID/Controller/Root.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/OpenID/Controller/Root.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,48 @@
+package OpenID::Controller::Root;
+
+use strict;
+use warnings;
+use base '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
+
+OpenID::Controller::Root - Root Controller for OpenID
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=cut
+
+=head2 identity
+
+=cut
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {
+}
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim,,,
+
+=head1 LICENSE
+
+This library is copyright (C) 2007, PictureTrail.com
+
+=cut
+
+1;

Added: trunk/examples/OpenID/Server/lib/OpenID/Controller/Server.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/OpenID/Controller/Server.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/OpenID/Controller/Server.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,25 @@
+package OpenID::Controller::Server;
+
+use strict;
+use warnings;
+
+use base 'Catalyst::Controller';
+
+use Net::OpenID::Server;
+
+sub identity : Local ActionClass('OpenID::Identity')
+    ServerAction('server') {
+}
+
+sub server : Local ActionClass('OpenID::Server') {
+    my ( $self, $c ) = @_;
+    if (    my $user = $c->req->param("user")
+        and my $password = $c->req->param("password") )
+    {
+        if ( !$c->login( $user, $password ) ) {
+            $c->stash->{bad_login} = 1;
+        }
+    }
+}
+
+1;

Added: trunk/examples/OpenID/Server/lib/OpenID/View/TT.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/OpenID/View/TT.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/OpenID/View/TT.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,30 @@
+package OpenID::View::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
+
+=head1 NAME
+
+OpenID::View::TT - TT View for OpenID
+
+=head1 DESCRIPTION
+
+TT View for OpenID. 
+
+=head1 AUTHOR
+
+=head1 SEE ALSO
+
+L<OpenID>
+
+Eden Cardoso Cardim,,,
+
+=head1 LICENSE
+
+This library is copyright (C) 2007, PictureTrail.com
+
+=cut
+
+1;

Added: trunk/examples/OpenID/Server/lib/OpenID.pm
===================================================================
--- trunk/examples/OpenID/Server/lib/OpenID.pm	                        (rev 0)
+++ trunk/examples/OpenID/Server/lib/OpenID.pm	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,70 @@
+package OpenID;
+
+use strict;
+use warnings;
+
+use Catalyst::Runtime '5.70';
+
+# Set flags and add plugins for the application
+#
+#         -Debug: activates the debug mode for very useful log messages
+#   ConfigLoader: will load the configuration from a YAML file in the
+#                 application's home directory
+# Static::Simple: will serve static files from the application's root
+#                 directory
+
+use Catalyst qw/-Debug ConfigLoader Static::Simple
+    Authentication
+    Authentication::Store::Minimal
+    Authentication::Credential::Password
+    Session
+    Session::Store::FastMmap
+    Session::State::Cookie
+/;
+
+our $VERSION = '0.01';
+
+# Configure the application.
+#
+# Note that settings in OpenID.yml (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with a external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config(
+    name           => 'OpenID',
+    authentication => { users => { foo => { password => 'password' } } }
+);
+
+# Start the application
+__PACKAGE__->setup;
+
+=head1 NAME
+
+OpenID - Catalyst based application
+
+=head1 SYNOPSIS
+
+    script/openid_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<OpenID::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Eden Cardoso Cardim
+
+=head1 LICENSE
+
+This library is copyright (C) 2007, PictureTrail.com
+
+=cut
+
+1;

Added: trunk/examples/OpenID/Server/openid.yml
===================================================================
--- trunk/examples/OpenID/Server/openid.yml	                        (rev 0)
+++ trunk/examples/OpenID/Server/openid.yml	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,2 @@
+---
+name: OpenID

Added: trunk/examples/OpenID/Server/root/favicon.ico
===================================================================
(Binary files differ)


Property changes on: trunk/examples/OpenID/Server/root/favicon.ico
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/examples/OpenID/Server/root/server/identity.tt
===================================================================
--- trunk/examples/OpenID/Server/root/server/identity.tt	                        (rev 0)
+++ trunk/examples/OpenID/Server/root/server/identity.tt	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,8 @@
+<html>
+  <head>
+    [% openid_server %]
+  </head>
+  <body>
+    <p>OpenID identity page for [% user %].</p>
+  </body>
+</html>
\ No newline at end of file

Added: trunk/examples/OpenID/Server/root/server/server.tt
===================================================================
--- trunk/examples/OpenID/Server/root/server/server.tt	                        (rev 0)
+++ trunk/examples/OpenID/Server/root/server/server.tt	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,7 @@
+[%
+IF bad_login; '<p>wrong username or password</p>'; END;
+%]<form action="[% c.uri_for(c.action, c.req.query_parameters).as_string %]" method="POST">
+    <p><input type="text" name="user" class="openid" /></p>
+    <p><input type="password" name="password" class="openid" /></p>
+    <p><input type="submit" value="Sign in" /></p>
+</form>

Added: trunk/examples/OpenID/Server/script/openid_cgi.pl
===================================================================
--- trunk/examples/OpenID/Server/script/openid_cgi.pl	                        (rev 0)
+++ trunk/examples/OpenID/Server/script/openid_cgi.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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 OpenID;
+
+OpenID->run;
+
+1;
+
+=head1 NAME
+
+openid_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+
+=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/OpenID/Server/script/openid_cgi.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Server/script/openid_create.pl
===================================================================
--- trunk/examples/OpenID/Server/script/openid_create.pl	                        (rev 0)
+++ trunk/examples/OpenID/Server/script/openid_create.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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( 'OpenID', @ARGV );
+
+1;
+
+=head1 NAME
+
+openid_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+openid_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:
+   openid_create.pl controller My::Controller
+   openid_create.pl -mechanize controller My::Controller
+   openid_create.pl view My::View
+   openid_create.pl view MyView TT
+   openid_create.pl view TT TT
+   openid_create.pl model My::Model
+   openid_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+   dbi:SQLite:/tmp/my.db
+   openid_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 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Server/script/openid_create.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Server/script/openid_fastcgi.pl
===================================================================
--- trunk/examples/OpenID/Server/script/openid_fastcgi.pl	                        (rev 0)
+++ trunk/examples/OpenID/Server/script/openid_fastcgi.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,80 @@
+#!/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 OpenID;
+
+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;
+
+OpenID->run( 
+    $listen, 
+    {   nproc   => $nproc,
+        pidfile => $pidfile, 
+        manager => $manager,
+        detach  => $detach,
+	keep_stderr => $keep_stderr,
+    }
+);
+
+1;
+
+=head1 NAME
+
+openid_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+openid_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 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Server/script/openid_fastcgi.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Server/script/openid_server.pl
===================================================================
--- trunk/examples/OpenID/Server/script/openid_server.pl	                        (rev 0)
+++ trunk/examples/OpenID/Server/script/openid_server.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,111 @@
+#!/usr/bin/perl -w
+
+BEGIN { 
+    $ENV{CATALYST_ENGINE} ||= 'HTTP';
+    $ENV{CATALYST_SCRIPT_GEN} = 30;
+    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              = 3000;
+my $keepalive         = 0;
+my $restart           = 0;
+my $restart_delay     = 1;
+my $restart_regex     = '\.yml$|\.yaml$|\.pm$';
+my $restart_directory = undef;
+
+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,
+);
+
+pod2usage(1) if $help;
+
+if ( $restart ) {
+    $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 OpenID;
+
+OpenID->run( $port, $host, {
+    argv              => \@argv,
+    'fork'            => $fork,
+    keepalive         => $keepalive,
+    restart           => $restart,
+    restart_delay     => $restart_delay,
+    restart_regex     => qr/$restart_regex/,
+    restart_directory => $restart_directory,
+} );
+
+1;
+
+=head1 NAME
+
+openid_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+openid_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$|\.pm$')
+   -restartdirectory  the directory to search for
+                      modified files
+                      (defaults to '../')
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Server/script/openid_server.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Server/script/openid_test.pl
===================================================================
--- trunk/examples/OpenID/Server/script/openid_test.pl	                        (rev 0)
+++ trunk/examples/OpenID/Server/script/openid_test.pl	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Catalyst::Test 'OpenID';
+
+my $help = 0;
+
+GetOptions( 'help|?' => \$help );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+print request($ARGV[0])->content . "\n";
+
+1;
+
+=head1 NAME
+
+openid_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+openid_test.pl [options] uri
+
+ Options:
+   -help    display this help and exits
+
+ Examples:
+   openid_test.pl http://localhost/some_action
+   openid_test.pl /some_action
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=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/OpenID/Server/script/openid_test.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/examples/OpenID/Server/t/01app.t
===================================================================
--- trunk/examples/OpenID/Server/t/01app.t	                        (rev 0)
+++ trunk/examples/OpenID/Server/t/01app.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'OpenID' }
+
+ok( request('/')->is_success, 'Request should succeed' );

Added: trunk/examples/OpenID/Server/t/02pod.t
===================================================================
--- trunk/examples/OpenID/Server/t/02pod.t	                        (rev 0)
+++ trunk/examples/OpenID/Server/t/02pod.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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/OpenID/Server/t/03podcoverage.t
===================================================================
--- trunk/examples/OpenID/Server/t/03podcoverage.t	                        (rev 0)
+++ trunk/examples/OpenID/Server/t/03podcoverage.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -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/OpenID/Server/t/04.mockup.t
===================================================================
--- trunk/examples/OpenID/Server/t/04.mockup.t	                        (rev 0)
+++ trunk/examples/OpenID/Server/t/04.mockup.t	2007-06-06 23:34:28 UTC (rev 6459)
@@ -0,0 +1,12 @@
+use lib 't/lib';
+use Test::More qw/no_plan/;
+use Test::OpenID::Consumer;
+use Test::WWW::Mechanize;
+
+my $consumer = Test::OpenID::Consumer->new;
+$consumer->ua( Test::WWW::Mechanize->new );
+my $url_root = $consumer->started_ok('consumer server started ok');
+
+# needs a running script/openid_server.pl in order to work 
+$consumer->verify_ok('http://localhost:3000/identity/foo');
+$consumer->verify_invalid('http://localhost:3000/identity/bar');




More information about the Catalyst-commits mailing list