> -----Original Message-----
> From: John Russell [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 24, 2000 8:08 PM
> To: [EMAIL PROTECTED]
> Subject: Authorization handler & shared database handle
> 
> 
> I'm using Apache::DBI, DBI and DBD::Oracle
> 
> The database connection is made with one username/password for best
> performance but a pl/sql program in the database authorizes 
> the supplied
> username and password and then generates the desired output.
> 
> The username and password has been obtained using basic authentication
> with Apache::AuthAny (pp 282-285 Apache Modules with Perl & C 
> - Stein &
> MacEachern).
> 
> Possible solutions might be:

I'm not sure I understand what the 'problem' is - do you mean that you use
one user/pass to authenticate another user/pass in authentication but then
need the authenticated user/pass to connect to the database during content
generation (PerlHandler)?

One of the problems with Apache::DBI is that it caches connections per
connect string, meaning that if you have 50 distinct users you'll have 50
cached connections per child (assuming that they hit each child)...

one solution to this is to cache the authenticating user/pass and then use
the 6 argument connect call:
$dbh = DBI->connect($dbase, $user, $pass, \%attr, undef, "connect") || die
$DBI::errstr;
                                                  ^^^^^^^^^^^^^^^^

which will override Apache::DBI for that connection only (keep in mind you
should call disconnect if you weren't before)

> 
> 1) connect and authorize using the authentication handler and pass the
> database handle to the script to do further operations on the opened
> connection. If this is possible how would you pass the database handle
> from the authentication handler to the perl program?

I imagine you can place $dbh into pnotes and pass it to your PerlHandler,
but if you are using Apache::DBI calling connect again will have basically
the same effect, since it will just return a cached connection

HTH

--Geoff

> 
> 2) Allow the perl program to return DECLINED or AUTH_REQUIRED 
> to Apache.
> How would you do this?
> 
> Thanks,
> John Russell
> 

Reply via email to