[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] CGI::Application::Plugin::Authentication developer release


I have a first version of the Authentication plugin available if
anyone is interested in having a look (particularly people that want
to help out).  There are still some things to do, but I am following
the release early mantra.

Most of the API is complete, although there may be some small changes
here or there.  To use it currently requires
CGI::Application::Plugin::Session, but that dependancy will be removed
soon.  Also, I have only included one Driver which is very basic, but
is enough to get anyone started (drivers for DBI, LDAP, etc are on the
way).

Since this is a developer release, I wouldn't use it in production
yet, but by next week I hope to have a stable release (I need this to
be in production for myself by then).

This release is not on CPAN yet, but next week I will upload an
official release.

http://cees.crtconsulting.ca/perl/modules/CGI-Application-Plugin-Authentication-0.01.tar.gz
http://cees.crtconsulting.ca/perl/modules/CGI-Application-Plugin-Authentication-0.01/

Authorization will hopefully be started this weekend!

I have included a quick example script below that shows how you can
use the Authentication plugin:


#!/usr/bin/perl

use strict;
use warnings;

{
    package MyLogin;

    use base qw(CGI::Application);

    use CGI::Application::Plugin::Session;
    use CGI::Application::Plugin::Authentication;
    use CGI::Application::Plugin::AutoRunmode;
    use CGI::Carp qw(fatalsToBrowser);

    # Using the Generic Driver we just create a simple hash
    # of username/password pairs for testing
    my %config = (
        DRIVER => [ 'Generic', { cees => '123' } ],
        STORE  => 'Session',
        LOGOUT_RUNMODE => 'one',
    );
    MyLogin->auth->config(%config);
    MyLogin->auth->protected_runmodes('two');

    sub one : StartRunmode {
        my $self = shift;

        return CGI::start_html(-style => { -code => $self->auth->login_styles })
          . CGI::h2('This page is NOT protected')
          . CGI::a( { -href => '?rm=two' }, 'Protected Runmode' )
          . CGI::end_html();
    }

    sub two : Runmode {
        my $self = shift;

        return CGI::start_html(-style => { -code => $self->auth->login_styles })
          . CGI::h2('This page is protected')
          . CGI::h2('username: '.$self->auth->username)
          . CGI::a( { -href => '?rm=one' }, 'Un-Protected Runmode' )
          . CGI::br()
          . CGI::a( { -href => '?auth_logout=1' }, 'Logout' )
          . CGI::end_html();
    }
}

MyLogin->new->run;

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.