Hi,

I currently have the following requirement:
- "Include" a JSP script within a PHP script
- Let PHP do the authentication

My first try was to use mod_jk, PHP's virtual() command (which triggers Apache 
subrequests) and Apache authentication (although I actually need to let PHP 
do the authentication).

This worked with the following problems:
- I had to configure "AuthType Basic" twice: Once for the directory where the 
PHP script resides (using .htaccess) and once for the virtual path controlled 
with JkMount (using <Location> in a global configuration file which only adds 
bloat to it)
- Apache authentication is not what I wanted and I could not control the 
username which is passed to tomcat within the PHP script

The attached patch modifies mod_jk in order to use the "REMOTE_USER" 
environment variable instead of the "user" field in the request structure. 
This improves two things:
- Configuring "AuthType Basic" for the JkMount path is no longer required, 
i.e. it's sufficient to configure authentication for the PHP script
- The username passed to tomcat can be modified in the PHP script 
using 'apache_setenv("REMOTE_USER", "fakeduser");' before the virtual() call

Comments, please?

Cheers, Johann
--- tomcat-connectors-1.2.23-src/native/apache-2.0/mod_jk.c.orig	2007-08-03 12:46:47.000000000 +0200
+++ tomcat-connectors-1.2.23-src/native/apache-2.0/mod_jk.c	2007-08-03 12:48:31.000000000 +0200
@@ -548,7 +548,8 @@
     s->reco_status = RECO_NONE;
 
     s->auth_type = NULL_FOR_EMPTY(r->ap_auth_type);
-    s->remote_user = NULL_FOR_EMPTY(r->user);
+    s->remote_user = NULL_FOR_EMPTY((char *)apr_table_get(r->subprocess_env,
+                                                          "REMOTE_USER"));
 
     s->protocol = r->protocol;
     s->remote_host = (char *)ap_get_remote_host(r->connection,

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to