Thread.CurrentPrincipal keeps getting reset in WPF

I’m porting an app. to WPF from Windows Forms. In the Windows Forms application we used to store our own IPrincipal implementation object which stored info. about the user and a security token.

For example

Thread.CurrentPrincipal = 
    new UserPrincipal("username", token);

Whilst porting the code I noticed that the CurrentPrincipal kept getting reset to a GenericPrincipal object.

Long story short, in WPF we need to call the SetThreadPrincipal on the current app domain to set the principal instead of via the CurrentPrincipal property, for example

AppDomain.CurrentDomain.SetThreadPrincipal(
    new UserPrincipal("username", token));