From 94e6e6820323b4831cfee5c20ae728ea7c93ef0a Mon Sep 17 00:00:00 2001 From: "Kristen.Herum" Date: Tue, 17 Dec 2024 13:51:32 +0100 Subject: [PATCH] Refactor logging and adjust configuration limits #deploy-idporten-frontend Refactored log statements in reactive-security to include more contextual details about authentication objects. Updated `config.idporten.yml` to reduce the maximum number of replicas to 1. Commented out the Playwright job in the frontend workflow file to disable it temporarily. --- .github/workflows/app.dolly-frontend.yml | 12 ++++++------ apps/dolly-frontend/config.idporten.yml | 2 +- .../action/GetAuthenticatedUserId.java | 2 +- .../libs/reactivesecurity/action/JwtResolver.java | 2 +- .../libs/reactivesecurity/action/Oauth2Resolver.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/app.dolly-frontend.yml b/.github/workflows/app.dolly-frontend.yml index d8dfc7b61ca..db434e1d3e7 100644 --- a/.github/workflows/app.dolly-frontend.yml +++ b/.github/workflows/app.dolly-frontend.yml @@ -17,12 +17,12 @@ on: - ".github/workflows/common.playwright.yml" jobs: - playwright: - uses: ./.github/workflows/common.playwright.yml - with: - working-directory: "apps/dolly-frontend" - secrets: - READER_TOKEN: ${{ secrets.READER_TOKEN }} +# playwright: +# uses: ./.github/workflows/common.playwright.yml +# with: +# working-directory: "apps/dolly-frontend" +# secrets: +# READER_TOKEN: ${{ secrets.READER_TOKEN }} workflow: uses: ./.github/workflows/common.workflow.frontend.yml diff --git a/apps/dolly-frontend/config.idporten.yml b/apps/dolly-frontend/config.idporten.yml index cfecc814280..64f2ba53138 100644 --- a/apps/dolly-frontend/config.idporten.yml +++ b/apps/dolly-frontend/config.idporten.yml @@ -17,7 +17,7 @@ spec: tenant: nav.no replicas: min: 1 - max: 2 + max: 1 port: 8080 ingresses: - "https://dolly-idporten.ekstern.dev.nav.no" 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 0245716fe5e..43f1fd1589f 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 @@ -39,7 +39,7 @@ private Mono getTokenAttribute(String attribute) { private String getTokenAttribute(Authentication authentication, String attribute) { - log.info("context.authentication {}, {}", authentication.getClass().getCanonicalName(), authentication); + log.info("GetAuthenticatedUserId context.authentication {}, {}", authentication.getClass().getPackageName(), authentication); if (authentication instanceof JwtAuthenticationToken jwtAuthenticationToken) { return jwtAuthenticationToken.getTokenAttributes().get(attribute).toString(); diff --git a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/JwtResolver.java b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/JwtResolver.java index f209fcf9356..7beef869426 100644 --- a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/JwtResolver.java +++ b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/JwtResolver.java @@ -19,7 +19,7 @@ Mono getJwtAuthenticationToken() { return ReactiveSecurityContextHolder .getContext() .switchIfEmpty(Mono.error(new JwtResolverException("ReactiveSecurityContext is empty"))) - .doOnNext(context -> log.info("context.authentication {}", context.getAuthentication())) + .doOnNext(context -> log.info("JwtResolver context.authentication {} {}", context.getAuthentication().getClass().getCanonicalName(), context.getAuthentication())) .map(SecurityContext::getAuthentication) .map(JwtAuthenticationToken.class::cast) .doOnError(throwable -> log.warn("Klarte ikke hente Jwt Auth Token", throwable)) diff --git a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/Oauth2Resolver.java b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/Oauth2Resolver.java index e70f88788bd..68dac390a55 100644 --- a/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/Oauth2Resolver.java +++ b/libs/reactive-security/src/main/java/no/nav/testnav/libs/reactivesecurity/action/Oauth2Resolver.java @@ -20,7 +20,7 @@ public static Mono getOauth2AuthenticationToken() { return ReactiveSecurityContextHolder .getContext() .switchIfEmpty(Mono.error(new JwtResolverException("ReactiveSecurityContext is empty"))) - .doOnNext(context -> log.info("context.authentication {}", context.getAuthentication())) + .doOnNext(context -> log.info("Oauth2Resolver context.authentication {} {}", context.getAuthentication().getClass().getCanonicalName(), context.getAuthentication())) .map(SecurityContext::getAuthentication) .map(OAuth2AuthenticationToken.class::cast) .doOnError(throwable -> log.warn("Klarte ikke hente Jwt Auth Token", throwable))