From 04b72ca766c703ff83ae016f781e36aa41863bb6 Mon Sep 17 00:00:00 2001 From: Lanaparezanin Date: Wed, 15 Jan 2025 11:27:41 -0800 Subject: [PATCH] Added V5 short lived credential type and excluded it from the API keys page --- src/NuGetGallery.Core/CredentialTypes.cs | 6 ++++-- src/NuGetGallery/Scripts/gallery/page-api-keys.js | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/NuGetGallery.Core/CredentialTypes.cs b/src/NuGetGallery.Core/CredentialTypes.cs index 3db44b2e98..67a58649e1 100644 --- a/src/NuGetGallery.Core/CredentialTypes.cs +++ b/src/NuGetGallery.Core/CredentialTypes.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -25,6 +25,7 @@ public static class ApiKey public const string V2 = Prefix + "v2"; public const string V3 = Prefix + "v3"; public const string V4 = Prefix + "v4"; + public const string V5 = Prefix + "v5"; public const string VerifyV1 = Prefix + "verify.v1"; } @@ -63,7 +64,8 @@ public static bool IsType(this Credential c, string type) ApiKey.V1, ApiKey.V2, ApiKey.V3, - ApiKey.V4 + ApiKey.V4, + ApiKey.V5 }; /// diff --git a/src/NuGetGallery/Scripts/gallery/page-api-keys.js b/src/NuGetGallery/Scripts/gallery/page-api-keys.js index 9d980ce512..8546d61468 100644 --- a/src/NuGetGallery/Scripts/gallery/page-api-keys.js +++ b/src/NuGetGallery/Scripts/gallery/page-api-keys.js @@ -646,8 +646,13 @@ function ApiKeyListViewModel(initialData) { var self = this; + // Excluding v5 + var typeToOmit = "apikey.v5"; + var apiKeys = $.map(initialData.ApiKeys, function (data) { - return new ApiKeyViewModel(self, initialData.PackageOwners, data); + if (data.Type !== typeToOmit) { + return new ApiKeyViewModel(self, initialData.PackageOwners, data); + } }); var newApiKey = new ApiKeyViewModel(self, initialData.PackageOwners);