public async Task SetAuthenticatedResponse(HttpResponseMessage httpResponseMessage, HttpContext httpContext, AuthenticationResult authenticationResult) { if (authenticationResult.Regenerate) { httpContext.Response.Headers.Add(_runtimeOptions.SetCookie, $"{_runtimeOptions.CookieToken}{_hashHelper.Base64Encode(authenticationResult.Token)}"); } if (httpResponseMessage.Content != null) { foreach (var contentHeader in httpResponseMessage.Content.Headers) { httpContext.Response.Headers[contentHeader.Key] = contentHeader.Value.ToArray(); } httpContext.Response.Headers[HeaderNames.Expires] = DateTime.Now.AddSeconds(_runtimeOptions.CacheControlMaxAgeInASeconds).ToLongDateString(); httpContext.Response.Headers[HeaderNames.CacheControl] = $"public,max-age={_runtimeOptions.CacheControlMaxAgeInASeconds}"; httpContext.Response.Headers[HeaderNames.Origin] = httpResponseMessage.RequestMessage.RequestUri.AbsoluteUri; await CopyResponse(httpResponseMessage, httpContext); } }