[Web-SIG] How to make REMOTE_USER variable private across WSGI middlewares?

Etienne Robillard tkadm30 at yandex.com
Wed Oct 12 05:42:15 EDT 2016

Hi Randy,

Thanks for your comment.

Le 2016-10-11 à 19:44, Randy Syring a écrit :
> For what it's worth, I also think you might misunderstand how WSGI 
> works.  I believe the environment object is supposed to exist in a 
> request context.  I'm assuming you only need one user per request, so 
> simply filling in the value of REMOTE_USER seems to me like it should 
> work.  However, I haven't looked at your code or thought long about 
> the problem, it's just an off-handed observation based on your 
> description below.
I believe the OAuth2 middleware and client is functioning correctly and 
is setting the REMOTE_USER value as expected. But I guess the problem is 
because I recreate a new WebOb request object before returning a WSGI 
response. Also, I need to update the WSGI environment for each request 
in order to preserve the value of REMOTE_USER. However, i don't know if 
it's logical to recreate a WSGI request every time. Perhaps the solution 
would be to use a global request object...


Etienne Robillard
tkadm30 at yandex.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/web-sig/attachments/20161012/f8f9cf80/attachment.html>

More information about the Web-SIG mailing list