We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 116da3b commit 085064dCopy full SHA for 085064d
SnaffCore/Concurrency/BlockingTaskScheduler.cs
@@ -1,6 +1,7 @@
1
using System;
2
using System.Collections.Generic;
3
using System.Numerics;
4
+using System.Security.Principal;
5
using System.Threading;
6
using System.Threading.Tasks;
7
@@ -62,7 +63,13 @@ public void New(Action action)
62
63
// okay, let's add the thing
64
proceed = true;
65
- _taskFactory.StartNew(action, _cancellationSource.Token);
66
+ WindowsIdentity impersonatedUser = WindowsIdentity.GetCurrent();
67
+ _taskFactory.StartNew(() => {
68
+ using (WindowsImpersonationContext ctx = impersonatedUser.Impersonate())
69
+ {
70
+ action();
71
+ }
72
+ }, _cancellationSource.Token);
73
}
74
75
0 commit comments