#317 Dispose WindowsIdentity
This commit is contained in:
parent
c328e22699
commit
32bc9a57c9
|
|
@ -224,8 +224,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
&& info->InfoType == HttpApi.HTTP_REQUEST_INFO_TYPE.HttpRequestInfoTypeAuth
|
||||
&& info->pInfo->AuthStatus == HttpApi.HTTP_AUTH_STATUS.HttpAuthStatusSuccess)
|
||||
{
|
||||
return new WindowsPrincipal(new WindowsIdentity(info->pInfo->AccessToken,
|
||||
GetAuthTypeFromRequest(info->pInfo->AuthType).ToString()));
|
||||
// Duplicates AccessToken
|
||||
var identity = new WindowsIdentity(info->pInfo->AccessToken,
|
||||
GetAuthTypeFromRequest(info->pInfo->AuthType).ToString());
|
||||
|
||||
// Close the original
|
||||
UnsafeNclNativeMethods.SafeNetHandles.CloseHandle(info->pInfo->AccessToken);
|
||||
|
||||
return new WindowsPrincipal(identity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
// TODO: Verbose log
|
||||
_isDisposed = true;
|
||||
_nativeRequestContext.Dispose();
|
||||
(User?.Identity as WindowsIdentity)?.Dispose();
|
||||
if (_nativeStream != null)
|
||||
{
|
||||
_nativeStream.Dispose();
|
||||
|
|
|
|||
Loading…
Reference in New Issue