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] manny.klystron@gmail.com wrote:
> 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!
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] > 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!
>