From 940304b4c2029611729e80c0322be557b96b5e30 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sun, 9 Jan 2022 20:08:45 +0000 Subject: [PATCH] Added GET /admin/apikey/test endpoint, so that we have a dedicated place to test if authentication works. --- .../org/qortal/api/resource/AdminResource.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/org/qortal/api/resource/AdminResource.java b/src/main/java/org/qortal/api/resource/AdminResource.java index d2bc8fb3..d9f35550 100644 --- a/src/main/java/org/qortal/api/resource/AdminResource.java +++ b/src/main/java/org/qortal/api/resource/AdminResource.java @@ -746,4 +746,22 @@ public class AdminResource { return apiKey.toString(); } + @GET + @Path("/apikey/test") + @Operation( + summary = "Test an API key", + responses = { + @ApiResponse( + description = "true if authenticated", + content = @Content(mediaType = MediaType.TEXT_PLAIN, schema = @Schema(type = "boolean")) + ) + } + ) + @SecurityRequirement(name = "apiKey") + public String testApiKey() { + Security.checkApiCallAllowed(request); + + return "true"; + } + }