CGI::Application::Plugin::Authentication

CGI::Application::Plugin::Authentication is an authentication framework for CGI::Application.
Download

CGI::Application::Plugin::Authentication Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Cees Hek
  • Publisher web site:
  • http://search.cpan.org/~ceeshek/CGI-Application-Plugin-TT-1.04/lib/CGI/Application/Plugin/TT.pm

CGI::Application::Plugin::Authentication Tags


CGI::Application::Plugin::Authentication Description

CGI::Application::Plugin::Authentication is an authentication framework for CGI::Application. CGI::Application::Plugin::Authentication is an authentication framework for CGI::Application.SYNOPSIS package MyCGIApp; use base qw(CGI::Application); # make sure this occurs before you load the plugin use CGI::Application::Plugin::Authentication; MyCGIApp->authen->config( DRIVER => , ); MyCGIApp->authen->protected_runmodes('myrunmode'); sub myrunmode { my $self = shift; # The user should be logged in if we got here my $username = $self->authen->username; }CGI::Application::Plugin::Authentication adds the ability to authenticate users in your CGI::Application modules. It imports one method called 'authen' into your CGI::Application module. Through the authen method you can call all the methods of the CGI::Application::Plugin::Authentication plugin.There are two main decisions that you need to make when using this module. How will the usernames and password be verified (ie from a database, LDAP, etc...), and how can we keep the knowledge that a user has already logged in persistent, so that they will not have to enter their credentials again on the next request (ie how do we 'Store' the authentication information across requests).Choosing a DriverThere are three drivers that are included with the distribution. Also, there is built in support for all of the Authen::Simple modules (search CPAN for Authen::Simple for more information). This should be enough to cover everyone's needs.If you need to authenticate against a source that is not provided, you can use the Generic driver which will accept either a hash of username/password pairs, or an array of arrays of credentials, or a subroutine reference that can verify the credentials. So through the Generic driver you should be able to write your own verification system. There is also a Dummy driver, which blindly accepts any credentials (useful for testing). See the CGI::Application::Plugin::Authentication::Driver::Generic, CGI::Application::Plugin::Authentication::Driver::DBI and, CGI::Application::Plugin::Authentication::Driver::Dummy docs for more information on how to use these drivers. And see the Authen::Simple suite of modules for information on those drivers.Choosing a StoreThe Store modules keep information about the authentication status of the user persistent across multiple requests. The information that is stored in the store include the username, and the expiry time of the login. There are two Store modules included with this distribution. A Session based store, and a Cookie based store. If your application is already using Sessions (through the CGI::Application::Plugin::Session module), then I would recommend that you use the Session store for authentication. If you are not using the Session plugin, then you can use the Cookie store. The Cookie store keeps all the authentication in a cookie, which contains a checksum to ensure that users can not change the information.If you do not specify which Store module you wish to use, the plugin will try to determine the best one for you.Login pageThe Authentication plugin comes with a default login page that can be used if you do not want to create a custom login page. This login form will automatically be used if you do not provide either a LOGIN_URL or LOGIN_RUNMODE parameter in the configuration. If you plan to create your own login page, I would recommend that you start with the HTML code for the default login page, so that your login page will contain the correct form fields and hidden fields.TODO: The login page is designed using CSS stylesheets. I plan to make this more flexible, so that you can easily create your own stylesheets to make this login form more re-usable. Also, the default CSS has only really been tested on Mozilla based browser, so if there are any CSS gurus out there, I would appreciate some help in getting the default login page to work nicely in most browsers. Currently it should degrade gracefully, but it might not be pretty...Ticket based authenticationThis Authentication plugin can handle ticket based authentication systems as well. All that is required of you is to write a Store module that can understand the contents of the ticket. The Authentication plugin will require at least the 'username' to be retrieved from the ticket. A Ticket based authentication scheme will not need a Driver module at all, since the actual verification of credentials is done by an external authentication system, possibly even on a different host. You will need to specify the location of the login page using the LOGIN_URL configuration variable, and un-authenticated users will automatically be redirected to your ticket authentication login page. Requirements: · Perl


CGI::Application::Plugin::Authentication Related Software