tags:

views:

93

answers:

1

We've got an apache module in place for authentication. If the user is able to authenticate, the REMOTE_USER environment variable is set to their username, where it's available to any CGI they access.

I'd like to add a feature/module so that we can get additional information about the user from an LDAP data source and make it available to CGI and FCGI applications.

Since I know we can put information into the environment, is it appropriate to store a more complex data structure (such as JSON) in an environment variable? That seems clunky to me. Is there a better way to do it?

If it's language-dependent, then I'm most interested in Perl, but it would be best if I could make this data available to any type of CGI or FCGI application. We're using Apache 2.2 on RHEL 5.0 (with SELinux enabled).

+1  A: 

If you need to work with CGI, environment variables seem to be the only option (with mod_perl, you can access Apache's internal data structures).

If the data is too large for the environment, you could create a temporary file and pass just the file name. You could also store this information in the database. In both cases, you probably need to worry about cleaning up the temporary data, and about race conditions with concurrent access.

If you already have persistent server-side session data (a session file or directory or shared memory segment), you may want to place it in there.

Thilo