Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on?

前端 未结 1 1186
既然无缘
既然无缘 2021-01-02 21:56

I enabled impersonation and windows authentiaction.




        
相关标签:
1条回答
  • 2021-01-02 22:17

    As far as I can understand the Thread.CurrentPrincipal contains the information of conditions the thread has been started with, including the WindowsIdentity. That's why Thread.CurrentPrincipal.Identity.Name returns the name of User who started the thread. To the contrary WindowsIdentity.GetCurrent() Returns a WindowsIdentity object that represents the current Windows user, which has been changed via Impersonation. I'm not 100% sure about it, but that's how I think it works.

    0 讨论(0)
提交回复
热议问题