Since you store the username in the cookie you are probably not concerned about 
security. In this case it might be sufficient to append the username by 
rewriting the query string:

RewriteRule ^/my/map /my/map?user=%{REMOTE_USER} [QSA,PT]

The loadParams() in cgiutil.c only works on the QUERY_STRING and COOKIE. If you 
like you can insert at line 267:

if ((s = getenv2("REMOTE_USER", thread_context)) != NULL) {
        if(m >= maxParams) {
                maxParams *= 2;
                request->ParamNames = (char **) 
msSmallRealloc(request->ParamNames,sizeof(char *) * maxParams);
                request->ParamValues = (char **) 
msSmallRealloc(request->ParamValues,sizeof(char *) * maxParams);
        }
        request->ParamNames[m] = msStrdup("remote_user");
        request->ParamValues[m] = msStrdup(s);
        m++;
}

I haven't tested this but since it's pretty straight forward it should work. 
But that's not very generic. Probably the MAP.WEB.METADATA could be used to 
define a "import_env_vars"-key with a list of names to be imported from the 
environment...

HTH

> -----Ursprüngliche Nachricht-----
> Von: mapserver-dev-boun...@lists.osgeo.org [mailto:mapserver-dev-
> boun...@lists.osgeo.org] Im Auftrag von Smith, Michael ERDC-RDE-CRREL-NH
> Gesendet: Samstag, 20. Dezember 2014 14:25
> An: mapserver-users@lists.osgeo.org
> Cc: mapserver-...@lists.osgeo.org
> Betreff: [mapserver-dev] Is there a way to use REMOTE_USER environment
> variable in RunTime Substitution?
> 
> I'm using apache basic auth to filter results. I have been able to use
> mod_rewrite to create a cookie with the authenticated username and use
> that in runtime subst but it would be much simpler and cleaner to just do
> it reading the environment variable. So far, I haven't found a way to do
> this in current master. Any ideas?
> 
> --
> Michael Smith
> US Army Corps
> Remote Sensing GIS/Center
_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to