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++; }

In reply to Re: OT: WebApp Authorization Question by hesco
in thread OT: WebApp Authorization Question by jimbus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.