Remove usage of TaskCache

This commit is contained in:
Pranav K 2017-06-08 11:44:04 -07:00
parent f1901516c6
commit 0e4405ab7f
4 changed files with 6 additions and 10 deletions

View File

@ -7,7 +7,6 @@ using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
@ -29,13 +28,13 @@ namespace Microsoft.AspNetCore.Server.HttpSys
public Task ChallengeAsync(AuthenticationProperties properties) public Task ChallengeAsync(AuthenticationProperties properties)
{ {
_requestContext.Response.StatusCode = 401; _requestContext.Response.StatusCode = 401;
return TaskCache.CompletedTask; return Task.CompletedTask;
} }
public Task ForbidAsync(AuthenticationProperties properties) public Task ForbidAsync(AuthenticationProperties properties)
{ {
_requestContext.Response.StatusCode = 403; _requestContext.Response.StatusCode = 403;
return TaskCache.CompletedTask; return Task.CompletedTask;
} }
public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
@ -48,7 +47,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
throw new InvalidOperationException("No RequestContext found."); throw new InvalidOperationException("No RequestContext found.");
} }
return TaskCache.CompletedTask; return Task.CompletedTask;
} }
public Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties properties) public Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties properties)
@ -58,7 +57,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
public Task SignOutAsync(AuthenticationProperties properties) public Task SignOutAsync(AuthenticationProperties properties)
{ {
return TaskCache.CompletedTask; return Task.CompletedTask;
} }
} }
} }

View File

@ -13,7 +13,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.AspNetCore.Http.Features.Authentication;
using Microsoft.Extensions.Internal;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
@ -553,7 +552,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
if (_completed) if (_completed)
{ {
return TaskCache.CompletedTask; return Task.CompletedTask;
} }
_completed = true; _completed = true;
return NotifyOnCompletedAsync(); return NotifyOnCompletedAsync();

View File

@ -14,7 +14,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.TaskCache.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.Net.Http.Headers" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Win32.Registry" Version="$(CoreFxVersion)" /> <PackageReference Include="Microsoft.Win32.Registry" Version="$(CoreFxVersion)" />
<PackageReference Include="System.Security.Principal.Windows" Version="$(CoreFxVersion)" /> <PackageReference Include="System.Security.Principal.Windows" Version="$(CoreFxVersion)" />

View File

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
@ -14,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
private readonly RequestDelegate _requestDelegate; private readonly RequestDelegate _requestDelegate;
public DummyApplication() : this(context => TaskCache.CompletedTask) { } public DummyApplication() : this(context => Task.CompletedTask) { }
public DummyApplication(RequestDelegate requestDelegate) public DummyApplication(RequestDelegate requestDelegate)
{ {