diff --git a/src/AvantiPoint.Packages.Hosting/Controllers/PackageContentController.cs b/src/AvantiPoint.Packages.Hosting/Controllers/PackageContentController.cs index 65c31dd..f0d1676 100644 --- a/src/AvantiPoint.Packages.Hosting/Controllers/PackageContentController.cs +++ b/src/AvantiPoint.Packages.Hosting/Controllers/PackageContentController.cs @@ -17,7 +17,6 @@ namespace AvantiPoint.Packages.Hosting /// See: https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource /// [AllowAnonymous] - [AuthorizedNuGetConsumer] public class PackageContentController : Controller { private readonly IPackageContentService _content; @@ -27,6 +26,7 @@ public PackageContentController(IPackageContentService content) _content = content ?? throw new ArgumentNullException(nameof(content)); } + [AuthorizedNuGetConsumer] public async Task> GetPackageVersionsAsync(string id, CancellationToken cancellationToken) { var versions = await _content.GetPackageVersionsOrNullAsync(id, cancellationToken); @@ -39,6 +39,7 @@ public async Task> GetPackageVersionsAsync } [HandlePackageDownloaded] + [AuthorizedNuGetConsumer] public async Task DownloadPackageAsync(string id, string version, [FromServices]IPackageContext packageContext, CancellationToken cancellationToken) { if (!NuGetVersion.TryParse(version, out var nugetVersion)) @@ -52,7 +53,6 @@ public async Task DownloadPackageAsync(string id, string version, return NotFound(); } - packageContext.PackageId = id; packageContext.PackageVersion = version; @@ -62,6 +62,7 @@ public async Task DownloadPackageAsync(string id, string version, }; } + [AuthorizedNuGetConsumer] public async Task DownloadNuspecAsync(string id, string version, CancellationToken cancellationToken) { if (!NuGetVersion.TryParse(version, out var nugetVersion)) @@ -78,7 +79,6 @@ public async Task DownloadNuspecAsync(string id, string version, return File(nuspecStream, "text/xml"); } - [AllowAnonymous] public async Task DownloadReadmeAsync(string id, string version, CancellationToken cancellationToken) { if (!NuGetVersion.TryParse(version, out var nugetVersion)) @@ -95,7 +95,6 @@ public async Task DownloadReadmeAsync(string id, string version, return File(readmeStream, "text/markdown"); } - [AllowAnonymous] public async Task DownloadIconAsync(string id, string version, CancellationToken cancellationToken) { if (!NuGetVersion.TryParse(version, out var nugetVersion))