From e1c5cecf2d2827eb3d50c9c4aca0fd025045bebe Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Wed, 10 Jan 2024 14:22:46 +0100 Subject: [PATCH] API Key Management documentation (#339) --- src/AdminConsole/Pages/App/Settings/_ApiKeys.cshtml | 9 +++++---- src/AdminConsole/Pages/_ViewImports.cshtml | 4 +++- src/Service/SharedManagementService.cs | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/AdminConsole/Pages/App/Settings/_ApiKeys.cshtml b/src/AdminConsole/Pages/App/Settings/_ApiKeys.cshtml index 238110431..ac201a575 100644 --- a/src/AdminConsole/Pages/App/Settings/_ApiKeys.cshtml +++ b/src/AdminConsole/Pages/App/Settings/_ApiKeys.cshtml @@ -66,8 +66,8 @@ {
@Html.Hidden(ApiKeysModel.SelectedApiKeyIdField, apiKey.Id) -
@@ -76,8 +76,8 @@ {
@Html.Hidden(ApiKeysModel.SelectedApiKeyIdField, apiKey.Id) -
} @@ -97,6 +97,7 @@ + here.")"> \ No newline at end of file diff --git a/src/AdminConsole/Pages/_ViewImports.cshtml b/src/AdminConsole/Pages/_ViewImports.cshtml index 4a6ecbb2a..a802119c8 100644 --- a/src/AdminConsole/Pages/_ViewImports.cshtml +++ b/src/AdminConsole/Pages/_ViewImports.cshtml @@ -10,4 +10,6 @@ @using Passwordless.AdminConsole.Components.Shared.Links // Razor Pages -@using Passwordless.AdminConsole.TagHelpers \ No newline at end of file +@using Passwordless.AdminConsole.TagHelpers + +@using Microsoft.AspNetCore.Components \ No newline at end of file diff --git a/src/Service/SharedManagementService.cs b/src/Service/SharedManagementService.cs index 7ebc1e520..d5b2963da 100644 --- a/src/Service/SharedManagementService.cs +++ b/src/Service/SharedManagementService.cs @@ -150,7 +150,7 @@ public async Task ValidateSecretKey(string secretKey) if (existingKey.IsLocked) { _eventLogger.LogDisabledApiKeyUsedEvent(_systemClock.UtcNow.UtcDateTime, appId, new ApplicationSecretKey(secretKey)); - throw new ApiException("ApiKey has been disabled due to account deletion in process. Please see email to reverse.", 403); + throw new ApiException("api_key_locked", "ApiKey has been locked.", 403); } if (ApiKeyUtils.Validate(existingKey.ApiKey, secretKey)) @@ -178,7 +178,7 @@ public async Task ValidatePublicKey(string publicKey) } _eventLogger.LogDisabledPublicKeyUsedEvent(_systemClock.UtcNow.UtcDateTime, appId, new ApplicationPublicKey(publicKey)); - throw new ApiException("ApiKey has been disabled due to account deletion in process. Please see email to reverse.", 403); + throw new ApiException("api_key_locked", "ApiKey has been locked.", 403); } _eventLogger.LogInvalidPublicKeyUsedEvent(_systemClock.UtcNow.UtcDateTime, appId, new ApplicationPublicKey(publicKey));