in reply to OT: WebApp Authorization Question

These days I'm using CGI::Application, with CGI::Application::Plugin::Authentication and Authorization. There is a lot that those two modules can offer you. I adapt the user/group/roles schema offered by Auth and Authz so that it is compatible with DBIx::UserDB and DBIx::GroupDB. Throw in CGI::Session for handling the authentication tokens across requests and its about handled. Together these five modules seem to provide all I ever needed for a web-resource privilege and access control system. I still haven't sorted out how to store and test against encrypted passwords, but that is on my todo list.

Apparently this system is far more flexible than the sample code below from a project I'm developing, permitting LDAP, ip-based filters, etc., etc.

Understand that unless your connection is encrypted, that passwords are subject to man-in-the-middle sniffing attacks. Even if you store them encrypted on your server, they'll come at port 80 in clear text.

-- Hugh

use warnings; use strict; use base 'CGI::Application'; use CGI::Application::Plugin::Session; use CGI::Application::Plugin::Authentication; use CGI::Application::Plugin::Authorization; use CGI::Application::Plugin::Authentication::Driver::Filter::md5; . . . DistroPrsRls_www->authen->config( DRIVER => [ 'DBI', DBH => $authdb, TABLE => 'userdb', CONSTRAINTS => { 'userdb.username' => '__CREDENTIAL_1__', 'userdb.password' => '__CREDENTIAL_2__' }, ], STORE => 'Session', CREDENTIALS => [ 'authen_username','authen_password' ], LOGIN_SESSION_TIMEOUT => { IDLE_FOR => '15m', EVERY => '1h' }, ); DistroPrsRls_www->authz->config( DRIVER => [ 'DBI', DBH => $authdb, TABLES => ['userdb', 'groupmembers', 'groupdb'], JOIN_ON => 'userdb.uid = groupmembers.uid AND groupdb.gid = grou +pmembers.gid', USERNAME => 'userdb.username' , CONSTRAINTS => { 'groupdb.groupname' => '__PARAM_1__', } ], ); DistroPrsRls_www->authz('dpradmin')->config( DRIVER => [ 'DBI', DBH => $authdb, TABLES => ['userdb', 'groupmembers', 'groupdb'], JOIN_ON => 'userdb.uid = groupmembers.uid AND groupdb.gid = grou +pmembers.gid', USERNAME => 'userdb.username' , CONSTRAINTS => { 'groupdb.groupname' => '__PARAM_1__', } ], ); DistroPrsRls_www->authen->protected_runmodes(qr/^(login_|admin_|dpr_)/ +);
if( $lal && $lol ) { $life++; }