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);