CGI-Application-Plugin-Authentication

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    Automatically generate README.

0.18_2  Mon 20 Jul 2010
    Separate out display code and provide Basic and Classic alternatives to
    the login form. Added more examples. Implementd typo fix reported by
    Alexandr Ciornii. Added copyright declaration for icons in the login form.

0.18_1 Thu Jun 25 2010
    Put OS dependent guards in certain tests.
    Removed deprecated *_DESTINATION parameters.
    Added first test for devpopup and fixed undefined variable therein.
    Cannot use Test::More 0.92 as that has an issue with subtests.

0.18 Mon Jun 23 2010
    Completed test coverage for Driver and below
    TABLES parameter was not made mandatory in DBI driver.
    Fixed dependency on Test::More - must be at least version 0.90.
    Fixed handling of custom filters - now they must have a $param and a $value.
    Incorporated Christian Walde's suggested changes for compatibility with
    CGI::Application::Plugin::ActionDispatch.
    Adding tests around the HTML generated by the login_box function and

Changes  view on Meta::CPAN

0.14  Sun Oct 18 02:48:10 EST 2009
    Bug Fixes
    - Make sure the 'action' attribute of the login_box includes the
      path_info in the URL (resolves RT:38049 patch by Alex Becker)

    New Features
    - Add options for LIMIT and ORDER_BY to DBI driver (requested by tbone)
    - Add FORM_SUBMIT_METHOD option to the login box which allows you to
      change the form method to GET instead of the default POST.
      (resolves RT:34198 requested by jaldhar)
    - Add hooks for devpopup (resolves RT:35989 patch by Alexandr Ciornii)

0.13  Mon Mar 30 23:58:25 EST 2009
    Build fixes
    - There are no code changes to this release, just fixes in the build and
      test systems to solve some outstanding test failures
    - unit tests now skip tests where optional modules are not installed
      (gtermars@cpan.org)
    - remove build dependency on Test::Exception, replacing it with hand-rolled
      equivalent methods.  Newer Perls have been seen to fail our tests with
      "Bizarre copy of HASH in sassign..." when using Test::Exception.  Cause

MANIFEST  view on Meta::CPAN

t/55_driver_authensimple_die.t
t/55_driver_missing_authensimple.t
t/60_parsimony.t
t/60_store.t
t/60_store_cookie.t
t/60_store_session.t
t/61_cookie_badargs.t
t/61_store_cookie_noexpiry.t
t/61_store_cookie_other.t
t/70_action_dispatch.t
t/80_devpopup.t
t/98_pod.t
t/99_pod_coverage.t
t/Authen/Simple/Dummy.pm
t/CGI/Application/Plugin/Authentication/Display/Null.pm
t/CGI/Application/Plugin/Authentication/Driver/Die.pm
t/CGI/Application/Plugin/Authentication/Driver/Silly.pm
t/Store/Dummy.pm
t/TestAppDriver.pm
t/TestAppParsimony.pm
t/TestAppStore.pm

lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN

=cut

sub initialize {
    my $self = shift;
    return 1 if $self->{initialized};

    # It would seem to make more sense to do this at the /end/ of the routine
    # but that causes an infinite loop. 
    $self->{initialized} = 1;

    if (UNIVERSAL::can($self->_cgiapp, 'devpopup')) {
        $self->_cgiapp->add_callback( 'devpopup_report', \&_devpopup_report );
    }

    my $config = $self->_config;

    # See if the user is trying to log in
    #  We do this before checking to see if the user is already logged in, since
    #  a logged in user may want to log in as a different user.
    my $field_names = $config->{CREDENTIALS} || [qw(authen_username authen_password)];

    my $query = $self->_cgiapp->query;

lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN

    my $config;
    if ( ref $self ) {
        $config = $self->{__CAP_AUTHENTICATION_CONFIG} ||= $__CONFIG{$class} || {};
    } else {
        $__CONFIG{$class} ||= {};
        $config = $__CONFIG{$class};
    }
    return $config;
}

