static public void Run (SecurityContext securityContext, ContextCallback callback, object state)
{
if (securityContext == null) {
throw new InvalidOperationException (Locale.GetText (
"Null SecurityContext"));
}
SecurityContext sc = Thread.CurrentThread.ExecutionContext.SecurityContext;
IPrincipal original = Thread.CurrentPrincipal;
try {
if (sc.IdentityToken != IntPtr.Zero) {
Thread.CurrentPrincipal = new WindowsPrincipal (new WindowsIdentity (sc.IdentityToken));
}
// FIXME: is the security manager isn't active then we may not have
// a compressed stack (bug #78652)
if (securityContext.CompressedStack != null)
CompressedStack.Run (securityContext.CompressedStack, callback, state);
else
callback (state);
}
finally {
if ((original != null) && (sc.IdentityToken != IntPtr.Zero))
Thread.CurrentPrincipal = original;
}
}
#endif