From 1d12749a3937587f755a603ace84a14051eeac88 Mon Sep 17 00:00:00 2001 From: kristenhaerum Date: Tue, 9 Jan 2024 10:03:52 +0100 Subject: [PATCH] Update environment variables and config settings in TenorSearchService #deploy-tenor-search-service --- apps/tenor-search-service/config.yml | 11 +----- .../config/MaskinportenConfig.java | 38 +++++-------------- .../src/main/resources/application-local.yml | 6 +-- .../src/main/resources/application.yml | 6 +-- .../src/test/resources/application-test.yml | 4 +- 5 files changed, 19 insertions(+), 46 deletions(-) diff --git a/apps/tenor-search-service/config.yml b/apps/tenor-search-service/config.yml index c08ebbf2bb8..7126109028c 100644 --- a/apps/tenor-search-service/config.yml +++ b/apps/tenor-search-service/config.yml @@ -15,11 +15,6 @@ spec: tenant: nav.no tokenx: enabled: true - maskinporten: - enabled: true - scopes: - consumes: - - name: skatteetaten:tjenestepensjonsavtale accessPolicy: inbound: rules: @@ -63,7 +58,5 @@ spec: env: - name: SPRING_PROFILES_ACTIVE value: prod - - name: ACCEPTED_AUDIENCE - value: dev-gcp:dolly:testnav-tenor-search-service - - name: TOKENDINGS_URL - value: https://tokenx.dev-gcp.nav.cloud.nais.io \ No newline at end of file + - name: MASKINPORTEN_TENOR_SCOPE + value: "skatteetaten:testnorge/testdata.read" \ No newline at end of file diff --git a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/config/MaskinportenConfig.java b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/config/MaskinportenConfig.java index e22b9fcd5c5..a13813ca49c 100644 --- a/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/config/MaskinportenConfig.java +++ b/apps/tenor-search-service/src/main/java/no/nav/testnav/apps/tenorsearchservice/config/MaskinportenConfig.java @@ -1,40 +1,22 @@ package no.nav.testnav.apps.tenorsearchservice.config; +import lombok.Getter; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +@Getter @Configuration public class MaskinportenConfig { - private final String clientId; - private final String jwkPrivate; - private final String scope; - private final String wellKnownUrl; + @Value("${MASKINPORTEN_CLIENT_ID}") + private String clientId; - public MaskinportenConfig( - @Value("${MASKINPORTEN_CLIENT_ID}") String clientId, - @Value("${MASKINPORTEN_CLIENT_JWK}") String jwkPrivate, - @Value("${MASKINPORTEN_WELL_KNOWN_URL}") String wellKnownUrl - ) { - this.clientId = clientId; - this.scope = "skatteetaten:tjenestepensjonsavtale"; - this.jwkPrivate = jwkPrivate; - this.wellKnownUrl = wellKnownUrl; - } + @Value("${MASKINPORTEN_CLIENT_JWK}") + private String jwkPrivate; - public String getClientId() { - return clientId; - } + @Value("${MASKINPORTEN_TENOR_SCOPE}") + private String scope; - public String getJwkPrivate() { - return jwkPrivate; - } - - public String getScope() { - return scope; - } - - public String getWellKnownUrl() { - return wellKnownUrl; - } + @Value("${MASKINPORTEN_WELL_KNOWN_URL}") + private String wellKnownUrl; } diff --git a/apps/tenor-search-service/src/main/resources/application-local.yml b/apps/tenor-search-service/src/main/resources/application-local.yml index 84a98a0d1b8..b2b920c414c 100644 --- a/apps/tenor-search-service/src/main/resources/application-local.yml +++ b/apps/tenor-search-service/src/main/resources/application-local.yml @@ -1,8 +1,6 @@ -ACCEPTED_AUDIENCE: dev-gcp:dolly:testnav-tenor-search-service - -TOKENDINGS_URL: dummy +TOKEN_X_ISSUER: dummy MASKINPORTEN_CLIENT_ID: dummy MASKINPORTEN_CLIENT_JWK: dummy -MASKINPORTEN_SCOPES: dummy +MASKINPORTEN_TENOR_SCOPE: dummy MASKINPORTEN_WELL_KNOWN_URL: dummy \ No newline at end of file diff --git a/apps/tenor-search-service/src/main/resources/application.yml b/apps/tenor-search-service/src/main/resources/application.yml index bf7696d1629..55fe126c531 100644 --- a/apps/tenor-search-service/src/main/resources/application.yml +++ b/apps/tenor-search-service/src/main/resources/application.yml @@ -12,9 +12,9 @@ spring: jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} tokenx: - issuer-uri: ${TOKENDINGS_URL} - jwk-set-uri: ${TOKENDINGS_URL}/jwks - accepted-audience: ${ACCEPTED_AUDIENCE} + issuer-uri: ${TOKEN_X_ISSUER} + jwk-set-uri: ${TOKEN_X_JWKS_URI} + accepted-audience: ${TOKEN_X_CLIENT_ID} jackson: serialization: write_dates_as_timestamps: false diff --git a/apps/tenor-search-service/src/test/resources/application-test.yml b/apps/tenor-search-service/src/test/resources/application-test.yml index c4d97b0be16..c1a3efae423 100644 --- a/apps/tenor-search-service/src/test/resources/application-test.yml +++ b/apps/tenor-search-service/src/test/resources/application-test.yml @@ -1,5 +1,5 @@ -TOKENDINGS_URL: dummy +TOKEN_X_ISSUER: dummy MASKINPORTEN_CLIENT_ID: dummy MASKINPORTEN_CLIENT_JWK: dummy -MASKINPORTEN_SCOPES: dummy +MASKINPORTEN_TENOR_SCOPE: dummy MASKINPORTEN_WELL_KNOWN_URL: dummy \ No newline at end of file