diff --git a/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs b/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs index deb07e49f9..1cd09cd8c7 100644 --- a/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs +++ b/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs @@ -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!"); }