Groups | Blog | Home
all groups > dotnet security > december 2006 >

dotnet security : Thread.CurrentPrincipal still returns GenericPrincipal



manny.klystron NO[at]SPAM gmail.com
12/7/2006 7:20:13 AM
I'm calling AppDomain.SetPrincipalPolicy() with WindowsPrincipal, but
Thread.CurrentPrincipal still returns a GenericPrincipal.

I don't see Thread.CurrentPrincipal being set before this (which can
cause it).

Are there any other circumstances under which this can happen? This is
..NET 2.0, Kerberos authentication, on an AppDomain spawned from the
main (and a second thread within that domain).

Thanks!
manny.klystron NO[at]SPAM gmail.com
12/7/2006 7:49:31 AM
Furthermore, when I create a one-off WindowsPrincipal using the
MSDN-site recommended method "new
WindowsPrincipal(WindowsIdentity.GetCurrent())", the Identity is
correct and authenticated.

However, IsInRole("machine\\Users") returns false, and the principal's
m_rolesLoaded member is still false after the call.

[quoted text, click to view]
Dominick Baier
12/7/2006 3:46:35 PM
SetPrincipalPolicy can have all sorts of strange behavior - e.g. you are
only allowed to call it once etc..

In general i would set Thread.CurrentPrincipal manually...

-----
Dominick Baier (http://www.leastprivilege.com)

[quoted text, click to view]

AddThis Social Bookmark Button