From 99422529694a037cb97839c347daa01b7fe873b8 Mon Sep 17 00:00:00 2001 From: Stephanya Casanova Date: Wed, 18 Dec 2024 18:29:21 +0100 Subject: [PATCH] [backend] Add 'agent' role and pass the agent token in the installation command --- .../src/main/java/io/openbas/rest/executor/ExecutorApi.java | 1 + .../src/main/java/io/openbas/asset/EndpointService.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openbas-api/src/main/java/io/openbas/rest/executor/ExecutorApi.java b/openbas-api/src/main/java/io/openbas/rest/executor/ExecutorApi.java index 194a114ba9..e3187bc981 100644 --- a/openbas-api/src/main/java/io/openbas/rest/executor/ExecutorApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/executor/ExecutorApi.java @@ -215,6 +215,7 @@ public Executor registerExecutor( if (resolvedToken.isEmpty()) { throw new UnsupportedOperationException("Invalid token"); } + //todo pass agent token String installCommand = this.endpointService.generateInstallCommand(platform, token); return ResponseEntity.ok().contentType(MediaType.TEXT_PLAIN).body(installCommand); } diff --git a/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java b/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java index 494b9bfc22..d8fbfe9ec9 100644 --- a/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java +++ b/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java @@ -126,7 +126,7 @@ public String getFileOrDownloadFromJfrog(String platform, String file, String ad return IOUtils.toString(in, StandardCharsets.UTF_8) .replace("${OPENBAS_URL}", openBASConfig.getBaseUrlForAgent()) - .replace("${OPENBAS_TOKEN}", adminToken) + .replace("${OPENBAS_TOKEN}", adminToken) //todo agent token .replace( "${OPENBAS_UNSECURED_CERTIFICATE}", String.valueOf(openBASConfig.isUnsecuredCertificate()))