Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Application Access Control

by jeorgen (Pilgrim)
on Sep 24, 2001 at 16:44 UTC ( [id://114301]=note: print w/replies, xml ) Need Help??


in reply to Application Access Control

There are a number of ways of implementing users and groups in Perl scripts. By using Lincoln Stein's user_manage you can tie it into Apache's authentication system, and use .htpasswd files or a database as a backend, among other options. In this way you get the following benefits:

1) You get one user management system valid both for cgi<->database scripts and html files (with .htaccess files in the protected directories for html files)

2) You get a ready-made management user interface in user_manage to manage users and groups, user_manage also allows you to store more items for each user than name and passwd.

Here is some code, taken largely from the POD, that implements an authentication system with Apache's htpasswd system in a perl script. (I'm working on it right now so /msg me if you want some session handling code, how to get groups, etc..).

#!/usr/bin/perl use HTTPD::Authen; print qq§Content-type: text/plain\n\n§; $auth = new HTTPD::Authen(DBType=>"Text",DB=>"/path/to/passwd_file/use +r_manage/users/passwd", Server=>"Apache"); $authen = new HTTPD::Authen::Basic($auth); if($authen->check("jeorgen", "foo")) { print "Well, the passwords match at least\n"; } else { print "Password mismatch! Intruder alert! Intruder alert!\n"; }

/jeorgen

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://114301]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2024-04-25 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found