// This is called by the preceeding middleware, and serves as the entry point this middleware for each incoming request!
        // In our case, we delegate all of this responsibility to our provider service, and simply attach the results to the HttpContext.
        public async Task InvokeAsync(HttpContext httpContext)
        {
            // Stash the keys in the HttpContext so later middleware can access them.
            var keys = await publicKeyProvider.FetchSecurityKeys();

            JWKRetriever.PlaceKeysIntoHttpContext(httpContext, keys);

            // Continue the pipeline by invoking the next middleware.
            await next(httpContext);
        }
 public static IEnumerable <SecurityKey> RetrieveSecurityKeys(HttpContext context)
 {
     return(JWKRetriever.GetKeysFromHttpContext(context));
 }