0

I am trying to get the information about the user who is accessing the website for user authentication and for some other purpose also. After looking at official documentation of Django I got this article but still when I am trying to access request.META["REMOTE_USER"] I am getting the error because no key exists. After some tweaks when I tried again I was getting the username of my PC even if I tried to access my website from another PC on from the same network.

I am using Django's lightweight server for testing, hosted on my PC and trying and access the website from another PC on the same network.

Please help and try to resolve this issue.

1 Answers1

0

From your documentation link:

This type of authentication solution is typically seen on intranet sites, with single sign-on solutions such as IIS and Integrated Windows Authentication or Apache and mod_authnz_ldap, CAS, Cosign, WebAuth, mod_auth_sspi, etc.

When the Web server takes care of authentication it typically sets the REMOTE_USER environment variable for use in the underlying application.

So, you have to configure your web server to set REMOTE_USER to use that. You don't give a lot of context in your question, but are you sure this is what you're after? Otherwise, I'd recommend starting here:

https://docs.djangoproject.com/en/3.0/topics/auth/

Community
  • 1
  • 1
Johan Schiff
  • 661
  • 4
  • 13
  • Yes, I am working on an intranet site and I am looking forward to LDAP authentication. But I am new into such things. Can you please explain a bit more or give some resources so that I can understand and know the path to do this and how to exactly configure my server. Is it possible to configure Django's lightweight server for this. Please help, I'll be thankful. – abhishek kumar Mar 29 '20 at 09:11