diff --git a/src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs b/src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs index 692a8bfa0..8ada54d8c 100644 --- a/src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs +++ b/src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs @@ -60,7 +60,7 @@ public static IApplicationBuilder UseIdentityServer(this IApplicationBuilder app internal static void Validate(this IApplicationBuilder app) { - var loggerFactory = app.ApplicationServices.GetService(typeof(ILoggerFactory)) as ILoggerFactory; + var loggerFactory = app.ApplicationServices.GetService(); if (loggerFactory == null) throw new ArgumentNullException(nameof(loggerFactory)); var logger = loggerFactory.CreateLogger("Duende.IdentityServer.Startup"); diff --git a/src/IdentityServer/Hosting/FederatedSignOut/AuthenticationRequestHandlerWrapper.cs b/src/IdentityServer/Hosting/FederatedSignOut/AuthenticationRequestHandlerWrapper.cs index 76e59d29f..0a61a9489 100644 --- a/src/IdentityServer/Hosting/FederatedSignOut/AuthenticationRequestHandlerWrapper.cs +++ b/src/IdentityServer/Hosting/FederatedSignOut/AuthenticationRequestHandlerWrapper.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; namespace Duende.IdentityServer.Hosting.FederatedSignOut; @@ -24,7 +25,7 @@ public AuthenticationRequestHandlerWrapper(IAuthenticationRequestHandler inner, _inner = inner; _context = httpContextAccessor.HttpContext; - var factory = (ILoggerFactory)_context.RequestServices.GetService(typeof(ILoggerFactory)); + var factory = _context.RequestServices.GetService(); _logger = factory?.CreateLogger(GetType()); }