python - Getting User Identity from a POST Request in ASP.NET -


so asp.net site being hosted on intranet. 1 of things need able active directory username of person if trying post request through simple api have set up.

currently confused settings. in web.config have following: <authentication mode="windows" />

and in applicationhost.config have this:

            <authentication>              <anonymousauthentication enabled="true" username="" />              <basicauthentication enabled="false" />              <clientcertificatemappingauthentication enabled="false" />              <digestauthentication enabled="false" />              <windowsauthentication enabled="true">                 <providers>                     <add value="negotiate" />                     <add value="ntlm" />                 </providers>             </windowsauthentication>              <iisclientcertificatemappingauthentication enabled="false">             </iisclientcertificatemappingauthentication>          </authentication> 

but if turn off anonymous authentication breaks of methods calling via urllib2 in python , unable access them (401 forbidden).

what want able this:

        string logonname = user.identity.name; 

whenever there post request server , compare name against active directory see if in group correct permissions make post. have working if hardcode username whenever send post request goes anonymous authentication , returns "" user.

so there way grab just username (no password needed) in asp.net application? should handled on python side or there easy way configure settings it, if so, how?

any direction appreciated.

if you're using windows authentication should turn off anonymous authentication.

if make api call outside browser example not jquery, won't pass credentials api server.

what may do, turn off windows authentication , pass username parameter of api method, , can use query ad.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -