diff --git a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedResourceServerType.java b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedResourceServerType.java index b6b72f5802d..dfbdfe9d83d 100644 --- a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedResourceServerType.java +++ b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedResourceServerType.java @@ -40,7 +40,7 @@ public Mono call() { .map(Mono::just) .orElseGet(Mono::empty); } else if (authentication instanceof OAuth2AuthenticationToken) { - return Mono.just(ResourceServerType.TOKEN_X); + return Mono.just(ResourceServerType.OAUTH2); } return Mono.empty(); }); diff --git a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedUserId.java b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedUserId.java index b8b3aa27f8f..761c65b818f 100644 --- a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedUserId.java +++ b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/GetAuthenticatedUserId.java @@ -21,7 +21,7 @@ public Mono call() { return getAuthenticatedResourceServerType .call() .flatMap(serverType -> switch (serverType) { - case TOKEN_X -> getTokenAttribute("pid"); + case TOKEN_X, OAUTH2 -> getTokenAttribute("pid"); case AZURE_AD -> getTokenAttribute("oid"); }); } diff --git a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ResourceServerType.java b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ResourceServerType.java index ee579cb3018..645b9354d95 100644 --- a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ResourceServerType.java +++ b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ResourceServerType.java @@ -2,5 +2,6 @@ public enum ResourceServerType { TOKEN_X, - AZURE_AD + AZURE_AD, + OAUTH2 }