From 9a58285b165c9564622d54e818d4b67800c33990 Mon Sep 17 00:00:00 2001 From: sigurdgroneng Date: Tue, 3 Jan 2023 15:46:35 +0100 Subject: [PATCH] Allow azure m2m tokens on kvp endpoint --- .../nav/veilarboppfolging/controller/v2/KvpV2Controller.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/no/nav/veilarboppfolging/controller/v2/KvpV2Controller.java b/src/main/java/no/nav/veilarboppfolging/controller/v2/KvpV2Controller.java index efa178386..c9998406f 100644 --- a/src/main/java/no/nav/veilarboppfolging/controller/v2/KvpV2Controller.java +++ b/src/main/java/no/nav/veilarboppfolging/controller/v2/KvpV2Controller.java @@ -54,7 +54,9 @@ public ResponseEntity getKvpStatus(@RequestParam("aktorId") AktorId akto private boolean isRequestAuthorized(AktorId aktorId) { String username = authContextHolder.getSubject().orElse("").toLowerCase(); String appName = authService.hentApplikasjonFraContext(); - if (authService.erSystemBruker()) { + if (authService.erSystemBrukerFraAzureAd()) { + return allowedUsers.contains(appName); + } else if (authService.erSystemBruker()) { return allowedUsers.contains(username); } else if (authService.erInternBruker()) { return allowedApps.contains(appName);