sub _devpopup_report {
    my $cgiapp = shift;
    my @list;
    my $self=$cgiapp->authen;
    if ($self->username) {
        push @list,['username',$self->username];
    }
    my $config = $self->_config;
    my $field_names = $config->{CREDENTIALS} || [qw(authen_username authen_password)];
    my $query = $cgiapp->query;
    foreach my $name (@$field_names) {
        push @list, [ $name, scalar $query->param($name) || ''];
    }
    my $r=0;
    my $text = join $/, map {
                    $r=1-$r;
                    qq(<tr class="@{[$r?'odd':'even']}"><td valign="top">$_->[0]</td><td>$_->[1]</td></tr>)
                    }
                    @list;
    $cgiapp->devpopup->add_report(
        title   => 'Authentication',
        summary => '',
        report  => qq(
            <style type="text/css">
              tr.even{background-color:#eee}
            </style>
            <div style="font-size: 80%">
              <table>
                <thead><tr><th>Parameter</th><th>Value</th></tr></thead>
                <tbody>$text</tbody>

t/out/frontpage-dev  view on Meta::CPAN

Content-Type: text/html; charset=ISO-8859-1

This is public
    <script language="javascript">
    var devpopup_window = window.open("", "devpopup_window", "height=400,width=600,scrollbars,resizable");
    devpopup_window.document.write("<?xml version=\"1.0\"?>\n" + 
	"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" + 
	"    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + 
	"\n" + 
	"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + 
	"<head>\n" + 
	"    <title>Devpopup results</title>\n" + 
	"    <style type=\"text/css\">\n" + 
	"        div.report { border: dotted 1px black; margin: 1em;}\n" + 
	"        div.report h2 { color: #000; background-color: #ddd; padding:.2em; margin-top:0;}\n" + 
	"        div.report_full, div.report_summary { padding: 0em 1em; }\n" + 
	"        a:hover, div.report h2:hover, a.print_button:hover { cursor: pointer; background-color: #eee; }\n" + 
	"        a { text-decoration: underline }\n" + 
	"        a.print_button { text-align: right; float: right; clear: right; padding: .2em; margin-right: 1em; color: #000; background-color:#ddd; border:solid 1px #444; }\n" + 
	"        // severity colors\n" + 
	"        .sev_debug             { background-color: #ccffcc; color: #000; }\n" + 
	"        .sev_info              { } // default\n" + 
	"        .sev_warning           { background-color: #ffff99; color: #000; }\n" + 
	"        .sev_error             { background-color: #ff9999; color: #000; }\n" + 
	"        .sev_fatal             { background-color: #ff6600; color: #fff; font-weight: bold; }\n" + 
	"    </style>\n" + 
	"");
    devpopup_window.document.write("	<s");
    devpopup_window.document.write("cript type=\"text/javascript\">\n");
    devpopup_window.document.write("//"+"<"+"![CDATA[\n");
    
    devpopup_window.document.write("        function swap(id1,id2)\n" + 
	"        {\n" + 
	"            var d1 = document.getElementById(id1);\n" + 
	"            var d2 = document.getElementById(id2);\n" + 
	"            var s = d1.style.display;\n" + 
	"            d1.style.display = d2.style.display;\n" + 
	"            d2.style.display = s;\n" + 
	"        }\n" + 
	"");
    devpopup_window.document.write("//]"+"]>\n");
    devpopup_window.document.write("	<");
    devpopup_window.document.write("/script>");
    devpopup_window.document.write("</head>\n" + 
	"<body>\n" + 
	"<h1>Devpopup report for TestAppAuthenticate -&gt; unprotected</h1>\n" + 
	"<a href=\"javascript:window.print()\" class=\"print_button\">Print</a>\n" + 
	"<div id=\"titles\">\n" + 
	"<ul>\n" + 
	"\n" + 
	"    <li class=\"sev_info\">\n" + 
	"        <a onclick=\"swap('#DPS1','#DPR1')\">Authentication</a> - \n" + 
	"    </li>\n" + 
	"\n" + 
	"</ul>\n" + 
	"</div>\n" + 

t/out/frontpage-dev  view on Meta::CPAN

	"<tr class=\"even\"><td valign=\"top\">authen_password</td><td></td></tr></tbody>\n" + 
	"              </table>\n" + 
	"            </div>\n" + 
	"        </div>\n" + 
	"</div>\n" + 
	"\n" + 
	"\n" + 
	"</body>\n" + 
	"</html>\n" + 
	"");
    devpopup_window.document.close();
    devpopup_window.focus();
    </script>
    

t/out/login-dev  view on Meta::CPAN

Content-Type: text/html; charset=ISO-8859-1

This is public
    <script language="javascript">
    var devpopup_window = window.open("", "devpopup_window", "height=400,width=600,scrollbars,resizable");
    devpopup_window.document.write("<?xml version=\"1.0\"?>\n" + 
	"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" + 
	"    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + 
	"\n" + 
	"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + 
	"<head>\n" + 
	"    <title>Devpopup results</title>\n" + 
	"    <style type=\"text/css\">\n" + 
	"        div.report { border: dotted 1px black; margin: 1em;}\n" + 
	"        div.report h2 { color: #000; background-color: #ddd; padding:.2em; margin-top:0;}\n" + 
	"        div.report_full, div.report_summary { padding: 0em 1em; }\n" + 
	"        a:hover, div.report h2:hover, a.print_button:hover { cursor: pointer; background-color: #eee; }\n" + 
	"        a { text-decoration: underline }\n" + 
	"        a.print_button { text-align: right; float: right; clear: right; padding: .2em; margin-right: 1em; color: #000; background-color:#ddd; border:solid 1px #444; }\n" + 
	"        // severity colors\n" + 
	"        .sev_debug             { background-color: #ccffcc; color: #000; }\n" + 
	"        .sev_info              { } // default\n" + 
	"        .sev_warning           { background-color: #ffff99; color: #000; }\n" + 
	"        .sev_error             { background-color: #ff9999; color: #000; }\n" + 
	"        .sev_fatal             { background-color: #ff6600; color: #fff; font-weight: bold; }\n" + 
	"    </style>\n" + 
	"");
    devpopup_window.document.write("	<s");
    devpopup_window.document.write("cript type=\"text/javascript\">\n");
    devpopup_window.document.write("//"+"<"+"![CDATA[\n");
    
    devpopup_window.document.write("        function swap(id1,id2)\n" + 
	"        {\n" + 
	"            var d1 = document.getElementById(id1);\n" + 
	"            var d2 = document.getElementById(id2);\n" + 
	"            var s = d1.style.display;\n" + 
	"            d1.style.display = d2.style.display;\n" + 
	"            d2.style.display = s;\n" + 
	"        }\n" + 
	"");
    devpopup_window.document.write("//]"+"]>\n");
    devpopup_window.document.write("	<");
    devpopup_window.document.write("/script>");
    devpopup_window.document.write("</head>\n" + 
	"<body>\n" + 
	"<h1>Devpopup report for TestAppAuthenticate -&gt; unprotected</h1>\n" + 
	"<a href=\"javascript:window.print()\" class=\"print_button\">Print</a>\n" + 
	"<div id=\"titles\">\n" + 
	"<ul>\n" + 
	"\n" + 
	"    <li class=\"sev_info\">\n" + 
	"        <a onclick=\"swap('#DPS1','#DPR1')\">Authentication</a> - \n" + 
	"    </li>\n" + 
	"\n" + 
	"</ul>\n" + 
	"</div>\n" + 

t/out/login-dev  view on Meta::CPAN

	"<tr class=\"even\"><td valign=\"top\">authen_password</td><td></td></tr></tbody>\n" + 
	"              </table>\n" + 
	"            </div>\n" + 
	"        </div>\n" + 
	"</div>\n" + 
	"\n" + 
	"\n" + 
	"</body>\n" + 
	"</html>\n" + 
	"");
    devpopup_window.document.close();
    devpopup_window.focus();
    </script>
    

t/out/success-dev  view on Meta::CPAN

Set-Cookie: CAPAUTH_DATA=; path=/; expires=;
Date
Content-Type: text/html; charset=ISO-8859-1

This is private
    <script language="javascript">
    var devpopup_window = window.open("", "devpopup_window", "height=400,width=600,scrollbars,resizable");
    devpopup_window.document.write("<?xml version=\"1.0\"?>\n" + 
	"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" + 
	"    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + 
	"\n" + 
	"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + 
	"<head>\n" + 
	"    <title>Devpopup results</title>\n" + 
	"    <style type=\"text/css\">\n" + 
	"        div.report { border: dotted 1px black; margin: 1em;}\n" + 
	"        div.report h2 { color: #000; background-color: #ddd; padding:.2em; margin-top:0;}\n" + 
	"        div.report_full, div.report_summary { padding: 0em 1em; }\n" + 
	"        a:hover, div.report h2:hover, a.print_button:hover { cursor: pointer; background-color: #eee; }\n" + 
	"        a { text-decoration: underline }\n" + 
	"        a.print_button { text-align: right; float: right; clear: right; padding: .2em; margin-right: 1em; color: #000; background-color:#ddd; border:solid 1px #444; }\n" + 
	"        // severity colors\n" + 
	"        .sev_debug             { background-color: #ccffcc; color: #000; }\n" + 
	"        .sev_info              { } // default\n" + 
	"        .sev_warning           { background-color: #ffff99; color: #000; }\n" + 
	"        .sev_error             { background-color: #ff9999; color: #000; }\n" + 
	"        .sev_fatal             { background-color: #ff6600; color: #fff; font-weight: bold; }\n" + 
	"    </style>\n" + 
	"");
    devpopup_window.document.write("	<s");
    devpopup_window.document.write("cript type=\"text/javascript\">\n");
    devpopup_window.document.write("//"+"<"+"![CDATA[\n");
    
    devpopup_window.document.write("        function swap(id1,id2)\n" + 
	"        {\n" + 
	"            var d1 = document.getElementById(id1);\n" + 
	"            var d2 = document.getElementById(id2);\n" + 
	"            var s = d1.style.display;\n" + 
	"            d1.style.display = d2.style.display;\n" + 
	"            d2.style.display = s;\n" + 
	"        }\n" + 
	"");
    devpopup_window.document.write("//]"+"]>\n");
    devpopup_window.document.write("	<");
    devpopup_window.document.write("/script>");
    devpopup_window.document.write("</head>\n" + 
	"<body>\n" + 
	"<h1>Devpopup report for TestAppAuthenticate -&gt; protected</h1>\n" + 
	"<a href=\"javascript:window.print()\" class=\"print_button\">Print</a>\n" + 
	"<div id=\"titles\">\n" + 
	"<ul>\n" + 
	"\n" + 
	"    <li class=\"sev_info\">\n" + 
	"        <a onclick=\"swap('#DPS1','#DPR1')\">Authentication</a> - \n" + 
	"    </li>\n" + 
	"\n" + 
	"</ul>\n" + 
	"</div>\n" + 

t/out/success-dev  view on Meta::CPAN

	"<tr class=\"odd\"><td valign=\"top\">authen_password</td><td>123</td></tr></tbody>\n" + 
	"              </table>\n" + 
	"            </div>\n" + 
	"        </div>\n" + 
	"</div>\n" + 
	"\n" + 
	"\n" + 
	"</body>\n" + 
	"</html>\n" + 
	"");
    devpopup_window.document.close();
    devpopup_window.focus();
    </script>
    



( run in 2.979 seconds using v1.01-cache-2.11-cpan-364913b4093 )