Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask - IIS Get Windows User Name
#1
I have a Flask application (Python version 3.7) running on IIS ( version 10).  I'm trying to get the Windows username value of the User that is browsing the web site. 

I've used
  • getpass.getuser()
  • os.environ.get("USERNAME")

Getting a value back isn't the problem. The value is always this Service Name or Machine Name account name similar to  SERVICEACCT$. Not "domain\joeb" for example. I have tried numerous web.config file settings every which way I can think of with regards to 

<authentication mode="Windows" />
<identity impersonate="true" /> 

As well as fiddling around with the Authentication settings via IIS Manager.  

Enabling ASP.NET Impersonation
Enabling Windows Authentication 
Enabling / Disabling Anonymous Authentication 

I've even set the IIS APPPOOL identity to a user account value ( my own id) and I still get the SERVICEACCT$ value returned from the getpass.getuser() call.

Regardless of what I try in terms of configuration, I always get what I assume is some service account name. I never get a value like "domain\joew". Is the wfastcgi module just incapable of facilitating Impersonation?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Deploy Flask apps on Windows... SpongeB0B 2 3,986 Aug-08-2021, 09:12 AM
Last Post: ndc85430
  python 3.7 on windows using flask and flask-sqlalchemy. Alpy 2 3,945 Aug-12-2020, 07:24 PM
Last Post: Alpy
  Flask Streaming not working on IIS Windows Revencu 0 2,271 Nov-09-2019, 10:31 PM
Last Post: Revencu
  Flask: Cookies for Saving User Input ? jomonetta 2 3,480 Nov-03-2018, 10:47 AM
Last Post: j.crater
  Failing to install Flask on Windows using pip shayon 1 2,858 Jul-11-2018, 12:36 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020