good chemistry is complicated,
and a little bit messy -LW
Re: CGI server module?by blue_cowdawg (Prior)
|on Apr 18, 2013 at 14:36 UTC||Need Help??|
IMHO opinion if it ain't broke don't fix it. Then again some things need to be broken just so you can fix them. :-)
I'm not sure what you mean by "call them" but if you mean dispatch the browser to them then I'd suggest a redirect which is part of CGI.
If you really insist on refactoring those complex CGI scripts then turn them into modules that you reference from your centralized script.
Another way to look at this: Your goal here appears to be providing logging/auditing and a single sign on. Bravo. But why do you need to centralize everything into once script (as implied by your post). No need of that. Here are some steps I'd proceed along:
Whatever your implementation for authentication is using (e.g. LDAP, relational database, Active Directory, /etc/password, .htaccess.. whatever) make sure you generate a session ID for tracking purposes. Make sure you have a timeout function for those who sign in and then leave their browser unattended.
there's a sample of a session table in a database that can be referenced by a Perl script to determine if a session has timed out. It goes something like this:
I'd make that code a method within a module that the rest of your code can get to.
The other method you'd want to create in your module that checks sessions is a create_session method which generates a string [a-z0-9A-Z] which becomes your session_key.
With all that in place each of your sub-components can now validate accesses against your authentication method without having to reauthenticate.
Another piece of the puzzle would be logging for audit purposes. I'd create a singleton module to handle logging for consistency. One thought would be to log to a database but certainly a flat file would work. The one reason I'd consider a database is so you could create a web application with search abilities to audit activity.
I think I've given you enough to chew on, but there's some thoughts for you.
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg