From 6551f560913ac0887677bec7ada281ce6a5e1de4 Mon Sep 17 00:00:00 2001 From: Luca Giommi Date: Fri, 27 Oct 2023 10:23:13 +0200 Subject: [PATCH] Cover the case with empty scopes --- .../service/deployment/providers/ImServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java b/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java index 26aa538cf6..c979f9a8b7 100644 --- a/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java +++ b/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java @@ -346,6 +346,13 @@ public boolean doDeploy(DeploymentMessage deploymentMessage) { scopes = String.join(" ", wellKnownResponse.getScopesSupported()); } + if (scopes.isEmpty()){ + String errorMessage = "Zero scopes allowed provided are not sufficient to create a client"; + LOG.error(errorMessage); + iamService.deleteAllClients(restTemplate, resources); + throw new IamServiceException(errorMessage); + } + // Create an IAM client try { LOG.info("Creating client with the identity provider {}", issuerNode);