This commit is contained in:
Cyberboss
2018-09-27 14:03:04 -04:00
parent 7d7d9ccd7d
commit 4d4b6a0606
@@ -62,7 +62,13 @@ namespace Tgstation.Server.Host.Security
public ISystemIdentity Clone()
{
if (identity != null)
return new WindowsSystemIdentity((WindowsIdentity)identity.Clone());
{
//var newIdentity = (WindowsIdentity)identity.Clone(); //doesn't work because of https://github.com/dotnet/corefx/issues/31841
var newIdentity = new WindowsIdentity(identity.Token); //the handle is cloned internally
return new WindowsSystemIdentity(newIdentity);
}
//can't clone a UP, shouldn't be trying to anyway, cloning is for impersonation
throw new InvalidOperationException("Cannot clone a UserPrincipal based WindowsSystemIdentity!");
}