From 64cc9747e60ea577effada582033da5426880f5d Mon Sep 17 00:00:00 2001 From: Cato Olsen Date: Wed, 11 Dec 2024 17:14:02 +0100 Subject: [PATCH] - Improved error message on missing config. --- .../libs/securitycore/domain/azuread/ClientCredential.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/azuread/ClientCredential.java b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/azuread/ClientCredential.java index 0482462dc5..3ca747b60d 100644 --- a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/azuread/ClientCredential.java +++ b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/azuread/ClientCredential.java @@ -8,12 +8,13 @@ @Getter public class ClientCredential { + private static final String MISSING_CONFIG_MESSAGE = "AZURE_NAV_APP_CLIENT_ID and AZURE_NAV_APP_CLIENT_SECRET must be set"; + private final String clientId; private final String clientSecret; public ClientCredential(String clientId, String clientSecret) { - Assert.notNull(clientId, "AZURE_NAV_APP_CLIENT_ID must be set"); - Assert.notNull(clientSecret, "AZURE_NAV_APP_CLIENT_SECRET must be set"); + Assert.noNullElements(new String[]{clientId, clientSecret}, MISSING_CONFIG_MESSAGE); this.clientId = clientId; this.clientSecret = clientSecret;