Ok, here's the solution to getting permission to call WindowsPrincipal from a web part that hasn't been given full trust.
Note: it may not be the 100% best implementation, or the most advised, but it's what i did to make it work.
I located the config file which stores information for minimal trust - this is the file which "limits" execution of classes outside of the Sharepoint install.
it's called wss_minimaltrust.config. It has a section in it which is called SecurityClasses - in that section add the following:
<SecurityClass Name="ADPermissions" Description="System.Security.Principal, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<SecurityClass Name="ADSecPermissions" Description="System.Security.Permissions.SecurityPermission, mscorlib, version=2.0.0.0, PublicKeyToken=b77a5c561934e089" />
Then below there you'll see a series of IPermission entries. Add the following:
<IPermission class="ADPermission" version="1" Unrestricted="true" Flags="Execution, WindowsPrincipal" />
<IPermission class="ADSecPermissions" version="1" Unrestricted="true" Flags="Execution, WindowsPrincipal" />
IIS will automatically pick up on the config changes first time it loads so you don't have to restart IIS.
and there you go, that's how you get access to the WindowsPrincipal class from within a web part that doesn't have full trust (eg. is installed in the GAC).
Regards
Brian H. Madsen - CSharpZealot
Microsoft MVP Visual Developer ASP/ASP.Net
blog: http://www.msmvps.com/blogs/brianmadsen
site: http://www.csharpzealot.com
Microsoft SQL Server UG Perth - President
http://www.sqlserver.org.au