Tuesday, September 23, 2014

Re: request.META['REMOTE_USER'] with django runserver

Hi,

you can add 'django.contrib.auth.backends.ModelBackend' to the AUTHENTICATION_BACKENDS and use a local user.

or
if you like to use the "REMOTE_USER" set up nginx  with auth_basic   and proxy  on your local instance:

location / {
        auth_basic "Restricted";
        auth_basic_user_file /...PATH.../.htpasswd;
        proxy_set_header REMOTE_USER $remote_user;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:8000;
}

in this case you get the  user in "HTTP_REMOTE_USER"

if you like you can make the same configuration with uwsgi and nginx :

uwsgi_pass  unix:///tmp/demo.sock;
include     uwsgi_params;
uwsgi_param REMOTE_USER $remote_user;

and in this case you get the correct header parameter "REMOTE_USER"


Cheers
Jürgen
   
Am 22.09.2014 um 18:36 schrieb Robbie Edwards:
Hi,

On my production server, I'm using REMOTE_USER to provide SSO for an internal service.  It works great on the production server.  However, when running 'runserver' on the development side, this variable is not set so authentication in this manner doesn't work.  Is there a way to config this on the development side so I can develop as if it were in place?

thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0568f70f-9186-49f5-b845-ec9039e11681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment