-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add asynchronous overload of WindowsIdentity.RunImpersonated #1152
Add asynchronous overload of WindowsIdentity.RunImpersonated #1152
Conversation
@ViktorHofer @safern is this expected?Am I missing something?Maybe worflow is changed a bit
And after
|
/azp list |
Commenter does not have sufficient privileges for PR 1152 in repo dotnet/runtime |
...aries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs
Outdated
Show resolved
Hide resolved
...aries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs
Show resolved
Hide resolved
...aries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.cs
Outdated
Show resolved
Hide resolved
I believe this is a bug introduced when moving the corefx testing targets from arcade into the consolidated repo. I believe we should condition this line to only execute when |
...aries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs
Outdated
Show resolved
Hide resolved
...libraries/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
Outdated
Show resolved
Hide resolved
Actually it seems like the <PropertyGroup>
<!-- Lowest supported version -->
<XunitConsolePath>$(MSBuildThisFileDirectory)..\tools\net452\xunit.console.exe</XunitConsolePath>
<XunitConsolePathX86>$(MSBuildThisFileDirectory)..\tools\net452\xunit.console.x86.exe</XunitConsolePathX86>
<!-- Version specific -->
<XunitConsole452Path>$(MSBuildThisFileDirectory)..\tools\net452\xunit.console.exe</XunitConsole452Path>
<XunitConsole452PathX86>$(MSBuildThisFileDirectory)..\tools\net452\xunit.console.x86.exe</XunitConsole452PathX86>
<XunitConsole46Path>$(MSBuildThisFileDirectory)..\tools\net46\xunit.console.exe</XunitConsole46Path>
<XunitConsole46PathX86>$(MSBuildThisFileDirectory)..\tools\net46\xunit.console.x86.exe</XunitConsole46PathX86>
<XunitConsole461Path>$(MSBuildThisFileDirectory)..\tools\net461\xunit.console.exe</XunitConsole461Path>
<XunitConsole461PathX86>$(MSBuildThisFileDirectory)..\tools\net461\xunit.console.x86.exe</XunitConsole461PathX86>
<XunitConsole462Path>$(MSBuildThisFileDirectory)..\tools\net462\xunit.console.exe</XunitConsole462Path>
<XunitConsole462PathX86>$(MSBuildThisFileDirectory)..\tools\net462\xunit.console.x86.exe</XunitConsole462PathX86>
<XunitConsole47Path>$(MSBuildThisFileDirectory)..\tools\net47\xunit.console.exe</XunitConsole47Path>
<XunitConsole47PathX86>$(MSBuildThisFileDirectory)..\tools\net47\xunit.console.x86.exe</XunitConsole47PathX86>
<XunitConsole471Path>$(MSBuildThisFileDirectory)..\tools\net471\xunit.console.exe</XunitConsole471Path>
<XunitConsole471PathX86>$(MSBuildThisFileDirectory)..\tools\net471\xunit.console.x86.exe</XunitConsole471PathX86>
<XunitConsole472Path>$(MSBuildThisFileDirectory)..\tools\net472\xunit.console.exe</XunitConsole472Path>
<XunitConsole472PathX86>$(MSBuildThisFileDirectory)..\tools\net472\xunit.console.x86.exe</XunitConsole472PathX86>
<!-- Lowest supported version -->
<XunitConsoleNetCoreAppPath>$(MSBuildThisFileDirectory)..\tools\netcoreapp1.0\xunit.console.dll</XunitConsoleNetCoreAppPath>
<!-- Version specific -->
<XunitConsoleNetCore1AppPath>$(MSBuildThisFileDirectory)..\tools\netcoreapp1.0\xunit.console.dll</XunitConsoleNetCore1AppPath>
<XunitConsoleNetCore2AppPath>$(MSBuildThisFileDirectory)..\tools\netcoreapp2.0\xunit.console.dll</XunitConsoleNetCore2AppPath>
</PropertyGroup> |
/azp list |
Commenter does not have sufficient privileges for PR 1152 in repo dotnet/runtime |
...libraries/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
Show resolved
Hide resolved
...aries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs
Outdated
Show resolved
Hide resolved
@safern this is a custom property defined in our own xunit console runner: https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.XUnitConsoleRunner/src/build/Microsoft.DotNet.XUnitConsoleRunner.props#L4. I assume this isn't working because netcoreapp wasn't restored correctly or the design time imports failed for some reason. To guard against that we should add |
Submitted #1715 to guard against such case. |
update comment
update comment
Fix comment
fix comment
...libraries/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
Show resolved
Hide resolved
...libraries/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
RunImpersonatedInternal(safeAccessTokenHandle, () => result = func()); | ||
return result; | ||
} | ||
|
||
/// <summary> | ||
/// Runs the specified asynchronous action as the impersonated Windows identity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Runs the specified asynchronous action as the impersonated Windows identity | |
/// Runs the specified asynchronous action as the impersonated Windows identity. |
=> RunImpersonated(safeAccessTokenHandle, func); | ||
|
||
/// <summary> | ||
/// Runs the specified asynchronous action as the impersonated Windows identity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Runs the specified asynchronous action as the impersonated Windows identity | |
/// Runs the specified asynchronous action as the impersonated Windows identity. |
closes https://github.com/dotnet/corefx/issues/24977
On issue there is
#nullable enable
on review comment, but I don't know what it mean, this namespaces seem not annotated yet.At the moment there is not "real" test on "another" user token, I've added some plumbing to test with new win user, took idea from https://github.com/dotnet/runtime/blob/4f9ae42d861fcb4be2fcd5d3d55d5f227d30e723/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CurrentUserOnly.Windows.cs maybe we could at the end merge helper inside Common.
Let me know if it's too much and I'll remove all and will add only simple "same access token current user" test.
Folded two api test in one to reuse assertions and also because the test are pretty the same.
cc: @stephentoub @bartonjs @GrabYourPitchforks
Merry Christmas to all team!