public async Task <Response <Capabilities> > Get() { await using var stream = _fileInfo.CreateReadStream(); using var streamReader = new StreamReader(stream); var json = await streamReader.ReadToEndAsync(); var capabilities = Capabilities.FromJson(json); if (_contextAccessor.HttpContext.User.Identity.IsAuthenticated) { return(capabilities); } if (_contextAccessor.HttpContext.Request.Headers.ContainsKey("Authorization")) { return(IsBearer() ? Response.ForNotAuthorized() : Response.ForError("invalid_authorization")); } foreach (var supportedFeature in capabilities.SupportedVersions.SelectMany(sv => sv.SupportedFeatures)) { supportedFeature.Restricted = null; supportedFeature.Private = null; } return(capabilities); }