Re: How to make REMOTE_USER variable private across WSGI middlewares?
Etienne Robillard <tkadm30-zJpx2rpV7r/[email protected]> Wed, 12 Oct 2016 05:42:15 -0400
| Newsgroups | gmane.comp.python.web |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============5427454551180540175== Content-Type: multipart/alternative; boundary="------------504F784D8D0465F5A26EC860" This is a multi-part message in MIME format. --------------504F784D8D0465F5A26EC860 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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... Regards, Etienne -- Etienne Robillard tkadm30-zJpx2rpV7r/[email protected] http://www.isotopesoftware.ca/ --------------504F784D8D0465F5A26EC860 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>Hi Randy,</p> <p>Thanks for your comment. <br> </p> <div class="moz-cite-prefix">Le 2016-10-11 à 19:44, Randy Syring a écrit :<br> </div> <blockquote cite="mid:fb5d43f1-7557-a1f4-2e20-5867f8050768-+PLZm/s06Zpa7S/[email protected]" type="cite"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <br> 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 wor<font size="+1">k. 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.</font><br> <div class="moz-signature"><br> </div> </blockquote> 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...<br> <br> Regards,<br> Etienne<br> <pre class="moz-signature" cols="72">-- Etienne Robillard <a class="moz-txt-link-abbreviated" href="mailto:tkadm30-zJpx2rpV7r/[email protected]">tkadm30-zJpx2rpV7r/[email protected]</a> <a class="moz-txt-link-freetext" href="http://www.isotopesoftware.ca/">http://www.isotopesoftware.ca/</a></pre> </body> </html> --------------504F784D8D0465F5A26EC860-- --===============5427454551180540175== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Web-SIG mailing list [email protected] Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: https://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org --===============5427454551180540175==--