Remove usage of IOptionsCache (#1287)

This commit is contained in:
Hao Kung 2017-06-26 12:14:02 -07:00 committed by GitHub
parent c2caacb1e8
commit dc4db92d5c
1 changed files with 0 additions and 5 deletions

View File

@ -24,19 +24,16 @@ namespace Microsoft.AspNetCore.Diagnostics.Identity.Service
private readonly IOptions<DeveloperCertificateOptions> _options; private readonly IOptions<DeveloperCertificateOptions> _options;
private readonly ITimeStampManager _timeStampManager; private readonly ITimeStampManager _timeStampManager;
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
private readonly IOptionsCache<IdentityServiceOptions> _identityServiceOptionsCache;
public DeveloperCertificateMiddleware( public DeveloperCertificateMiddleware(
RequestDelegate next, RequestDelegate next,
IOptions<DeveloperCertificateOptions> options, IOptions<DeveloperCertificateOptions> options,
IOptionsCache<IdentityServiceOptions> identityServiceOptions,
ITimeStampManager timeStampManager, ITimeStampManager timeStampManager,
IHostingEnvironment environment, IHostingEnvironment environment,
IConfiguration configuration) IConfiguration configuration)
{ {
_next = next; _next = next;
_options = options; _options = options;
_identityServiceOptionsCache = identityServiceOptions;
_environment = environment; _environment = environment;
_timeStampManager = timeStampManager; _timeStampManager = timeStampManager;
_configuration = configuration; _configuration = configuration;
@ -51,7 +48,6 @@ namespace Microsoft.AspNetCore.Diagnostics.Identity.Service
await _next(context); await _next(context);
return; return;
} }
var openIdOptionsCache = context.RequestServices.GetRequiredService<IOptionsCache<OpenIdConnectOptions>>();
if (_environment.IsDevelopment() && if (_environment.IsDevelopment() &&
context.Request.Path.Equals(_options.Value.ListeningEndpoint)) context.Request.Path.Equals(_options.Value.ListeningEndpoint))
{ {
@ -107,7 +103,6 @@ namespace Microsoft.AspNetCore.Diagnostics.Identity.Service
store.Open(OpenFlags.ReadWrite); store.Open(OpenFlags.ReadWrite);
store.Add(imported); store.Add(imported);
store.Close(); store.Close();
openIdOptionsCache.TryRemove(OpenIdConnectDefaults.AuthenticationScheme);
context.Response.StatusCode = StatusCodes.Status204NoContent; context.Response.StatusCode = StatusCodes.Status204NoContent;
}; };