internal static void Validate(this IApplicationBuilder app, IdentityServerAuthenticationOptions options)
        {
            var loggerFactory = app.ApplicationServices.GetService(typeof(ILoggerFactory)) as ILoggerFactory;

            if (loggerFactory == null)
            {
                return;
            }

            var logger = loggerFactory.CreateLogger("IdentityServer4.AccessTokenValidation.Startup");

            if (string.IsNullOrEmpty(options.ApiName) && !options.AllowedScopes.Any())
            {
                logger.LogInformation("Neither an ApiName nor allowed scopes are configured. It is recommended to configure some audience checking.");
            }
        }
        public static IApplicationBuilder UseIdentityServerAuthentication(this IApplicationBuilder app, IdentityServerAuthenticationOptions options)
        {
            var combinedOptions = CombinedAuthenticationOptions.FromIdentityServerAuthenticationOptions(options);

            app.UseIdentityServerAuthentication(combinedOptions);

            return(app);
        }