diff --git a/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/config/Consumers.java b/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/config/Consumers.java new file mode 100644 index 00000000000..b684a79e257 --- /dev/null +++ b/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.adresseservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties pdlServices; + +} diff --git a/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/config/credentials/PdlServiceProperties.java b/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/config/credentials/PdlServiceProperties.java deleted file mode 100644 index f27e2494679..00000000000 --- a/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/config/credentials/PdlServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.adresseservice.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-services") -public class PdlServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/consumer/PdlAdresseConsumer.java b/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/consumer/PdlAdresseConsumer.java index 49931250099..c70e707f816 100644 --- a/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/consumer/PdlAdresseConsumer.java +++ b/apps/adresse-service/src/main/java/no/nav/testnav/apps/adresseservice/consumer/PdlAdresseConsumer.java @@ -1,6 +1,6 @@ package no.nav.testnav.apps.adresseservice.consumer; -import no.nav.testnav.apps.adresseservice.config.credentials.PdlServiceProperties; +import no.nav.testnav.apps.adresseservice.config.Consumers; import no.nav.testnav.apps.adresseservice.consumer.command.PdlAdresseSoekCommand; import no.nav.testnav.apps.adresseservice.dto.GraphQLRequest; import no.nav.testnav.apps.adresseservice.dto.PdlAdresseResponse; @@ -13,19 +13,21 @@ public class PdlAdresseConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; - public PdlAdresseConsumer(TokenExchange tokenExchange, PdlServiceProperties properties) { + public PdlAdresseConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getPdlServices(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public PdlAdresseResponse sendAdressesoek(GraphQLRequest adresseQuery) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(token -> new PdlAdresseSoekCommand(webClient, adresseQuery, token.getTokenValue()).call()) .block(); } diff --git a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/config/Consumers.java b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/config/Consumers.java new file mode 100644 index 00000000000..90798e40fb2 --- /dev/null +++ b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnav.ameldingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties oppsummeringsdokumentService; + +} diff --git a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/consumer/OppsummeringsdokumentConsumer.java b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/consumer/OppsummeringsdokumentConsumer.java index e3ef3513084..f3c83c07043 100644 --- a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/consumer/OppsummeringsdokumentConsumer.java +++ b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/consumer/OppsummeringsdokumentConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.testnav.ameldingservice.consumer; import com.fasterxml.jackson.databind.ObjectMapper; -import no.nav.registre.testnav.ameldingservice.credentials.OppsummeringsdokumentServerProperties; +import no.nav.registre.testnav.ameldingservice.config.Consumers; import no.nav.testnav.libs.commands.GetOppsummeringsdokumentByIdCommand; import no.nav.testnav.libs.commands.GetOppsummeringsdokumentCommand; import no.nav.testnav.libs.commands.SaveOppsummeringsdokumenterCommand; @@ -25,23 +25,25 @@ public class OppsummeringsdokumentConsumer { private final ApplicationProperties applicationProperties; public OppsummeringsdokumentConsumer( - OppsummeringsdokumentServerProperties properties, + Consumers consumers, ObjectMapper objectMapper, ApplicationProperties applicationProperties) { - this.applicationProperties = applicationProperties; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) - .codecs(clientDefaultCodecsConfigurer -> { - clientDefaultCodecsConfigurer.defaultCodecs().maxInMemorySize(BYTE_COUNT); - clientDefaultCodecsConfigurer - .defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - clientDefaultCodecsConfigurer - .defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) + .baseUrl(consumers.getOppsummeringsdokumentService().getUrl()) + .codecs( + clientDefaultCodecsConfigurer -> { + clientDefaultCodecsConfigurer + .defaultCodecs() + .maxInMemorySize(BYTE_COUNT); + clientDefaultCodecsConfigurer + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + clientDefaultCodecsConfigurer + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) .build(); } diff --git a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/credentials/OppsummeringsdokumentServerProperties.java b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/credentials/OppsummeringsdokumentServerProperties.java deleted file mode 100644 index 4f4d3426e6b..00000000000 --- a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/credentials/OppsummeringsdokumentServerProperties.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.registre.testnav.ameldingservice.credentials; - -import lombok.Getter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.oppsummeringsdokument-service") -public class OppsummeringsdokumentServerProperties extends ServerProperties { -} diff --git a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/service/AMeldingService.java b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/service/AMeldingService.java index 2873263cd77..117a241c0fe 100644 --- a/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/service/AMeldingService.java +++ b/apps/amelding-service/src/main/java/no/nav/registre/testnav/ameldingservice/service/AMeldingService.java @@ -1,8 +1,8 @@ package no.nav.registre.testnav.ameldingservice.service; import lombok.RequiredArgsConstructor; +import no.nav.registre.testnav.ameldingservice.config.Consumers; import no.nav.registre.testnav.ameldingservice.consumer.OppsummeringsdokumentConsumer; -import no.nav.registre.testnav.ameldingservice.credentials.OppsummeringsdokumentServerProperties; import no.nav.registre.testnav.ameldingservice.domain.AMelding; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; import no.nav.testnav.libs.securitycore.domain.AccessToken; @@ -13,11 +13,11 @@ @RequiredArgsConstructor public class AMeldingService { private final OppsummeringsdokumentConsumer oppsummeringsdokumentConsumer; - private final OppsummeringsdokumentServerProperties applicationProperties; + private final Consumers consumers; private final TokenExchange tokenExchange; public Mono save(AMelding aMelding, String miljo) { - return tokenExchange.exchange(applicationProperties).flatMap(accessToken -> oppsummeringsdokumentConsumer + return tokenExchange.exchange(consumers.getOppsummeringsdokumentService()).flatMap(accessToken -> oppsummeringsdokumentConsumer .get( aMelding.getOpplysningspliktigOrganisajonsnummer(), aMelding.getKalendermaaned(), @@ -29,7 +29,7 @@ public Mono save(AMelding aMelding, String miljo) { } public Mono get(String id) { - Mono accessToken = tokenExchange.exchange(applicationProperties).map(AccessToken::getTokenValue); + Mono accessToken = tokenExchange.exchange(consumers.getOppsummeringsdokumentService()).map(AccessToken::getTokenValue); return oppsummeringsdokumentConsumer.get(id, accessToken).map(AMelding::new); } } diff --git a/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/config/Consumers.java b/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/config/Consumers.java new file mode 100644 index 00000000000..38f7ef3b5f9 --- /dev/null +++ b/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.arbeidsforholdservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavAaregProxy; + +} diff --git a/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/config/credentials/AaregServiceProperties.java b/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/config/credentials/AaregServiceProperties.java deleted file mode 100644 index 6d75d467b89..00000000000 --- a/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/config/credentials/AaregServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.testnorge.arbeidsforholdservice.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-aareg-proxy") -public class AaregServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/consumer/AaregConsumer.java b/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/consumer/AaregConsumer.java index 9e44ddd8680..a148b946e8e 100644 --- a/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/consumer/AaregConsumer.java +++ b/apps/arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/arbeidsforholdservice/consumer/AaregConsumer.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.arbeidsforholdservice.config.credentials.AaregServiceProperties; +import no.nav.registre.testnorge.arbeidsforholdservice.config.Consumers; import no.nav.registre.testnorge.arbeidsforholdservice.consumer.command.GetArbeidstakerArbeidsforholdCommand; import no.nav.registre.testnorge.arbeidsforholdservice.consumer.dto.ArbeidsforholdDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -30,21 +30,23 @@ public class AaregConsumer { private final TokenExchange tokenExchange; public AaregConsumer( - AaregServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange, ObjectMapper objectMapper) { - - this.serverProperties = serverProperties; + serverProperties = consumers.getTestnavAaregProxy(); this.tokenExchange = tokenExchange; - - ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }).build(); - + ExchangeStrategies jacksonStrategy = ExchangeStrategies + .builder() + .codecs( + config -> { + config + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + config + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) + .build(); this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) diff --git a/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/config/Consumers.java b/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/config/Consumers.java new file mode 100644 index 00000000000..f6a07c0ea2d --- /dev/null +++ b/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.batchbestillingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties dollyBackend; + +} diff --git a/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/consumer/DollyBackendConsumer.java b/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/consumer/DollyBackendConsumer.java index 5dd3f928c2d..bc542df61cf 100644 --- a/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/consumer/DollyBackendConsumer.java +++ b/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/consumer/DollyBackendConsumer.java @@ -3,7 +3,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.registre.testnorge.batchbestillingservice.command.GetAktiveBestillingerCommand; import no.nav.registre.testnorge.batchbestillingservice.command.PostBestillingCommand; -import no.nav.registre.testnorge.batchbestillingservice.credentials.DollyBackendServiceProperties; +import no.nav.registre.testnorge.batchbestillingservice.config.Consumers; import no.nav.registre.testnorge.batchbestillingservice.request.RsDollyBestillingRequest; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -21,18 +21,17 @@ public class DollyBackendConsumer { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public DollyBackendConsumer( - DollyBackendServiceProperties properties, + Consumers consumers, TokenExchange tokenService, WebClient.Builder webClientBuilder ) { - - this.serviceProperties = properties; + serverProperties = consumers.getDollyBackend(); this.tokenService = tokenService; this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -41,7 +40,7 @@ public void postDollyBestilling(Long gruppeId, RsDollyBestillingRequest request, request.setAntall(antall.intValue()); tokenService - .exchange(serviceProperties) + .exchange(serverProperties) .map(token -> new PostBestillingCommand(webClient, token.getTokenValue(), gruppeId, request).call()) .doOnError(error -> log.error("Bestilling feilet for gruppe {}", gruppeId, error)) .doOnSuccess(response -> log.info("Bestilling med {} identer startet i backend for gruppe {}", antall, gruppeId)) @@ -53,7 +52,7 @@ public List getAktiveBestillinger(Long gruppeId) { return Optional .ofNullable( tokenService - .exchange(serviceProperties) + .exchange(serverProperties) .map(token -> new GetAktiveBestillingerCommand(webClient, token.getTokenValue(), gruppeId).call()) .doOnError(error -> log.error("Henting av aktive bestillinger feilet for gruppe {}", gruppeId, error)) .onErrorReturn(Flux.empty()) diff --git a/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/credentials/DollyBackendServiceProperties.java b/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/credentials/DollyBackendServiceProperties.java deleted file mode 100644 index caa8d3294bf..00000000000 --- a/apps/batch-bestilling-service/src/main/java/no/nav/registre/testnorge/batchbestillingservice/credentials/DollyBackendServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.testnorge.batchbestillingservice.credentials; - - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.dolly-backend") -public class DollyBackendServiceProperties extends ServerProperties { -} diff --git a/apps/brreg-stub/config.yml b/apps/brreg-stub/config.yml index 2cb8c377cc5..e2a1d8ff6aa 100644 --- a/apps/brreg-stub/config.yml +++ b/apps/brreg-stub/config.yml @@ -30,5 +30,4 @@ spec: cpu: 200m memory: 1024Mi ingresses: - - "https://brreg-stub.dev-fss.nais.io" - "https://brreg-stub.intern.dev.nav.no" # dev-fss diff --git a/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/config/Consumers.java b/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/config/Consumers.java new file mode 100644 index 00000000000..51662bd8e36 --- /dev/null +++ b/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.brukerservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavPersonOrganisasjonTilgangService; + +} diff --git a/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/PersonOrganisasjonTilgangConsumer.java b/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/PersonOrganisasjonTilgangConsumer.java index 15754020f6f..e48fb284892 100644 --- a/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/PersonOrganisasjonTilgangConsumer.java +++ b/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/PersonOrganisasjonTilgangConsumer.java @@ -1,15 +1,15 @@ package no.nav.testnav.apps.brukerservice.consumer; import com.fasterxml.jackson.databind.ObjectMapper; +import no.nav.testnav.apps.brukerservice.config.Consumers; import no.nav.testnav.apps.brukerservice.consumer.command.GetOrganisasjonCommand; -import no.nav.testnav.apps.brukerservice.consumer.credentials.PersonOrganisasjonTilgangServiceProperties; import no.nav.testnav.apps.brukerservice.domain.Organisasjon; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.http.codec.json.Jackson2JsonEncoder; import org.springframework.stereotype.Component; - import org.springframework.web.reactive.function.client.ExchangeStrategies; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; @@ -17,34 +17,34 @@ @Component public class PersonOrganisasjonTilgangConsumer { private final WebClient webClient; - private final PersonOrganisasjonTilgangServiceProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public PersonOrganisasjonTilgangConsumer( - PersonOrganisasjonTilgangServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange, ObjectMapper objectMapper) { - - this.properties = properties; + serverProperties = consumers.getTestnavPersonOrganisasjonTilgangService(); this.tokenExchange = tokenExchange; - ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) + ExchangeStrategies jacksonStrategy = ExchangeStrategies + .builder() + .codecs( + config -> { + config.defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + config.defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) .build(); - this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Mono getOrganisasjon(String orgnummer) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetOrganisasjonCommand(webClient, orgnummer, accessToken.getTokenValue()).call()) .map(Organisasjon::new); } diff --git a/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/credentials/PersonOrganisasjonTilgangServiceProperties.java b/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/credentials/PersonOrganisasjonTilgangServiceProperties.java deleted file mode 100644 index 982f85fec93..00000000000 --- a/apps/bruker-service/src/main/java/no/nav/testnav/apps/brukerservice/consumer/credentials/PersonOrganisasjonTilgangServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.brukerservice.consumer.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-organisasjon-tilgang-service") -public class PersonOrganisasjonTilgangServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/budpro-service/src/main/java/no/nav/dolly/budpro/Consumers.java b/apps/budpro-service/src/main/java/no/nav/dolly/budpro/Consumers.java new file mode 100644 index 00000000000..92e2d8851bf --- /dev/null +++ b/apps/budpro-service/src/main/java/no/nav/dolly/budpro/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.dolly.budpro; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties genererNavnService; + +} diff --git a/apps/budpro-service/src/main/java/no/nav/dolly/budpro/navn/GeneratedNameService.java b/apps/budpro-service/src/main/java/no/nav/dolly/budpro/navn/GeneratedNameService.java index d318c452625..686b4bc56de 100644 --- a/apps/budpro-service/src/main/java/no/nav/dolly/budpro/navn/GeneratedNameService.java +++ b/apps/budpro-service/src/main/java/no/nav/dolly/budpro/navn/GeneratedNameService.java @@ -1,11 +1,10 @@ package no.nav.dolly.budpro.navn; +import no.nav.dolly.budpro.Consumers; import no.nav.testnav.libs.commands.generernavnservice.v1.GenererNavnCommand; import no.nav.testnav.libs.reactivecore.config.WebClientConfig; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; @@ -16,23 +15,27 @@ @Import(WebClientConfig.class) public class GeneratedNameService { - private final GenererNavnServiceProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; private final WebClient webClient; - GeneratedNameService(GenererNavnServiceProperties properties, TokenExchange tokenExchange, WebClient.Builder webClientBuilder) { - this.properties = properties; + GeneratedNameService( + Consumers consumers, + TokenExchange tokenExchange, + WebClient.Builder webClientBuilder + ) { + serverProperties = consumers.getGenererNavnService(); this.tokenExchange = tokenExchange; this.webClient = webClientBuilder - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public String[] getNames(Long seed, int number) { var accessToken = tokenExchange - .exchange(properties) + .exchange(serverProperties) .blockOptional() - .orElseThrow(() -> new IllegalStateException("Failed to get token for %s".formatted(properties.getName()))) + .orElseThrow(() -> new IllegalStateException("Failed to get token for %s".formatted(serverProperties.getName()))) .getTokenValue(); var arrayOfDTOs = new GenererNavnCommand(webClient, accessToken, seed, number) .call(); @@ -43,10 +46,4 @@ public String[] getNames(Long seed, int number) { .toArray(new String[0]); } - @Configuration - @ConfigurationProperties(prefix = "consumers.generer-navn-service") - public static class GenererNavnServiceProperties extends ServerProperties { - - } - } diff --git a/apps/dolly-backend/build.gradle b/apps/dolly-backend/build.gradle index 517c46cbec2..2d6faaa0b92 100644 --- a/apps/dolly-backend/build.gradle +++ b/apps/dolly-backend/build.gradle @@ -121,7 +121,7 @@ dependencies { implementation 'net.java.dev.jna:jna:5.13.0' - implementation 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java index e488d1b8c77..f2e6b1f811a 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java @@ -7,7 +7,7 @@ import no.nav.dolly.bestilling.aareg.command.ArbeidsforholdPostCommand; import no.nav.dolly.bestilling.aareg.command.ArbeidsforholdPutCommand; import no.nav.dolly.bestilling.aareg.domain.ArbeidsforholdRespons; -import no.nav.dolly.config.credentials.AaregProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; import no.nav.testnav.libs.securitycore.domain.AccessToken; @@ -30,16 +30,16 @@ public class AaregConsumer implements ConsumerStatus { private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenService; public AaregConsumer( - AaregProxyProperties serverProperties, + Consumers consumers, TokenExchange tokenService, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavAaregProxy(); this.tokenService = tokenService; this.webClient = webClientBuilder .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -55,7 +55,7 @@ public AaregConsumer( public Mono getAccessToken() { - return tokenService.exchange(serviceProperties); + return tokenService.exchange(serverProperties); } @Timed(name = "providers", tags = {"operation", "aareg_opprettArbeidforhold"}) @@ -81,7 +81,7 @@ public Mono hentArbeidsforhold(String ident, String miljo @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/AmeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/AmeldingConsumer.java index efd48a4079e..a8d31da2544 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/AmeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/AmeldingConsumer.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.aareg.command.AmeldingPutCommand; -import no.nav.dolly.config.credentials.AmeldingServiceProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.errorhandling.ErrorStatusDecoder; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.dto.ameldingservice.v1.AMeldingDTO; @@ -32,20 +32,20 @@ public class AmeldingConsumer { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final ErrorStatusDecoder errorStatusDecoder; public AmeldingConsumer( TokenExchange tokenService, - AmeldingServiceProperties serviceProperties, + Consumers consumers, ObjectMapper objectMapper, ErrorStatusDecoder errorStatusDecoder, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavAmeldingService(); this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) .build(); this.errorStatusDecoder = errorStatusDecoder; @@ -54,7 +54,7 @@ public AmeldingConsumer( @Timed(name = "providers", tags = { "operation", "amelding_put" }) public Flux sendAmeldinger(List ameldinger, String miljoe) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.fromIterable(ameldinger) .flatMap(amelding -> { if (NOT_FOUND.equals(amelding.getOpplysningspliktigOrganisajonsnummer())) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/OrganisasjonServiceConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/OrganisasjonServiceConsumer.java index 166d1f4da46..4bc4933c4bb 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/OrganisasjonServiceConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/amelding/OrganisasjonServiceConsumer.java @@ -1,7 +1,7 @@ package no.nav.dolly.bestilling.aareg.amelding; import no.nav.dolly.bestilling.aareg.command.OrganisasjonGetCommand; -import no.nav.dolly.config.credentials.OrganisasjonServiceProperties; +import no.nav.dolly.config.Consumers; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -16,23 +16,23 @@ public class OrganisasjonServiceConsumer { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public OrganisasjonServiceConsumer( TokenExchange tokenService, - OrganisasjonServiceProperties serviceProperties, + Consumers consumers, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrganisasjonService(); this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Flux getOrganisasjoner(Set orgnummerListe, String miljo) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.fromIterable(orgnummerListe) .flatMap(orgnummer -> new OrganisasjonGetCommand(webClient, orgnummer, miljo, token.getTokenValue()).call())); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java index faf38ab8744..6ddb587a1d1 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java @@ -10,7 +10,7 @@ import no.nav.dolly.bestilling.arbeidsplassencv.command.ArbeidsplassenPutCVCommand; import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; import no.nav.dolly.bestilling.arbeidsplassencv.dto.PAMCVDTO; -import no.nav.dolly.config.credentials.ArbeidsplassenProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.AccessToken; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -30,16 +30,16 @@ public class ArbeidsplassenCVConsumer implements ConsumerStatus { public static final String ARBEIDSPLASSEN_CALL_ID = "Nav-CallId"; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenService; public ArbeidsplassenCVConsumer( - ArbeidsplassenProxyProperties serverProperties, + Consumers consumers, TokenExchange tokenService, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavArbeidsplassenCVProxy(); this.tokenService = tokenService; this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) @@ -50,7 +50,7 @@ public ArbeidsplassenCVConsumer( @Timed(name = "providers", tags = { "operation", "arbeidsplassen_oppdaterCV" }) public Flux oppdaterCV(String ident, PAMCVDTO arbeidsplassenCV, String uuid) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArbeidsplassenPutCVCommand(webClient, ident, arbeidsplassenCV, uuid, token.getTokenValue()).call()) .doOnNext(resultat -> log.info("Oppdatert CV for ident {} {}", ident, resultat)); } @@ -58,7 +58,7 @@ public Flux oppdaterCV(String ident, PAMCVDTO arbeids @Timed(name = "providers", tags = { "operation", "arbeidsplassen_godtaVilkaar" }) public Flux godtaVilkaar(String ident, String uuid) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArbeidsplassenGodtaVilkaarCommand(webClient, ident, uuid, token.getTokenValue()).call()) .doOnNext(resultat -> log.info("Opprettet vilkaar for ident {} {}", ident, resultat)); } @@ -66,7 +66,7 @@ public Flux godtaVilkaar(String ident, String uuid) { @Timed(name = "providers", tags = { "operation", "arbeidsplassen_godtaHjemmel" }) public Flux godtaHjemmel(String ident, String uuid) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArbeidsplassenGodtaHjemmelCommand(webClient, ident, uuid, token.getTokenValue()).call()) .doOnNext(resultat -> log.info("Opprettet hjemmel for ident {} {}", ident, resultat)); } @@ -74,19 +74,19 @@ public Flux godtaHjemmel(String ident, String uuid) { @Timed(name = "providers", tags = { "operation", "arbeidsplassen_opprettPerson" }) public Flux opprettPerson(String ident, String uuid) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArbeidsplassenPostPersonCommand(webClient, ident, uuid, token.getTokenValue()).call()) .doOnNext(resultat -> log.info("Opprettet person for ident {} {}", ident, resultat)); } public Mono getToken() { - return tokenService.exchange(serviceProperties); + return tokenService.exchange(serverProperties); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override @@ -96,7 +96,7 @@ public String consumerName() { public Flux deleteCVer(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.fromIterable(identer) .flatMap(ident -> new ArbeidsplassenDeleteCVCommand(webClient, ident, token.getTokenValue()).call())); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumer.java index 40f8ec7e1d1..1201d06f2da 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumer.java @@ -16,7 +16,7 @@ import no.nav.dolly.bestilling.arenaforvalter.dto.AapResponse; import no.nav.dolly.bestilling.arenaforvalter.dto.ArenaResponse; import no.nav.dolly.bestilling.arenaforvalter.dto.ArenaStatusResponse; -import no.nav.dolly.config.credentials.ArenaforvalterProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaDagpenger; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyeBrukere; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyeBrukereResponse; @@ -40,16 +40,16 @@ public class ArenaForvalterConsumer implements ConsumerStatus { private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenService; public ArenaForvalterConsumer( - ArenaforvalterProxyProperties serverProperties, + Consumers consumers, TokenExchange tokenService, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavArenaForvalterenProxy(); this.tokenService = tokenService; this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) @@ -60,7 +60,7 @@ public ArenaForvalterConsumer( @Timed(name = "providers", tags = {"operation", "arena_deleteIdent"}) public Flux deleteIdenter(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArenaForvalterGetMiljoeCommand(webClient, token.getTokenValue()).call() .flatMap(miljoe -> Flux.fromIterable(identer) .delayElements(Duration.ofMillis(100)) @@ -71,7 +71,7 @@ public Flux deleteIdenter(List identer) { @Timed(name = "providers", tags = {"operation", "arena_deleteIdent"}) public Mono inaktiverBruker(String ident, LocalDate stansdato, String miljoe) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new ArenaForvalterDeleteCommand(webClient, ident, stansdato, miljoe, token.getTokenValue()).call() .doOnNext(response -> log.info("Inaktivert bruker {} mot Arenaforvalter {}", ident, response))); } @@ -80,7 +80,7 @@ public Mono inaktiverBruker(String ident, LocalDate stansdato, St public Flux postArenaBruker(ArenaNyeBrukere arenaNyeBrukere) { log.info("Arena opprett bruker {}", arenaNyeBrukere); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArenaforvalterPostArenaBruker(webClient, arenaNyeBrukere, token.getTokenValue()).call() .doOnNext(response -> log.info("Opprettet bruker {} mot Arenaforvalter {}", arenaNyeBrukere.getNyeBrukere().get(0).getPersonident(), response))); @@ -90,7 +90,7 @@ public Flux postArenaBruker(ArenaNyeBrukere arenaNyeBru public Flux postAap(AapRequest aapRequest) { log.info("Arena opprett Aap {}", aapRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArenaforvalterPostAap(webClient, aapRequest, token.getTokenValue()).call() .doOnNext(response -> log.info("Opprettet aap {} mot Arenaforvalter {}", aapRequest.getPersonident(), response))); @@ -100,7 +100,7 @@ public Flux postAap(AapRequest aapRequest) { public Flux postAap115(Aap115Request aap115Request) { log.info("Arena opprett Aap115 {}", aap115Request); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArenaforvalterPostAap115(webClient, aap115Request, token.getTokenValue()).call() .doOnNext(response -> log.info("Opprettet aap115 {} mot Arenaforvalter {}", aap115Request.getPersonident(), response))); @@ -110,7 +110,7 @@ public Flux postAap115(Aap115Request aap115Request) { public Flux postArenaDagpenger(ArenaDagpenger arenaDagpenger) { log.info("Opprett dagpenger mot Arenaforvalter {}", arenaDagpenger); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArenaforvalterPostArenadagpenger(webClient, arenaDagpenger, token.getTokenValue()).call() .doOnNext(response -> log.info("Opprettet dagpenger for {} mot Arenaforvalter {}", arenaDagpenger.getPersonident(), response))); @@ -119,21 +119,21 @@ public Flux postArenaDagpenger(ArenaDagpenger arenaDa @Timed(name = "providers", tags = {"operation", "arena_getEnvironments"}) public Flux getEnvironments() { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new ArenaForvalterGetMiljoeCommand(webClient, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "arena_getEnvironments"}) public Mono getArenaBruker(String ident, String miljoe) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new ArenaGetCommand(webClient, ident, miljoe, token.getTokenValue()).call()) .doOnNext(response -> log.info("Hentet bruker {} fra Arena miljoe {} {}", ident, miljoe, response)); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/BrregstubConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/BrregstubConsumer.java index a284d4e69a6..cdacbf063d0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/BrregstubConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/BrregstubConsumer.java @@ -7,7 +7,7 @@ import no.nav.dolly.bestilling.brregstub.command.BrregGetCommand; import no.nav.dolly.bestilling.brregstub.command.BrregPostCommand; import no.nav.dolly.bestilling.brregstub.domain.RolleoversiktTo; -import no.nav.dolly.config.credentials.BrregstubProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Service; @@ -25,16 +25,16 @@ public class BrregstubConsumer implements ConsumerStatus { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public BrregstubConsumer( TokenExchange tokenService, - BrregstubProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavBrregStubProxy(); this.webClient = webClientBuilder .exchangeStrategies(getJacksonStrategy(objectMapper)) .baseUrl(serverProperties.getUrl()) @@ -43,19 +43,19 @@ public BrregstubConsumer( public Mono getRolleoversikt(String ident) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new BrregGetCommand(webClient, ident, token.getTokenValue()).call()); } public Mono postRolleoversikt(RolleoversiktTo rolleoversiktTo) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new BrregPostCommand(webClient, rolleoversiktTo, token.getTokenValue()).call()); } public Mono> deleteRolleoversikt(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .map(idx -> new BrregDeleteCommand(webClient, identer.get(idx), token.getTokenValue()).call()) .flatMap(Flux::from)) @@ -64,7 +64,7 @@ public Mono> deleteRolleoversikt(List identer) { @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/DokarkivConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/DokarkivConsumer.java index 9cf3f957e40..20737d796d7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/DokarkivConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/DokarkivConsumer.java @@ -7,7 +7,7 @@ import no.nav.dolly.bestilling.dokarkiv.command.DokarkivPostCommand; import no.nav.dolly.bestilling.dokarkiv.domain.DokarkivRequest; import no.nav.dolly.bestilling.dokarkiv.domain.DokarkivResponse; -import no.nav.dolly.config.credentials.DokarkivProxyServiceProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -26,17 +26,17 @@ public class DokarkivConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public DokarkivConsumer( - DokarkivProxyServiceProperties properties, + Consumers consumers, TokenExchange tokenService, ObjectMapper objectMapper, WebClient.Builder webClientBuilder) { - this.serviceProperties = properties; + serverProperties = consumers.getTestnavDokarkivProxy(); this.tokenService = tokenService; this.webClient = webClientBuilder - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) .build(); } @@ -47,7 +47,7 @@ public Flux postDokarkiv(String environment, DokarkivRequest d log.info("Sender dokarkiv melding for ident {} miljoe {} request {}", dokarkivRequest.getBruker().getId(), environment, dokarkivRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new DokarkivPostCommand(webClient, environment, dokarkivRequest, token.getTokenValue()).call()); } @@ -55,13 +55,13 @@ public Flux postDokarkiv(String environment, DokarkivRequest d @Timed(name = "providers", tags = { "operation", "dokarkiv_getEnvironments" }) public Mono> getEnvironments() { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new DokarkivGetMiljoeCommand(webClient, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/HistarkConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/HistarkConsumer.java index 56da4699e5b..4620666f522 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/HistarkConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/HistarkConsumer.java @@ -5,7 +5,7 @@ import no.nav.dolly.bestilling.histark.command.HistarkPostCommand; import no.nav.dolly.bestilling.histark.domain.HistarkRequest; import no.nav.dolly.bestilling.histark.domain.HistarkResponse; -import no.nav.dolly.config.credentials.HistarkProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -25,17 +25,17 @@ public class HistarkConsumer { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public HistarkConsumer( - HistarkProxyProperties properties, + Consumers consumers, TokenExchange tokenService, ObjectMapper objectMapper, WebClient.Builder webClientBuilder) { - this.serviceProperties = properties; + serverProperties = consumers.getTestnavHistarkProxy(); this.tokenService = tokenService; this.webClient = webClientBuilder - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) .build(); } @@ -46,7 +46,7 @@ public Flux postHistark(HistarkRequest histarkRequest) { var callId = getNavCallId(); log.info("Sender histark melding: callId: {}, consumerId: {}\n{}", callId, CONSUMER, histarkRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new HistarkPostCommand(webClient, histarkRequest, token.getTokenValue()).call()); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java index 323b6b8c0a2..abd53c9f4b8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/InntektsmeldingConsumer.java @@ -5,7 +5,7 @@ import no.nav.dolly.bestilling.inntektsmelding.command.OpprettInntektsmeldingCommand; import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest; import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingResponse; -import no.nav.dolly.config.credentials.InntektsmeldingServiceProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -24,17 +24,17 @@ public class InntektsmeldingConsumer implements ConsumerStatus { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public InntektsmeldingConsumer( TokenExchange tokenService, - InntektsmeldingServiceProperties serviceProperties, + Consumers consumers, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavInntektsmeldingService(); this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -44,14 +44,14 @@ public Flux postInntektsmelding(InntektsmeldingRequest var callId = getNavCallId(); log.info("Inntektsmelding med callId {} sendt", callId); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new OpprettInntektsmeldingCommand(webClient, token.getTokenValue(), inntekstsmelding, callId).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java index e1ad52933c4..1b0b45c0c32 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java @@ -7,7 +7,7 @@ import no.nav.dolly.bestilling.inntektstub.command.InntektstubGetCommand; import no.nav.dolly.bestilling.inntektstub.command.InntektstubPostCommand; import no.nav.dolly.bestilling.inntektstub.domain.Inntektsinformasjon; -import no.nav.dolly.config.credentials.InntektstubProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -29,16 +29,16 @@ public class InntektstubConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public InntektstubConsumer( TokenExchange tokenService, - InntektstubProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavInntektstubProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -48,14 +48,14 @@ public InntektstubConsumer( @Timed(name = "providers", tags = { "operation", "inntk_getInntekter" }) public Flux getInntekter(String ident) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new InntektstubGetCommand(webClient, ident, token.getTokenValue()).call()); } @Timed(name = "providers", tags = { "operation", "inntk_deleteInntekter" }) public Mono> deleteInntekter(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, (identer.size() / BLOCK_SIZE) + 1) .delayElements(Duration.ofMillis(100)) .map(index -> new InntektstubDeleteCommand(webClient, @@ -70,13 +70,13 @@ public Flux postInntekter(List inntekt log.info("Sender inntektstub: {}", inntektsinformasjon); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new InntektstubPostCommand(webClient, inntektsinformasjon, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/InstdataConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/InstdataConsumer.java index 67835ba93ec..31fed1c2a02 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/InstdataConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/InstdataConsumer.java @@ -10,7 +10,7 @@ import no.nav.dolly.bestilling.instdata.domain.DeleteResponse; import no.nav.dolly.bestilling.instdata.domain.InstdataResponse; import no.nav.dolly.bestilling.instdata.domain.InstitusjonsoppholdRespons; -import no.nav.dolly.config.credentials.InstProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.domain.resultset.inst.Instdata; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -30,16 +30,16 @@ public class InstdataConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public InstdataConsumer( TokenExchange tokenService, - InstProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavInstProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -49,21 +49,21 @@ public InstdataConsumer( @Timed(name = "providers", tags = {"operation", "inst_getMiljoer"}) public Mono> getMiljoer() { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new InstdataGetMiljoerCommand(webClient, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "inst_getInstdata"}) public Mono getInstdata(String ident, String environment) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new InstdataGetCommand(webClient, ident, environment, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "inst_deleteInstdata"}) public Mono> deleteInstdata(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new InstdataGetMiljoerCommand(webClient, token.getTokenValue()).call() .flatMap(miljoer -> Flux.fromIterable(identer) .flatMap(ident -> new InstdataDeleteCommand(webClient, @@ -75,7 +75,7 @@ public Mono> deleteInstdata(List identer) { public Flux postInstdata(List instdata, String environment) { log.info("Instdata opprett til {}: {}", environment, instdata); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.fromIterable(instdata) .flatMap(opphold -> new InstdataPostCommand(webClient, opphold, environment, token.getTokenValue()).call())); @@ -83,7 +83,7 @@ public Flux postInstdata(List instdata, String envir @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java index 27c2d50b2a0..f26212ace0f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java @@ -6,7 +6,7 @@ import no.nav.dolly.bestilling.kontoregisterservice.command.KontoregisterDeleteCommand; import no.nav.dolly.bestilling.kontoregisterservice.command.KontoregisterGetCommand; import no.nav.dolly.bestilling.kontoregisterservice.command.KontoregisterPostCommand; -import no.nav.dolly.config.credentials.KontoregisterConsumerProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.data.kontoregister.v1.HentKontoRequestDTO; import no.nav.testnav.libs.data.kontoregister.v1.HentKontoResponseDTO; @@ -34,16 +34,16 @@ public class KontoregisterConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public KontoregisterConsumer( TokenExchange tokenService, - KontoregisterConsumerProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavKontoregisterPersonProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -60,7 +60,7 @@ public KontoregisterConsumer( public Mono opprettKontonummer(OppdaterKontoRequestDTO bankdetaljer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new KontoregisterPostCommand(webClient, bankdetaljer, token.getTokenValue()).call()) .doOnNext(response -> log.info("Opprettet kontonummer for ident {} {}", bankdetaljer.getKontohaver(), response)); } @@ -68,7 +68,7 @@ public Mono opprettKontonummer(OppdaterKontoRequestDTO @Timed(name = "providers", tags = {"operation", "kontoregister_hentKonto"}) public Mono getKontonummer(String ident) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new KontoregisterGetCommand(webClient, HentKontoRequestDTO.builder() .kontohaver(ident) @@ -80,7 +80,7 @@ public Mono getKontonummer(String ident) { @Timed(name = "providers", tags = {"operation", "kontoregister_slettKonto"}) public Flux deleteKontonumre(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .delayElements(Duration.ofMillis(10)) .flatMap(index -> new KontoregisterDeleteCommand( @@ -90,7 +90,7 @@ public Flux deleteKontonumre(List identer) { @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumer.java index 4965a677194..129cadb5e27 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumer.java @@ -6,7 +6,7 @@ import no.nav.dolly.bestilling.krrstub.command.KontaktadataDeleteCommand; import no.nav.dolly.bestilling.krrstub.command.KontaktdataPostCommand; import no.nav.dolly.bestilling.krrstub.dto.DigitalKontaktdataResponse; -import no.nav.dolly.config.credentials.KrrstubProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.domain.resultset.krrstub.DigitalKontaktdata; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -27,16 +27,16 @@ public class KrrstubConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public KrrstubConsumer( TokenExchange tokenService, - KrrstubProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavKrrstubProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -47,14 +47,14 @@ public KrrstubConsumer( public Mono createDigitalKontaktdata(DigitalKontaktdata digitalKontaktdata) { log.info("Kontaktdata opprett {}", digitalKontaktdata); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new KontaktdataPostCommand(webClient, digitalKontaktdata, token.getTokenValue()).call()); } @Timed(name = "providers", tags = { "operation", "krrstub_getKontaktdata" }) public Flux deleteKontaktdata(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .delayElements(Duration.ofMillis(100)) .flatMap(idx -> new KontaktadataDeleteCommand(webClient, identer.get(idx), @@ -63,13 +63,13 @@ public Flux deleteKontaktdata(List identer) public Mono deleteKontaktdataPerson(String ident) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new KontaktadataDeleteCommand(webClient, ident, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/MedlConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/MedlConsumer.java index 5f39b8cde8c..a5c764510f3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/MedlConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/MedlConsumer.java @@ -7,7 +7,7 @@ import no.nav.dolly.bestilling.medl.command.MedlPostCommand; import no.nav.dolly.bestilling.medl.command.MedlPutCommand; import no.nav.dolly.bestilling.medl.dto.MedlPostResponse; -import no.nav.dolly.config.credentials.MedlProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.domain.resultset.medl.MedlData; import no.nav.dolly.domain.resultset.medl.MedlDataResponse; import no.nav.dolly.metrics.Timed; @@ -29,16 +29,16 @@ public class MedlConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public MedlConsumer( TokenExchange tokenService, - MedlProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavMedlProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -49,14 +49,14 @@ public MedlConsumer( public Mono createMedlemskapsperiode(MedlData medlData) { log.info("Medlemskapsperiode opprett {}", medlData); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new MedlPostCommand(webClient, medlData, token.getTokenValue()).call()); } @Timed(name = "providers", tags = { "operation", "medl_deleteMedlemskapsperioder" }) public Flux deleteMedlemskapsperioder(Flux medlDataRequests) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> medlDataRequests.flatMap(medlData -> new MedlPutCommand(webClient, medlData, token.getTokenValue()).call())); @@ -65,7 +65,7 @@ public Flux deleteMedlemskapsperioder(Flux medlDataR @Timed(name = "providers", tags = { "operation", "medl_getMedlemskapsperiode" }) public Flux getMedlemskapsperioder(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.fromIterable(identer) .delayElements(Duration.ofMillis(100)) .flatMap(ident -> new MedlGetCommand(webClient, ident, @@ -74,7 +74,7 @@ public Flux getMedlemskapsperioder(List identer) { @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java index 4c8ba6048fc..f90a98636bf 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java @@ -9,10 +9,11 @@ import no.nav.dolly.bestilling.organisasjonforvalter.domain.DeployResponse; import no.nav.dolly.bestilling.organisasjonforvalter.domain.OrganisasjonDeployStatus; import no.nav.dolly.bestilling.organisasjonforvalter.domain.OrganisasjonDetaljer; -import no.nav.dolly.config.credentials.OrganisasjonForvalterProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @@ -43,18 +44,18 @@ public class OrganisasjonConsumer { private final TokenExchange tokenService; private final WebClient webClient; - private final OrganisasjonForvalterProperties serviceProperties; + private final ServerProperties serverProperties; public OrganisasjonConsumer( TokenExchange tokenService, - OrganisasjonForvalterProperties serviceProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrganisasjonForvalter(); this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) .build(); } @@ -62,7 +63,7 @@ public OrganisasjonConsumer( @Timed(name = "providers", tags = {"operation", "organisasjon-hent"}) public Flux hentOrganisasjon(List orgnumre) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new GetOrganisasjonCommand(webClient, orgnumre, token.getTokenValue()).call()); } @@ -71,7 +72,7 @@ public OrganisasjonDeployStatus hentOrganisasjonStatus(List orgnumre) { var navCallId = getNavCallId(); log.info("Organisasjon hent request sendt, callId: {}, consumerId: {}", navCallId, CONSUMER); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> webClient .get() .uri(uriBuilder -> @@ -94,7 +95,7 @@ public ResponseEntity postOrganisasjon(BestillingRequest bes var navCallId = getNavCallId(); log.info("Organisasjon oppretting sendt, callId: {}, consumerId: {}", navCallId, CONSUMER); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> webClient .post() .uri(uriBuilder -> uriBuilder.path(ORGANISASJON_FORVALTER_URL).build()) @@ -120,7 +121,7 @@ public ResponseEntity deployOrganisasjon(DeployRequest request) private ResponseEntity sendDeployOrganisasjonRequest(DeployRequest deployRequest, String callId) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> webClient .post() .uri(uriBuilder -> uriBuilder.path(ORGANISASJON_DEPLOYMENT_URL).build()) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java index 1590dcd35db..74b20add474 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java @@ -13,13 +13,14 @@ import no.nav.dolly.bestilling.pdldata.command.PdlDataSlettUtenomCommand; import no.nav.dolly.bestilling.pdldata.command.PdlDataStanaloneCommand; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; -import no.nav.dolly.config.credentials.PdlDataForvalterProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.dolly.util.JacksonExchangeStrategyUtil; import no.nav.testnav.libs.data.pdlforvalter.v1.AvailibilityResponseDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.BestillingRequestDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.FullPersonDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.PersonUpdateRequestDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; @@ -40,18 +41,18 @@ public class PdlDataConsumer implements ConsumerStatus { private final TokenExchange tokenService; private final WebClient webClient; - private final PdlDataForvalterProperties serviceProperties; + private final ServerProperties serverProperties; public PdlDataConsumer( TokenExchange tokenService, - PdlDataForvalterProperties serviceProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder) { this.tokenService = tokenService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavPdlForvalter(); this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(JacksonExchangeStrategyUtil.getJacksonStrategy(objectMapper)) .clientConnector(new ReactorClientHttpConnector( HttpClient.create(ConnectionProvider.builder("custom") @@ -66,7 +67,7 @@ public PdlDataConsumer( @Timed(name = "providers", tags = {"operation", "pdl_sendOrdre"}) public Flux sendOrdre(String ident, boolean ekskluderEksternePersoner) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new PdlDataOrdreCommand(webClient, ident, ekskluderEksternePersoner, token.getTokenValue()).call()); } @@ -74,7 +75,7 @@ public Flux sendOrdre(String ident, boolean ekskluderEksternePerson @Timed(name = "providers", tags = {"operation", "pdl_delete"}) public Mono> slettPdl(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .delayElements(Duration.ofMillis(400)) .map(index -> new PdlDataSlettCommand(webClient, identer.get(index), token.getTokenValue()).call()) @@ -85,7 +86,7 @@ public Mono> slettPdl(List identer) { @Timed(name = "providers", tags = {"operation", "pdl_delete_utenom"}) public Mono> slettPdlUtenom(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, (identer.size() / BLOCK_SIZE) + 1) .delayElements(Duration.ofMillis(1000)) .map(count -> new PdlDataSlettUtenomCommand(webClient, @@ -98,14 +99,14 @@ public Mono> slettPdlUtenom(List identer) { @Timed(name = "providers", tags = {"operation", "pdl_opprett"}) public Flux opprettPdl(BestillingRequestDTO request) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new PdlDataOpprettingCommand(webClient, request, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "pdl_oppdater"}) public Flux oppdaterPdl(String ident, PersonUpdateRequestDTO request) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new PdlDataOppdateringCommand(webClient, ident, request, token.getTokenValue()).call()); } @@ -116,7 +117,7 @@ public Flux getPersoner(List identer) { public Flux getPersoner(List identer, Integer sidenummer, Integer sidestoerrelse) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new PdlDataHentCommand(webClient, identer, sidenummer, sidestoerrelse, token.getTokenValue()).call()); } @@ -124,14 +125,14 @@ public Flux getPersoner(List identer, Integer sidenummer, @Timed(name = "providers", tags = {"operation", "pdl_identCheck"}) public Flux identCheck(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new PdlDataCheckIdentCommand(webClient, identer, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "pdl_identer_standalone"}) public Mono putStandalone(String ident, Boolean standalone) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new PdlDataStanaloneCommand(webClient, ident, standalone, token.getTokenValue()) .call()) .doOnNext(response -> log.info("Lagt til ident {} som standalone i PDL-forvalter", ident)); @@ -139,7 +140,7 @@ public Mono putStandalone(String ident, Boolean standalone) { @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java index 18a16dadfc1..6599c88df64 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java @@ -24,7 +24,7 @@ import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonTpYtelseRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonUforetrygdRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.config.credentials.PensjonforvalterProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -48,16 +48,16 @@ public class PensjonforvalterConsumer implements ConsumerStatus { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public PensjonforvalterConsumer( TokenExchange tokenService, - PensjonforvalterProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavPensjonTestdataFacadeProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -74,7 +74,7 @@ public PensjonforvalterConsumer( @Timed(name = "providers", tags = {"operation", "pen_getMiljoer"}) public Mono> getMiljoer() { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new HentMiljoerCommand(webClient, token.getTokenValue()).call()); } @@ -82,7 +82,7 @@ public Mono> getMiljoer() { public Flux lagreInntekter(PensjonPoppInntektRequest pensjonPoppInntektRequest) { log.info("Popp lagre inntekt {}", pensjonPoppInntektRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new LagrePoppInntektCommand(webClient, token.getTokenValue(), pensjonPoppInntektRequest).call()); } @@ -93,14 +93,14 @@ public Flux opprettPerson(PensjonPersonRequest pensjon pensjonPersonRequest.setMiljoer(miljoer); log.info("Pensjon opprett person {}", pensjonPersonRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new OpprettPersonCommand(webClient, pensjonPersonRequest, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "pen_hentSamboer"}) public Flux hentSamboer(String ident, String miljoe) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new HentSamboerCommand(webClient, ident, miljoe, token.getTokenValue()).call()) .doOnNext(response -> log.info("Pensjon samboer for {} i {} hentet {}", ident, miljoe, response)); } @@ -110,7 +110,7 @@ public Flux lagreSamboer(PensjonSamboerRequest pensjon String miljoe) { log.info("Pensjon samboer opprett i {} {}", miljoe, pensjonSamboerRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new LagreSamboerCommand(webClient, pensjonSamboerRequest, miljoe, token.getTokenValue()).call()); } @@ -118,7 +118,7 @@ public Flux lagreSamboer(PensjonSamboerRequest pensjon public Flux annullerSamboer(String ident, String periodeId, String miljoe) { log.info("Pensjon samboer annuller {} periodeId {}", ident, periodeId); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new AnnullerSamboerCommand(webClient, periodeId, miljoe, token.getTokenValue()).call()); } @@ -126,7 +126,7 @@ public Flux annullerSamboer(String ident, String perio public Flux lagreAlderspensjon(AlderspensjonRequest request) { log.info("Pensjon lagre alderspensjon {}", request); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new LagreAlderspensjonCommand(webClient, token.getTokenValue(), request).call()); } @@ -134,7 +134,7 @@ public Flux lagreAlderspensjon(AlderspensjonRequest re public Flux lagreUforetrygd(PensjonUforetrygdRequest request) { log.info("Pensjon lagre uforetrygd {}", request); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new LagreUforetrygdCommand(webClient, token.getTokenValue(), request).call()); } @@ -142,14 +142,14 @@ public Flux lagreUforetrygd(PensjonUforetrygdRequest r public Flux lagreTpForhold(PensjonTpForholdRequest pensjonTpForholdRequest) { log.info("Pensjon lagre TP-forhold {}", pensjonTpForholdRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new LagreTpForholdCommand(webClient, token.getTokenValue(), pensjonTpForholdRequest).call()); } @Timed(name = "providers", tags = {"operation", "pen_sletteTpForhold"}) public void sletteTpForhold(List identer) { - tokenService.exchange(serviceProperties) + tokenService.exchange(serverProperties) .flatMapMany(token -> new HentMiljoerCommand(webClient, token.getTokenValue()).call() .flatMapMany(miljoer -> Flux.range(0, identer.size()) .map(index -> new SletteTpForholdCommand(webClient, identer.get(index), miljoer, token.getTokenValue()).call()))) @@ -162,13 +162,13 @@ public void sletteTpForhold(List identer) { public Flux lagreTpYtelse(PensjonTpYtelseRequest pensjonTpYtelseRequest) { log.info("Pensjon lagre TP-ytelse {}", pensjonTpYtelseRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new LagreTpYtelseCommand(webClient, token.getTokenValue(), pensjonTpYtelseRequest).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java index 7c18caa6b32..5d94a31c6c8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java @@ -5,7 +5,7 @@ import no.nav.dolly.bestilling.personservice.command.PdlPersonerGetCommand; import no.nav.dolly.bestilling.personservice.command.PersonServiceExistCommand; import no.nav.dolly.bestilling.personservice.dto.PersonServiceResponse; -import no.nav.dolly.config.credentials.PersonServiceProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.domain.PdlPersonBolk; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -34,16 +34,16 @@ public class PersonServiceConsumer implements ConsumerStatus { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public PersonServiceConsumer( TokenExchange tokenService, - PersonServiceProperties serverProperties, + Consumers consumers, WebClient.Builder webClientBuilder, ObjectMapper objectMapper) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavPersonService(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -61,7 +61,7 @@ public PersonServiceConsumer( @Timed(name = "providers", tags = {"operation", "personService_isPerson"}) public Mono isPerson(String ident, Set opplysningId) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new PersonServiceExistCommand(webClient, ident, opplysningId, token.getTokenValue()).call()); } @@ -80,7 +80,7 @@ public Flux getPdlPersonerNoRetries(List identer) { @Timed(name = "providers", tags = {"operation", "pdl_getPersoner"}) public Flux getPdlPersoner(List identer, AtomicInteger retry) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size() / BLOCK_SIZE + 1) .flatMap(index -> new PdlPersonerGetCommand(webClient, identer.subList(index * BLOCK_SIZE, Math.min((index + 1) * BLOCK_SIZE, identer.size())), @@ -107,7 +107,7 @@ public Flux getPdlPersoner(List identer, AtomicInteger re @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumer.java index 38fb605a960..e34e7b8a414 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumer.java @@ -9,7 +9,7 @@ import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubLignetInntektRequest; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubPensjonsgivendeInntektRequest; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubResponse; -import no.nav.dolly.config.credentials.SigrunstubProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -31,16 +31,16 @@ public class SigrunStubConsumer implements ConsumerStatus { private static final String SIGRUN_STUB_PENSJONSGIVENDE_INNTEKT_URL = "/api/v1/pensjonsgivendeinntektforfolketrygden"; private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public SigrunStubConsumer( TokenExchange tokenService, - SigrunstubProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavSigrunstubProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -50,7 +50,7 @@ public SigrunStubConsumer( @Timed(name = "providers", tags = {"operation", "sigrun_deleteGrunnlag"}) public Flux deleteLignetInntekt(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .delayElements(Duration.ofMillis(50)) .map(index -> new SigrunstubLignetDeleteCommand(webClient, identer.get(index), token.getTokenValue()).call()) @@ -60,7 +60,7 @@ public Flux deleteLignetInntekt(List identer) { @Timed(name = "providers", tags = {"operation", "sigrun_deleteGrunnlag"}) public Flux deletePensjonsgivendeInntekt(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .delayElements(Duration.ofMillis(50)) .map(index -> new SigrunstubPensjonsgivendeDeleteCommand(webClient, identer.get(index), token.getTokenValue()).call()) @@ -72,7 +72,7 @@ public Mono updateLignetInntekt(List new SigurunstubPutCommand(webClient, SIGRUN_STUB_LIGNET_INNTEKT_URL, request, token.getTokenValue()).call()); } @@ -81,14 +81,14 @@ public Mono updatePensjonsgivendeInntekt(List new SigurunstubPutCommand(webClient, SIGRUN_STUB_PENSJONSGIVENDE_INNTEKT_URL, request, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java index 933d266969a..58c1b30c768 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java @@ -9,7 +9,7 @@ import no.nav.dolly.bestilling.skjermingsregister.command.SkjermingsregisterPutCommand; import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataRequest; import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse; -import no.nav.dolly.config.credentials.SkjermingsregisterProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -30,16 +30,16 @@ public class SkjermingsRegisterConsumer implements ConsumerStatus { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public SkjermingsRegisterConsumer( TokenExchange tokenService, - SkjermingsregisterProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavSkjermingsregisterProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -49,7 +49,7 @@ public SkjermingsRegisterConsumer( @Timed(name = "providers", tags = {"operation", "skjermingsdata-slett"}) public Mono> deleteSkjerming(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .delayElements(Duration.ofMillis(100)) .map(index -> new SkjermingsregisterDeleteCommand(webClient, @@ -61,7 +61,7 @@ public Mono> deleteSkjerming(List identer) { @Timed(name = "providers", tags = {"operation", "skjermingsdata-oppdater"}) public Mono oppdaterPerson(SkjermingDataRequest skjerming) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new SkjermingsregisterGetCommand(webClient, skjerming.getPersonident(), token.getTokenValue()).call() .flatMap(response -> { if (response.isEksistererIkke()) { @@ -90,7 +90,7 @@ public Mono oppdaterPerson(SkjermingDataRequest skjerming @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/Norg2Consumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/Norg2Consumer.java index afb96bcddaa..6df87764cc9 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/Norg2Consumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/Norg2Consumer.java @@ -5,7 +5,7 @@ import no.nav.dolly.bestilling.ConsumerStatus; import no.nav.dolly.bestilling.sykemelding.command.Norg2GetCommand; import no.nav.dolly.bestilling.sykemelding.dto.Norg2EnhetResponse; -import no.nav.dolly.config.credentials.Norg2ProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -21,16 +21,16 @@ public class Norg2Consumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public Norg2Consumer( TokenExchange accessTokenService, - Norg2ProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = accessTokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavNorg2Proxy(); this.webClient = webClientBuilder .exchangeStrategies(getJacksonStrategy(objectMapper)) .baseUrl(serverProperties.getUrl()) @@ -40,14 +40,14 @@ public Norg2Consumer( @Timed(name = "providers", tags = { "operation", "detaljertsykemelding_opprett" }) public Mono getNorgEnhet(String geografiskTilhoerighet) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new Norg2GetCommand(webClient, geografiskTilhoerighet, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SykemeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SykemeldingConsumer.java index 59132acf6fc..40911984e1e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SykemeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SykemeldingConsumer.java @@ -6,7 +6,7 @@ import no.nav.dolly.bestilling.sykemelding.command.SykemeldingPostCommand; import no.nav.dolly.bestilling.sykemelding.domain.DetaljertSykemeldingRequest; import no.nav.dolly.bestilling.sykemelding.dto.SykemeldingResponse; -import no.nav.dolly.config.credentials.SykemeldingApiProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -22,16 +22,16 @@ public class SykemeldingConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public SykemeldingConsumer( TokenExchange accessTokenService, - SykemeldingApiProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = accessTokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavSykemeldingApi(); this.webClient = webClientBuilder .exchangeStrategies(getJacksonStrategy(objectMapper)) .baseUrl(serverProperties.getUrl()) @@ -43,14 +43,14 @@ public Mono postDetaljertSykemelding(DetaljertSykemeldingRe log.info("Detaljert Sykemelding sendt {}", detaljertSykemeldingRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new SykemeldingPostCommand(webClient, detaljertSykemeldingRequest, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java index 20c0fc5db7f..8e8dd8e1f96 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java @@ -6,7 +6,7 @@ import no.nav.dolly.bestilling.sykemelding.command.SyntSykemeldingPostCommand; import no.nav.dolly.bestilling.sykemelding.domain.SyntSykemeldingRequest; import no.nav.dolly.bestilling.sykemelding.dto.SykemeldingResponse; -import no.nav.dolly.config.credentials.SyntSykemeldingApiProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -26,16 +26,16 @@ public class SyntSykemeldingConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public SyntSykemeldingConsumer( TokenExchange accessTokenService, - SyntSykemeldingApiProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = accessTokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavSyntSykemeldingApi(); this.webClient = webClientBuilder .exchangeStrategies(getJacksonStrategy(objectMapper)) .baseUrl(serverProperties.getUrl()) @@ -52,14 +52,14 @@ public SyntSykemeldingConsumer( public Mono postSyntSykemelding(SyntSykemeldingRequest sykemeldingRequest) { log.info("SyntSykemelding sendt {}", sykemeldingRequest); - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(accessToken -> new SyntSykemeldingPostCommand(webClient, sykemeldingRequest, accessToken.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/TagsHendelseslagerConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/TagsHendelseslagerConsumer.java index f7444229bae..460abd68da4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/TagsHendelseslagerConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/TagsHendelseslagerConsumer.java @@ -9,7 +9,7 @@ import no.nav.dolly.bestilling.tagshendelseslager.command.TagsSlettingCommand; import no.nav.dolly.bestilling.tagshendelseslager.dto.HendelselagerResponse; import no.nav.dolly.bestilling.tagshendelseslager.dto.TagsOpprettingResponse; -import no.nav.dolly.config.credentials.PdlProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.domain.resultset.Tags; import no.nav.dolly.metrics.Timed; import no.nav.dolly.util.JacksonExchangeStrategyUtil; @@ -29,18 +29,18 @@ public class TagsHendelseslagerConsumer { private static final int BLOCK_SIZE = 100; private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public TagsHendelseslagerConsumer( TokenExchange tokenService, - PdlProxyProperties serviceProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavPdlProxy(); this.webClient = webClientBuilder - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(JacksonExchangeStrategyUtil.getJacksonStrategy(objectMapper)) .build(); } @@ -48,7 +48,7 @@ public TagsHendelseslagerConsumer( @Timed(name = "providers", tags = {"operation", "tags_create"}) public Mono createTags(List identer, List tags) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new TagsOpprettingCommand(webClient, identer, tags, token.getTokenValue()).call()); } @@ -56,7 +56,7 @@ public Mono createTags(List identer, List @Timed(name = "providers", tags = {"operation", "tags_delete"}) public Flux deleteTags(List identer, List tags) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, (identer.size() / BLOCK_SIZE) + 1) .map(index -> new TagsSlettingCommand(webClient, identer.subList(index * BLOCK_SIZE, Math.min((index + 1) * BLOCK_SIZE, identer.size())), @@ -67,14 +67,14 @@ public Flux deleteTags(List identer, List tags) { @Timed(name = "providers", tags = {"operation", "tags_get"}) public JsonNode getTag(String ident) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new TagsHenteCommand(webClient, ident, token.getTokenValue()).call()).block(); } @Timed(name = "providers", tags = {"operation", "hendelselager_publish"}) public Mono publish(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new HendelseslagerPublishCommand(webClient, identer, token.getTokenValue()).call()); } } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java index 90436789a3a..e6fedcbea1c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java @@ -10,7 +10,7 @@ import no.nav.dolly.bestilling.tpsmessagingservice.command.SikkerhetstiltakDeleteCommand; import no.nav.dolly.bestilling.tpsmessagingservice.command.TelefonnummerDeleteCommand; import no.nav.dolly.bestilling.tpsmessagingservice.command.TpsMessagingPostCommand; -import no.nav.dolly.config.credentials.TpsMessagingServiceProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.data.kontoregister.v1.BankkontonrNorskDTO; import no.nav.testnav.libs.data.kontoregister.v1.BankkontonrUtlandDTO; @@ -47,16 +47,16 @@ public class TpsMessagingConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public TpsMessagingConsumer( TokenExchange tokenService, - TpsMessagingServiceProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavTpsMessagingService(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) @@ -74,7 +74,7 @@ public TpsMessagingConsumer( public Flux sendUtenlandskBankkontoRequest(String ident, List miljoer, BankkontonrUtlandDTO body) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new TpsMessagingPostCommand(webClient, ident, miljoer, body, UTENLANDSK_BANKKONTO_URL, token.getTokenValue()).call()); } @@ -82,7 +82,7 @@ public Flux sendUtenlandskBankkontoRequest(String ident, @Timed(name = "providers", tags = {"operation", "tps_messaging_createNorskBankkonto"}) public Flux sendNorskBankkontoRequest(String ident, List miljoer, BankkontonrNorskDTO body) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new TpsMessagingPostCommand(webClient, ident, miljoer, body, NORSK_BANKKONTO_URL, token.getTokenValue()).call()); } @@ -90,14 +90,14 @@ public Flux sendNorskBankkontoRequest(String ident, List< @Timed(name = "providers", tags = {"operation", "tps_messaging_deleteSikkerhetstiltak"}) public Flux deleteSikkerhetstiltakRequest(String ident, List miljoer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new SikkerhetstiltakDeleteCommand(webClient, ident, miljoer, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "tps_messaging_createSikkerhetstiltak"}) public Flux sendSikkerhetstiltakRequest(String ident, List miljoer, Object body) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new TpsMessagingPostCommand(webClient, ident, miljoer, body, SIKKERHETSTILTAK_URL, token.getTokenValue()).call()); } @@ -105,7 +105,7 @@ public Flux sendSikkerhetstiltakRequest(String ident, Lis @Timed(name = "providers", tags = {"operation", "tps_messaging_createSkjerming"}) public Flux sendEgenansattRequest(String ident, List miljoer, LocalDate fraOgMed) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new EgenansattPostCommand(webClient, ident, miljoer, fraOgMed, token.getTokenValue()).call()); } @@ -113,14 +113,14 @@ public Flux sendEgenansattRequest(String ident, List deleteEgenansattRequest(String ident, List miljoer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new EgenansattDeleteCommand(webClient, ident, miljoer, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "tps_messaging_createTelefonnummer"}) public Flux sendTelefonnummerRequest(String ident, List miljoer, Object body) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new TpsMessagingPostCommand(webClient, ident, miljoer, body, TELEFONNUMMER_URL, token.getTokenValue()).call()); } @@ -128,7 +128,7 @@ public Flux sendTelefonnummerRequest(String ident, List deleteTelefonnummerRequest(String ident, List miljoer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new TelefonnummerDeleteCommand(webClient, ident, miljoer, TELEFONTYPER_LISTE, token.getTokenValue()).call()); } @@ -136,7 +136,7 @@ public Flux deleteTelefonnummerRequest(String ident, List @Timed(name = "providers", tags = {"operation", "tps_messaging_createSpraakkode"}) public Flux sendSpraakkodeRequest(String ident, List miljoer, SpraakDTO body) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new TpsMessagingPostCommand(webClient, ident, miljoer, body, SPRAAKKODE_URL, token.getTokenValue()).call()); } @@ -144,7 +144,7 @@ public Flux sendSpraakkodeRequest(String ident, List getPersoner(List identer, List miljoer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size()) .flatMap(index -> new PersonGetCommand(webClient, identer.get(index), miljoer, token.getTokenValue()).call())); } @@ -152,13 +152,13 @@ public Flux getPersoner(List identer, List milj @Timed(name = "providers", tags = {"operation", "tps_messaging_getPerson"}) public Flux getPerson(String ident, List miljoer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> new PersonGetCommand(webClient, ident, miljoer, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMiljoerConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMiljoerConsumer.java index 24cada80c1e..be8fad35dc7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMiljoerConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMiljoerConsumer.java @@ -3,7 +3,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.ConsumerStatus; import no.nav.dolly.bestilling.tpsmessagingservice.command.MiljoerGetCommand; -import no.nav.dolly.config.credentials.TpsMiljoerProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.AccessToken; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -20,15 +20,15 @@ public class TpsMiljoerConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public TpsMiljoerConsumer( TokenExchange tokenService, - TpsMiljoerProperties serverProperties, + Consumers consumers, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavMiljoerService(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .build(); @@ -36,19 +36,19 @@ public TpsMiljoerConsumer( public Mono getToken() { - return tokenService.exchange(serviceProperties); + return tokenService.exchange(serverProperties); } @Timed(name = "providers", tags = {"operation", "get_tps_miljoer"}) public Mono> getTpsMiljoer() { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new MiljoerGetCommand(webClient, token.getTokenValue()).call()); } @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/UdiStubConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/UdiStubConsumer.java index 5a5967061fc..8ff5323bd98 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/UdiStubConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/UdiStubConsumer.java @@ -8,7 +8,7 @@ import no.nav.dolly.bestilling.udistub.command.UdistubPutCommand; import no.nav.dolly.bestilling.udistub.domain.UdiPerson; import no.nav.dolly.bestilling.udistub.domain.UdiPersonResponse; -import no.nav.dolly.config.credentials.UdistubServerProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; import no.nav.dolly.util.JacksonExchangeStrategyUtil; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -25,16 +25,16 @@ public class UdiStubConsumer implements ConsumerStatus { private final WebClient webClient; private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public UdiStubConsumer( TokenExchange accessTokenService, - UdistubServerProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { this.tokenService = accessTokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavUdistubProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(JacksonExchangeStrategyUtil.getJacksonStrategy(objectMapper)) @@ -44,28 +44,28 @@ public UdiStubConsumer( @Timed(name = "providers", tags = {"operation", "udi_getPerson"}) public Mono getUdiPerson(String ident) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new UdistubGetCommand(webClient, ident, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "udi_createPerson"}) public Mono createUdiPerson(UdiPerson udiPerson) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new UdistubPostCommand(webClient, udiPerson, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "udi_updatePerson"}) public Mono updateUdiPerson(UdiPerson udiPerson) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new UdistubPutCommand(webClient, udiPerson, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "udi_deletePerson"}) public Flux deleteUdiPerson(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> Flux.fromIterable(identer) .map(ident -> new UdistubDeleteCommand(webClient, ident, token.getTokenValue()).call()) @@ -74,7 +74,7 @@ public Flux deleteUdiPerson(List identer) { @Override public String serviceUrl() { - return serviceProperties.getUrl(); + return serverProperties.getUrl(); } @Override diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java new file mode 100644 index 00000000000..8349d700206 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java @@ -0,0 +1,56 @@ +package no.nav.dolly.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavAaregProxy; + private ServerProperties testnavAmeldingService; + private ServerProperties testnavArbeidsplassenCVProxy; + private ServerProperties testnavArenaForvalterenProxy; + private ServerProperties testnavBrregStubProxy; + private ServerProperties testnavDokarkivProxy; + private ServerProperties testnavHistarkProxy; + private ServerProperties testnavInntektsmeldingService; + private ServerProperties testnavInntektstubProxy; + private ServerProperties testnavInstProxy; + private ServerProperties testnavKodeverkProxy; + private ServerProperties testnavKontoregisterPersonProxy; + private ServerProperties testnavKrrstubProxy; + private ServerProperties testnavMedlProxy; + private ServerProperties testnavNorg2Proxy; + private ServerProperties testnavOrganisasjonForvalter; + private ServerProperties testnavOrganisasjonService; + private ServerProperties testnavPdlForvalter; + private ServerProperties testnavPdlProxy; + private ServerProperties testnavPensjonTestdataFacadeProxy; + private ServerProperties testnavPersonService; + private ServerProperties testnavSigrunstubProxy; + private ServerProperties testnavSkjermingsregisterProxy; + private ServerProperties testnavSykemeldingApi; + private ServerProperties testnavSyntSykemeldingApi; + private ServerProperties testnavTpsMessagingService; + private ServerProperties testnavMiljoerService; + private ServerProperties testnavUdistubProxy; + +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/AaregProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/AaregProxyProperties.java deleted file mode 100644 index ff65f6a7d91..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/AaregProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-aareg-proxy") -public class AaregProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/AmeldingServiceProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/AmeldingServiceProperties.java deleted file mode 100644 index b86d6f4f89d..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/AmeldingServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-amelding-service") -public class AmeldingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ArbeidsplassenProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ArbeidsplassenProxyProperties.java deleted file mode 100644 index 6d2535de3d8..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ArbeidsplassenProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-arbeidsplassencv-proxy") -public class ArbeidsplassenProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ArenaforvalterProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ArenaforvalterProxyProperties.java deleted file mode 100644 index 52d70b61aba..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ArenaforvalterProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-arena-forvalteren-proxy") -public class ArenaforvalterProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/BrregstubProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/BrregstubProxyProperties.java deleted file mode 100644 index 9613ddf1f91..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/BrregstubProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-brregstub-proxy") -public class BrregstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/DokarkivProxyServiceProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/DokarkivProxyServiceProperties.java deleted file mode 100644 index 8470d32b851..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/DokarkivProxyServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-dokarkiv-proxy") -public class DokarkivProxyServiceProperties extends ServerProperties { -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/HistarkProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/HistarkProxyProperties.java deleted file mode 100644 index ac4c0a67495..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/HistarkProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-histark-proxy") -public class HistarkProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InntektsmeldingServiceProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InntektsmeldingServiceProperties.java deleted file mode 100644 index ce6bcb5472d..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InntektsmeldingServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-inntektsmelding-service") -public class InntektsmeldingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InntektstubProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InntektstubProxyProperties.java deleted file mode 100644 index 9dde8a88177..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InntektstubProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-inntektstub-proxy") -public class InntektstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InstProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InstProxyProperties.java deleted file mode 100644 index f5cde8ff842..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/InstProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-inst-proxy") -public class InstProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KodeverkProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KodeverkProxyProperties.java deleted file mode 100644 index ad16b882173..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KodeverkProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-kodeverk-proxy") -public class KodeverkProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KontoregisterConsumerProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KontoregisterConsumerProperties.java deleted file mode 100644 index 3ca22591624..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KontoregisterConsumerProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-kontoregister-person-proxy") -public class KontoregisterConsumerProperties extends ServerProperties { -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KrrstubProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KrrstubProxyProperties.java deleted file mode 100644 index 0b87e0181b3..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/KrrstubProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-krrstub-proxy") -public class KrrstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/MedlProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/MedlProxyProperties.java deleted file mode 100644 index 58dadd072fb..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/MedlProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-medl-proxy") -public class MedlProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/Norg2ProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/Norg2ProxyProperties.java deleted file mode 100644 index 7e7c6367920..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/Norg2ProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-norg2-proxy") -public class Norg2ProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonForvalterProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonForvalterProperties.java deleted file mode 100644 index 543a4537d36..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonForvalterProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-forvalter") -public class OrganisasjonForvalterProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonServiceProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index 916c1173e4f..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.dolly.config.credentials; - -import lombok.Getter; -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Getter -@Setter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - private Integer threads; -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PdlDataForvalterProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PdlDataForvalterProperties.java deleted file mode 100644 index e65e6395648..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PdlDataForvalterProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pdl-forvalter") -public class PdlDataForvalterProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PdlProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PdlProxyProperties.java deleted file mode 100644 index ae9fd240bc8..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PdlProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pdl-proxy") -public class PdlProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PensjonforvalterProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PensjonforvalterProxyProperties.java deleted file mode 100644 index 18424d3226f..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PensjonforvalterProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pensjon-testdata-facade-proxy") -public class PensjonforvalterProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PersonServiceProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PersonServiceProperties.java deleted file mode 100644 index a23d2eb6e29..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/PersonServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-service") -public class PersonServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SigrunstubProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SigrunstubProxyProperties.java deleted file mode 100644 index 6bc06997520..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SigrunstubProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-sigrunstub-proxy") -public class SigrunstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SkjermingsregisterProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SkjermingsregisterProxyProperties.java deleted file mode 100644 index 07a6b7cdae6..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SkjermingsregisterProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-skjermingsregister-proxy") -public class SkjermingsregisterProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SykemeldingApiProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SykemeldingApiProperties.java deleted file mode 100644 index e3b30bc9f5b..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SykemeldingApiProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-sykemelding-api") -public class SykemeldingApiProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SyntSykemeldingApiProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SyntSykemeldingApiProperties.java deleted file mode 100644 index b7f384d73fd..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/SyntSykemeldingApiProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-synt-sykemelding-api") -public class SyntSykemeldingApiProperties extends ServerProperties { -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/TpsMessagingServiceProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/TpsMessagingServiceProperties.java deleted file mode 100644 index 7b303e8f635..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/TpsMessagingServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-tps-messaging-service") -public class TpsMessagingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/TpsMiljoerProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/TpsMiljoerProperties.java deleted file mode 100644 index bde1d5a8f8c..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/TpsMiljoerProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-miljoer-service") -public class TpsMiljoerProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/UdistubServerProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/UdistubServerProperties.java deleted file mode 100644 index 9dee4acc7c0..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/UdistubServerProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-udistub-proxy") -public class UdistubServerProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java index af803e5d0d9..6938efe2d2d 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java @@ -1,7 +1,7 @@ package no.nav.dolly.consumer.kodeverk; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.config.credentials.KodeverkProxyProperties; +import no.nav.dolly.config.Consumers; import no.nav.dolly.consumer.kodeverk.domain.KodeverkBetydningerResponse; import no.nav.dolly.metrics.Timed; import no.nav.dolly.util.WebClientFilter; @@ -40,15 +40,15 @@ public class KodeverkConsumer { private final TokenExchange tokenService; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public KodeverkConsumer( TokenExchange tokenService, - KodeverkProxyProperties serverProperties, + Consumers consumers, WebClient.Builder webClientBuilder ) { this.tokenService = tokenService; - this.serviceProperties = serverProperties; + serverProperties = consumers.getTestnavKodeverkProxy(); this.webClient = webClientBuilder .exchangeStrategies( ExchangeStrategies @@ -89,7 +89,7 @@ public Mono> getKodeverkByName(String kodeverk) { private Flux getKodeverk(String kodeverk) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMapMany(token -> webClient .get() .uri(uriBuilder -> uriBuilder diff --git a/apps/dolly-backend/src/main/resources/application.yaml b/apps/dolly-backend/src/main/resources/application.yaml index 779092c14ea..3130984efd7 100644 --- a/apps/dolly-backend/src/main/resources/application.yaml +++ b/apps/dolly-backend/src/main/resources/application.yaml @@ -216,7 +216,6 @@ consumers: namespace: dolly url: http://testnav-organisasjon-service.dolly.svc.cluster.local cluster: dev-gcp - threads: 5 testnav-udistub-proxy: name: testnav-udistub-proxy namespace: dolly diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumerTest.java index b523869f162..d8e29a9d42d 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/arenaforvalter/ArenaForvalterConsumerTest.java @@ -1,11 +1,11 @@ package no.nav.dolly.bestilling.arenaforvalter; -import no.nav.dolly.config.credentials.ArenaforvalterProxyProperties; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaBruker; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyBruker; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyeBrukere; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.hamcrest.CoreMatchers; import org.junit.jupiter.api.BeforeEach; @@ -24,14 +24,7 @@ import java.util.List; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; import static org.hamcrest.MatcherAssert.assertThat; @@ -67,7 +60,7 @@ class ArenaForvalterConsumerTest { @BeforeEach void setup() { - when(tokenService.exchange(ArgumentMatchers.any(ArenaforvalterProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test @@ -77,7 +70,7 @@ void deleteIdent() { var response = arenaForvalterConsumer.deleteIdenter(List.of(IDENT)).collectList().block(); - verify(tokenService).exchange(ArgumentMatchers.any(ArenaforvalterProxyProperties.class)); + verify(tokenService).exchange(ArgumentMatchers.any(ServerProperties.class)); } @Test diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/instdata/InstdataConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/instdata/InstdataConsumerTest.java index bfe3d9ff73a..8a5bdf1c5ea 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/instdata/InstdataConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/instdata/InstdataConsumerTest.java @@ -1,10 +1,10 @@ package no.nav.dolly.bestilling.instdata; -import no.nav.dolly.config.credentials.InstProxyProperties; import no.nav.dolly.domain.resultset.inst.Instdata; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.dolly.errorhandling.ErrorStatusDecoder; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -62,7 +62,7 @@ class InstdataConsumerTest { @BeforeEach void setup() { - when(tokenService.exchange(ArgumentMatchers.any(InstProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test @@ -72,7 +72,7 @@ void deleteInstdata() { instdataConsumer.deleteInstdata(List.of(IDENT)) .subscribe(resultat -> - verify(tokenService).exchange(ArgumentMatchers.any(InstProxyProperties.class))); + verify(tokenService).exchange(ArgumentMatchers.any(ServerProperties.class))); } @Test diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumerTest.java index f76b7c16c51..2e26426511d 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumerTest.java @@ -3,12 +3,12 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.dolly.config.credentials.KontoregisterConsumerProperties; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.data.kontoregister.v1.HentKontoRequestDTO; import no.nav.testnav.libs.data.kontoregister.v1.KontoregisterResponseDTO; import no.nav.testnav.libs.data.kontoregister.v1.OppdaterKontoRequestDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -65,7 +65,7 @@ class KontoregisterConsumerTest { @BeforeEach void setup() { - when(tokenService.exchange(ArgumentMatchers.any(KontoregisterConsumerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @AfterEach diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumerTest.java index 0ad102d48ee..d5afa94ac60 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumerTest.java @@ -3,11 +3,11 @@ import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.stubbing.StubMapping; import no.nav.dolly.bestilling.krrstub.dto.DigitalKontaktdataResponse; -import no.nav.dolly.config.credentials.KrrstubProxyProperties; import no.nav.dolly.domain.CommonKeysAndUtils; import no.nav.dolly.domain.resultset.krrstub.DigitalKontaktdata; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -68,7 +68,7 @@ class KrrstubConsumerTest { @BeforeEach void setup() { - when(tokenService.exchange(ArgumentMatchers.any(KrrstubProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test @@ -116,7 +116,7 @@ void deleteDigitalKontaktdataPerson_Ok() { @Test void createDigitalKontaktdata_GenerateTokenFailed_NoAction() { - when(tokenService.exchange(any(KrrstubProxyProperties.class))).thenReturn(Mono.empty()); + when(tokenService.exchange(any(ServerProperties.class))).thenReturn(Mono.empty()); StepVerifier.create(krrStubConsumer.createDigitalKontaktdata(DigitalKontaktdata.builder() .epost(EPOST) @@ -126,7 +126,7 @@ void createDigitalKontaktdata_GenerateTokenFailed_NoAction() { .expectNextCount(0) .verifyComplete(); - verify(tokenService).exchange(any(KrrstubProxyProperties.class)); + verify(tokenService).exchange(any(ServerProperties.class)); } @Test diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java index 666db4e3605..6aa4613ac43 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java @@ -5,9 +5,9 @@ import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonTpForholdRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonTpYtelseRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.config.credentials.PensjonforvalterProxyProperties; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -57,7 +57,7 @@ class PensjonforvalterConsumerTest { @BeforeEach void setup() { - when(tokenService.exchange(ArgumentMatchers.any(PensjonforvalterProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } private void stubGetMiljo() { diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumerTest.java index 24b83c27165..a2d09fd56ad 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/sigrunstub/SigrunStubConsumerTest.java @@ -6,9 +6,9 @@ import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubLignetInntektRequest; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubPensjonsgivendeInntektRequest; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubResponse; -import no.nav.dolly.config.credentials.SigrunstubProxyProperties; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -72,7 +72,7 @@ void setup() { WireMock.reset(); - when(tokenService.exchange(ArgumentMatchers.any(SigrunstubProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); lignetInntektRequest = SigrunstubLignetInntektRequest.builder() .inntektsaar("1978") diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumerTest.java index 9b8153ad278..8c3f2a441a9 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumerTest.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.dolly.config.credentials.TpsMessagingServiceProperties; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.data.kontoregister.v1.BankkontonrUtlandDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; @@ -98,7 +97,7 @@ void createUtenlandskbankkonto_OK() { @Test void createDigitalKontaktdata_GenerateTokenFailed_ThrowsDollyFunctionalException() { - when(tokenService.exchange(any(TpsMessagingServiceProperties.class))).thenThrow(new SecurityException()); + when(tokenService.exchange(any(ServerProperties.class))).thenThrow(new SecurityException()); BankkontonrUtlandDTO bankkontonrUtlandDTO = new BankkontonrUtlandDTO(); @@ -110,7 +109,7 @@ void createDigitalKontaktdata_GenerateTokenFailed_ThrowsDollyFunctionalException .collectList() .block()); - verify(tokenService).exchange(any(TpsMessagingServiceProperties.class)); + verify(tokenService).exchange(any(ServerProperties.class)); } @Test diff --git a/apps/dolly-backend/src/test/resources/application-test.yaml b/apps/dolly-backend/src/test/resources/application-test.yaml index 114554a7662..620a3cf5c33 100644 --- a/apps/dolly-backend/src/test/resources/application-test.yaml +++ b/apps/dolly-backend/src/test/resources/application-test.yaml @@ -71,7 +71,6 @@ consumers: name: testnav-organisasjon-service cluster: dev-gcp namespace: dolly - threads: 5 testnav-pensjon-testdata-facade-proxy: url: http://localhost:${wiremock.server.port:0}/pensjon-testdata name: testnav-pensjon-testdata-facade-proxy diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java index 984bf7de184..75078944514 100644 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java @@ -2,14 +2,13 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.web.credentials.*; +import no.nav.dolly.web.config.Consumers; import no.nav.dolly.web.service.AccessService; import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig; import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory; import no.nav.testnav.libs.reactivefrontend.filter.AddUserJwtHeaderToRequestGatewayFilterFactory; import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; -import no.nav.testnav.libs.reactivesessionsecurity.exchange.user.TestnavBrukerServiceProperties; import no.nav.testnav.libs.reactivesessionsecurity.exchange.user.UserJwtExchange; import no.nav.testnav.libs.securitycore.config.UserSessionConstant; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -40,82 +39,48 @@ public class DollyFrontendApplicationStarter { private final AccessService accessService; private final UserJwtExchange userJwtExchange; - private final TestnavOrganisasjonFasteDataServiceProperties testnavOrganisasjonFasteDataServiceProperties; - private final TestnavJoarkDokumentServiceProperties testnavJoarkDokumentServiceProperties; - private final TestnavInntektstubProxyProperties testnavInntektstubProxyProperties; - private final TpsMessagingServiceProperties tpsMessagingServiceProperties; - private final TestnavBrukerServiceProperties testnavBrukerServiceProperties; - private final TestnavBrregstubProxyProperties testnavBrregstubProxyProperties; - private final TestnavInstProxyProperties testnavInstProxyProperties; - private final TestnavAaregProxyProperties testnavAaregProxyProperties; - private final TestnavUdistubProxyProperties testnavUdistubProxyProperties; - private final TestnavArenaForvalterenProxyProperties testnavArenaForvalterenProxyProperties; - private final TestnavKrrstubProxyProperties testnavKrrstubProxyProperties; - private final TestnavMedlProxyProperties testnavMedlProxyProperties; - private final TestnavSigrunstubProxyProperties testnavSigrunstubProxyProperties; - private final TestnavPensjonTestdataFacadeProxyProperties testnavPensjonTestdataFacadeProxyProperties; - private final TestnavPersonOrganisasjonTilgangServiceProperties testnavPersonOrganisasjonTilgangServiceProperties; - private final DollyBackendProperties dollyBackendProperties; - private final TestnorgeProfilApiProperties testnorgeProfilApiProperties; - private final TestnavVarslingerServiceProperties testnavVarslingerServiceProperties; - private final TestnavOrganisasjonForvalterProperties testnavOrganisasjonForvalterProperties; - private final TestnavOrganisasjonServiceProperties testnavOrganisasjonServiceProperties; - private final TestnavMiljoerServiceProperties testnavMiljoerServiceProperties; - private final PersonSearchServiceProperties personSearchServiceProperties; - private final TestnavAdresseServiceProperties testnavAdresseServiceProperties; - private final OppsummeringsdokumentServiceProperties oppsummeringsdokumentServiceProperties; - private final TestnavPdlForvalterProperties testnavPdlForvalterProperties; - private final TestnavOrganisasjonTilgangServiceProperties testnavOrganisasjonTilgangServiceProperties; - private final TestnavNorg2ProxyProperties testnavNorg2ProxyProperties; - private final KontoregisterProxyProperties kontoregisterProxyProperties; - private final SkjermingsregisterProxyProperties skjermingsregisterProxyProperties; - private final TestnavDokarkivProxyProperties testnavDokarkivProxyProperties; - private final TestnavHistarkProxyProperties testnavHistarkProxyProperties; - private final TestnavArbeidsplassenCvProxyProperties testnavArbeidsplassenCvProxyProperties; - private final TestnavHelsePersonellServiceProperties testnavHelsePersonellServiceProperties; - private final PersonServiceProperties personServiceProperties; - private final GenererNavnServiceProperties genererNavnServiceProperties; + private final Consumers consumers; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { return builder .routes() - .route(createRoute(kontoregisterProxyProperties)) - .route(createRoute(testnavOrganisasjonFasteDataServiceProperties)) - .route(createRoute(testnavAdresseServiceProperties)) - .route(createRoute(oppsummeringsdokumentServiceProperties, "oppsummeringsdokument-service")) - .route(createRoute(testnavOrganisasjonForvalterProperties)) - .route(createRoute(testnavVarslingerServiceProperties, "testnav-varslinger-service")) - .route(createRoute(testnorgeProfilApiProperties)) - .route(createRoute(testnavOrganisasjonTilgangServiceProperties, "testnav-organisasjon-tilgang-service")) - .route(createRoute(tpsMessagingServiceProperties, "testnav-tps-messaging-service")) - .route(createRoute(testnorgeProfilApiProperties, "testnorge-profil-api")) - .route(createRoute(testnavBrukerServiceProperties, "testnav-bruker-service")) - .route(createRoute(testnavMiljoerServiceProperties)) - .route(createRoute(dollyBackendProperties, "dolly-backend")) - .route(createRoute(testnavJoarkDokumentServiceProperties)) - .route(createRoute(testnavPensjonTestdataFacadeProxyProperties)) - .route(createRoute(testnavInntektstubProxyProperties)) - .route(createRoute(testnavBrregstubProxyProperties)) - .route(createRoute(testnavAaregProxyProperties)) - .route(createRoute(testnavUdistubProxyProperties, "testnav-udistub-proxy")) - .route(createRoute(testnavArenaForvalterenProxyProperties)) - .route(createRoute(testnavKrrstubProxyProperties, "testnav-krrstub-proxy")) - .route(createRoute(testnavMedlProxyProperties, "testnav-medl-proxy")) - .route(createRoute(testnavNorg2ProxyProperties, "testnav-norg2-proxy")) - .route(createRoute(testnavInstProxyProperties, "testnav-inst-proxy")) - .route(createRoute(testnavHistarkProxyProperties, "testnav-histark-proxy")) - .route(createRoute(testnavOrganisasjonServiceProperties)) - .route(createRoute(testnavSigrunstubProxyProperties)) - .route(createRoute(testnavPdlForvalterProperties, "testnav-pdl-forvalter")) - .route(createRoute(personSearchServiceProperties)) - .route(createRoute(testnavPersonOrganisasjonTilgangServiceProperties, "testnav-person-organisasjon-tilgang-service")) - .route(createRoute(skjermingsregisterProxyProperties)) - .route(createRoute(testnavDokarkivProxyProperties)) - .route(createRoute(testnavArbeidsplassenCvProxyProperties)) - .route(createRoute(testnavHelsePersonellServiceProperties)) - .route(createRoute(personServiceProperties, "person-service")) - .route(createRoute(genererNavnServiceProperties)) + .route(createRoute(consumers.getTestnavKontoregisterPersonProxy())) + .route(createRoute(consumers.getTestnavOrganisasjonFasteDataService())) + .route(createRoute(consumers.getTestnavAdresseService())) + .route(createRoute(consumers.getOppsummeringsdokumentService(), "oppsummeringsdokument-service")) + .route(createRoute(consumers.getTestnavOrganisasjonForvalter())) + .route(createRoute(consumers.getTestnavVarslingerService(), "testnav-varslinger-service")) + .route(createRoute(consumers.getTestnorgeProfilApi())) // Duplicate, see below. + .route(createRoute(consumers.getTestnavOrganisasjonTilgangService(), "testnav-organisasjon-tilgang-service")) + .route(createRoute(consumers.getTestnavTpsMessagingService(), "testnav-tps-messaging-service")) + .route(createRoute(consumers.getTestnorgeProfilApi(), "testnorge-profil-api")) // Duplicate, see above. + .route(createRoute(consumers.getTestnavBrukerService(), "testnav-bruker-service")) + .route(createRoute(consumers.getTestnavMiljoerService())) + .route(createRoute(consumers.getDollyBackend(), "dolly-backend")) + .route(createRoute(consumers.getTestnavJoarkDokumentService())) + .route(createRoute(consumers.getTestnavPensjonTestdataFacadeProxy())) + .route(createRoute(consumers.getTestnavInntektstubProxy())) + .route(createRoute(consumers.getTestnavBrregstubProxy())) + .route(createRoute(consumers.getTestnavAaregProxy())) + .route(createRoute(consumers.getTestnavUdistubProxy(), "testnav-udistub-proxy")) + .route(createRoute(consumers.getTestnavArenaForvalterenProxy())) + .route(createRoute(consumers.getTestnavKrrstubProxy(), "testnav-krrstub-proxy")) + .route(createRoute(consumers.getTestnavMedlProxy(), "testnav-medl-proxy")) + .route(createRoute(consumers.getTestnavNorg2Proxy(), "testnav-norg2-proxy")) + .route(createRoute(consumers.getTestnavInstProxy(), "testnav-inst-proxy")) + .route(createRoute(consumers.getTestnavHistarkProxy(), "testnav-histark-proxy")) + .route(createRoute(consumers.getTestnavOrganisasjonService())) + .route(createRoute(consumers.getTestnavSigrunstubProxy())) + .route(createRoute(consumers.getTestnavPdlForvalter(), "testnav-pdl-forvalter")) + .route(createRoute(consumers.getTestnavPersonSearchService())) + .route(createRoute(consumers.getTestnavPersonOrganisasjonTilgangService(), "testnav-person-organisasjon-tilgang-service")) + .route(createRoute(consumers.getTestnavSkjermingsregisterProxy())) + .route(createRoute(consumers.getTestnavDokarkivProxy())) + .route(createRoute(consumers.getTestnavArbeidsplassenCVProxy())) + .route(createRoute(consumers.getTestnavHelsepersonellService())) + .route(createRoute(consumers.getTestnavPersonService(), "person-service")) + .route(createRoute(consumers.getGenererNavnService())) .build(); } diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java new file mode 100644 index 00000000000..4830926caf2 --- /dev/null +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java @@ -0,0 +1,64 @@ +package no.nav.dolly.web.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties dollyBackend; + private ServerProperties genererNavnService; + private ServerProperties testnavKontoregisterPersonProxy; + private ServerProperties oppsummeringsdokumentService; + private ServerProperties testnavPersonSearchService; + private ServerProperties testnavPersonService; + private ServerProperties testnavSkjermingsregisterProxy; + private ServerProperties testnavAaregProxy; + private ServerProperties testnavAdresseService; + private ServerProperties testnavArbeidsplassenCVProxy; + private ServerProperties testnavArenaForvalterenProxy; + private ServerProperties testnavBrregstubProxy; + private ServerProperties testnavBrukerService; + private ServerProperties testnavDokarkivProxy; + private ServerProperties testnavHelsepersonellService; + private ServerProperties testnavHistarkProxy; + private ServerProperties testnavInntektstubProxy; + private ServerProperties testnavInstProxy; + private ServerProperties testnavJoarkDokumentService; + private ServerProperties testnavKrrstubProxy; + private ServerProperties testnavMedlProxy; + private ServerProperties testnavMiljoerService; + private ServerProperties testnavNorg2Proxy; + private ServerProperties testnavOrganisasjonFasteDataService; + private ServerProperties testnavOrganisasjonForvalter; + private ServerProperties testnavOrganisasjonService; + private ServerProperties testnavOrganisasjonTilgangService; + private ServerProperties testnavPdlForvalter; + private ServerProperties testnavPensjonTestdataFacadeProxy; + private ServerProperties testnavPersonOrganisasjonTilgangService; + private ServerProperties testnavSigrunstubProxy; + private ServerProperties testnavVarslingerService; + private ServerProperties testnorgeProfilApi; + private ServerProperties testnorgeTilbakemeldingApi; + private ServerProperties testnavTpsMessagingService; + private ServerProperties testnavUdistubProxy; + +} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/PersonOrganisasjonTilgangConsumer.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/PersonOrganisasjonTilgangConsumer.java index b423c107a3d..9c0396fdafd 100644 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/PersonOrganisasjonTilgangConsumer.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/PersonOrganisasjonTilgangConsumer.java @@ -3,8 +3,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.web.consumers.command.GetPersonOrganisasjonTilgangCommand; -import no.nav.dolly.web.credentials.TestnavPersonOrganisasjonTilgangServiceProperties; +import no.nav.dolly.web.config.Consumers; import no.nav.dolly.web.service.AccessService; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.http.codec.json.Jackson2JsonEncoder; @@ -19,17 +20,17 @@ @Component public class PersonOrganisasjonTilgangConsumer { private final WebClient webClient; - private final TestnavPersonOrganisasjonTilgangServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final AccessService accessService; public PersonOrganisasjonTilgangConsumer( - TestnavPersonOrganisasjonTilgangServiceProperties serviceProperties, + Consumers consumers, AccessService accessService, ObjectMapper objectMapper) { this.accessService = accessService; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrganisasjonTilgangService(); ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() .codecs(config -> { config.defaultCodecs() @@ -41,12 +42,12 @@ public PersonOrganisasjonTilgangConsumer( this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Mono hasAccess(String organisasjonsnummer, ServerWebExchange exchange) { - return accessService.getAccessToken(serviceProperties, exchange) + return accessService.getAccessToken(serverProperties, exchange) .flatMap(accessToken -> new GetPersonOrganisasjonTilgangCommand(webClient, accessToken, organisasjonsnummer).call()) .onErrorResume( WebClientResponseException.class::isInstance, diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/TilbakemeldingConsumer.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/TilbakemeldingConsumer.java index 36cc5a8dd52..8d14afe3a97 100644 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/TilbakemeldingConsumer.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/consumers/TilbakemeldingConsumer.java @@ -1,9 +1,10 @@ package no.nav.dolly.web.consumers; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.web.credentials.TestnorgeTilbakemeldingApiProperties; +import no.nav.dolly.web.config.Consumers; import no.nav.dolly.web.service.AccessService; import no.nav.testnav.libs.dto.tilbakemeldingapi.v1.TilbakemeldingDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; @@ -17,23 +18,23 @@ @Service public class TilbakemeldingConsumer { private final WebClient webClient; - private final TestnorgeTilbakemeldingApiProperties testnorgeTilbakemeldingApiProperties; + private final ServerProperties serverProperties; private final AccessService accessService; public TilbakemeldingConsumer( - TestnorgeTilbakemeldingApiProperties tilbakemeldingApiProperties, + Consumers consumers, AccessService accessService) { - this.testnorgeTilbakemeldingApiProperties = tilbakemeldingApiProperties; + serverProperties = consumers.getTestnorgeTilbakemeldingApi(); this.webClient = WebClient.builder() - .baseUrl(tilbakemeldingApiProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.accessService = accessService; } public Mono send(TilbakemeldingDTO dto, ServerWebExchange exchange) { return - accessService.getAccessToken(testnorgeTilbakemeldingApiProperties, exchange) + accessService.getAccessToken(serverProperties, exchange) .flatMap(accessToken -> webClient .post() .uri("/api/v1/tilbakemelding") diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/DollyBackendProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/DollyBackendProperties.java deleted file mode 100644 index 575c9ad05a7..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/DollyBackendProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.dolly-backend") -public class DollyBackendProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/GenererNavnServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/GenererNavnServiceProperties.java deleted file mode 100644 index ac3010cde1b..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/GenererNavnServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.generer-navn-service") -public class GenererNavnServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/KontoregisterProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/KontoregisterProxyProperties.java deleted file mode 100644 index 953cb5b8573..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/KontoregisterProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-kontoregister-person-proxy") -public class KontoregisterProxyProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/OppsummeringsdokumentServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/OppsummeringsdokumentServiceProperties.java deleted file mode 100644 index 29aaf912a3a..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/OppsummeringsdokumentServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.oppsummeringsdokument-service") -public class OppsummeringsdokumentServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/PersonSearchServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/PersonSearchServiceProperties.java deleted file mode 100644 index 1896cfb495f..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/PersonSearchServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-search-service") -public class PersonSearchServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/PersonServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/PersonServiceProperties.java deleted file mode 100644 index 569d864adf9..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/PersonServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-service") -public class PersonServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/SkjermingsregisterProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/SkjermingsregisterProxyProperties.java deleted file mode 100644 index 3eedfa46ce5..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/SkjermingsregisterProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-skjermingsregister-proxy") -public class SkjermingsregisterProxyProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavAaregProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavAaregProxyProperties.java deleted file mode 100644 index 06176a96322..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavAaregProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-aareg-proxy") -public class TestnavAaregProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavAdresseServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavAdresseServiceProperties.java deleted file mode 100644 index 31360be2fea..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavAdresseServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-adresse-service") -public class TestnavAdresseServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavArbeidsplassenCvProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavArbeidsplassenCvProxyProperties.java deleted file mode 100644 index 9240efb1b59..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavArbeidsplassenCvProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-arbeidsplassencv-proxy") -public class TestnavArbeidsplassenCvProxyProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavArenaForvalterenProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavArenaForvalterenProxyProperties.java deleted file mode 100644 index a913eaf5b33..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavArenaForvalterenProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-arena-forvalteren-proxy") -public class TestnavArenaForvalterenProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavBrregstubProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavBrregstubProxyProperties.java deleted file mode 100644 index adb908390c6..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavBrregstubProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-brregstub-proxy") -public class TestnavBrregstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavDokarkivProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavDokarkivProxyProperties.java deleted file mode 100644 index 5bf0fef5a87..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavDokarkivProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-dokarkiv-proxy") -public class TestnavDokarkivProxyProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavHelsePersonellServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavHelsePersonellServiceProperties.java deleted file mode 100644 index 864436f7061..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavHelsePersonellServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-helsepersonell-service") -public class TestnavHelsePersonellServiceProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavHistarkProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavHistarkProxyProperties.java deleted file mode 100644 index cc62aab9bcd..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavHistarkProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-histark-proxy") -public class TestnavHistarkProxyProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavInntektstubProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavInntektstubProxyProperties.java deleted file mode 100644 index 869352fdb5d..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavInntektstubProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-inntektstub-proxy") -public class TestnavInntektstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavInstProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavInstProxyProperties.java deleted file mode 100644 index 3c40265f87a..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavInstProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-inst-proxy") -public class TestnavInstProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavJoarkDokumentServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavJoarkDokumentServiceProperties.java deleted file mode 100644 index b37bf2812c7..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavJoarkDokumentServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-joark-dokument-service") -public class TestnavJoarkDokumentServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavKrrstubProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavKrrstubProxyProperties.java deleted file mode 100644 index 20a6e85c216..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavKrrstubProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-krrstub-proxy") -public class TestnavKrrstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavMedlProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavMedlProxyProperties.java deleted file mode 100644 index 14f72a254ba..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavMedlProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-medl-proxy") -public class TestnavMedlProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavMiljoerServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavMiljoerServiceProperties.java deleted file mode 100644 index 85ea5331c29..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavMiljoerServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-miljoer-service") -public class TestnavMiljoerServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavNorg2ProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavNorg2ProxyProperties.java deleted file mode 100644 index caf5b192f8e..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavNorg2ProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-norg2-proxy") -public class TestnavNorg2ProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonFasteDataServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonFasteDataServiceProperties.java deleted file mode 100644 index 67fe86d2e09..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonFasteDataServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-faste-data-service") -public class TestnavOrganisasjonFasteDataServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonForvalterProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonForvalterProperties.java deleted file mode 100644 index a45eac51c04..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonForvalterProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-forvalter") -public class TestnavOrganisasjonForvalterProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonServiceProperties.java deleted file mode 100644 index d99ec26b285..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class TestnavOrganisasjonServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonTilgangServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonTilgangServiceProperties.java deleted file mode 100644 index 9d40b37dd2b..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavOrganisasjonTilgangServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-tilgang-service") -public class TestnavOrganisasjonTilgangServiceProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPdlForvalterProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPdlForvalterProperties.java deleted file mode 100644 index 6f69a32d489..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPdlForvalterProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pdl-forvalter") -public class TestnavPdlForvalterProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPensjonTestdataFacadeProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPensjonTestdataFacadeProxyProperties.java deleted file mode 100644 index da156f48609..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPensjonTestdataFacadeProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pensjon-testdata-facade-proxy") -public class TestnavPensjonTestdataFacadeProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPersonOrganisasjonTilgangServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPersonOrganisasjonTilgangServiceProperties.java deleted file mode 100644 index 3544b0ea0fa..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavPersonOrganisasjonTilgangServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-organisasjon-tilgang-service") -public class TestnavPersonOrganisasjonTilgangServiceProperties extends ServerProperties { -} diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavSigrunstubProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavSigrunstubProxyProperties.java deleted file mode 100644 index 5bc9e2ffde8..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavSigrunstubProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-sigrunstub-proxy") -public class TestnavSigrunstubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavUdistubProxyProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavUdistubProxyProperties.java deleted file mode 100644 index c31f627ff8f..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavUdistubProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-udistub-proxy") -public class TestnavUdistubProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavVarslingerServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavVarslingerServiceProperties.java deleted file mode 100644 index a251fc52fe0..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnavVarslingerServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-varslinger-service") -public class TestnavVarslingerServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnorgeProfilApiProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnorgeProfilApiProperties.java deleted file mode 100644 index 9aa4f01846e..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnorgeProfilApiProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-profil-api") -public class TestnorgeProfilApiProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnorgeTilbakemeldingApiProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnorgeTilbakemeldingApiProperties.java deleted file mode 100644 index 665035926be..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TestnorgeTilbakemeldingApiProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-tilbakemelding-api") -public class TestnorgeTilbakemeldingApiProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TpsMessagingServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TpsMessagingServiceProperties.java deleted file mode 100644 index b061bc4035a..00000000000 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/TpsMessagingServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.dolly.web.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-tps-messaging-service") -public class TpsMessagingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/js/package-lock.json b/apps/dolly-frontend/src/main/js/package-lock.json index 9c71dbae4f3..1bc6e9570e0 100644 --- a/apps/dolly-frontend/src/main/js/package-lock.json +++ b/apps/dolly-frontend/src/main/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "dolly", - "version": "2.5.33", + "version": "2.5.34", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dolly", - "version": "2.5.33", + "version": "2.5.34", "license": "ISC", "dependencies": { "@babel/preset-flow": "^7.18.6", @@ -27,7 +27,7 @@ "immer": "^10.0.1", "lodash": "^4.17.21", "lodash.throttle": "^4.1.1", - "pdfjs-dist": "^3.0.279", + "pdfjs-dist": "^4.0.189", "prop-types": "^15.8.1", "rc-progress": "^3.4.0", "rc-tooltip": "^6.0.1", @@ -1154,9 +1154,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -1221,9 +1221,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", + "version": "8.53.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz", + "integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -1261,9 +1261,9 @@ } }, "node_modules/@floating-ui/react-dom": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.2.tgz", - "integrity": "sha512-5qhlDvjaLmAst/rKb3VdlCinwTF4EYMiVxuuc/HVUjs46W0zgtbMmAZ1UTsDrRTxRmUEzl92mOtWbeeXL26lSQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.3.tgz", + "integrity": "sha512-wOoKUw2P24/OXbNr3bbCqWgoltsyY7lFBDPVtjj/V4WDIJ5hja2C/r+CoWmS+Y75Ahndds3wa7eJRhnJxTCJaQ==", "dependencies": { "@floating-ui/dom": "^1.5.1" }, @@ -1278,9 +1278,9 @@ "integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A==" }, "node_modules/@grafana/faro-core": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@grafana/faro-core/-/faro-core-1.2.3.tgz", - "integrity": "sha512-y2cfow8JLMrvSC4/Pd64/hByoAw5MWOPHmvpAueWNL0Cohj0XOGbKllQjTjnmCnDuLjAARS0pKAVdyVPjw9s6Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@grafana/faro-core/-/faro-core-1.2.4.tgz", + "integrity": "sha512-iXbwp5q+qDPOZqnbiCfcH1EwE4Jps7dYp4SfbPweCgRuF44zcUhTtwipLmCJhESCunwG6K/INQ5RMVDxDau8DQ==", "dependencies": { "@opentelemetry/api": "^1.4.1", "@opentelemetry/api-metrics": "^0.33.0", @@ -1289,12 +1289,12 @@ } }, "node_modules/@grafana/faro-react": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@grafana/faro-react/-/faro-react-1.2.3.tgz", - "integrity": "sha512-NDsNgqn6FBVUe1SvqS2sW9Bif+uww8uwiGjPy5Oh/KoDBjih6Zp7PLw4wmBDo0Y39wdy0V/Z1wF75T4/Kxv6pA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@grafana/faro-react/-/faro-react-1.2.4.tgz", + "integrity": "sha512-MZh6WxKaxTLs/a8sMRWlKKt5xPvni7k7zszxYM4bDLJUbfMhDSlBGHmKI7VCBxoeCDVIZ4+6lMwblHkPaeuMjg==", "dependencies": { - "@grafana/faro-web-sdk": "^1.2.3", - "@grafana/faro-web-tracing": "^1.2.3", + "@grafana/faro-web-sdk": "^1.2.4", + "@grafana/faro-web-tracing": "^1.2.4", "hoist-non-react-statics": "^3.3.2" }, "peerDependencies": { @@ -1303,21 +1303,21 @@ } }, "node_modules/@grafana/faro-web-sdk": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@grafana/faro-web-sdk/-/faro-web-sdk-1.2.3.tgz", - "integrity": "sha512-c/CcwPVIiSCZC3ux2IAHfVWd0xIa1QUMoBd0n7lQzYFVnC3iufq9Ukp1Hgejqud6peH5VxIBXffNOv2inltv1g==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@grafana/faro-web-sdk/-/faro-web-sdk-1.2.4.tgz", + "integrity": "sha512-N91l1ov1oPUL/woB9j7Fx32ntUkRp6YTxt4RQ94Wiq700TVenw1M927UMLWCyHnvWYCyn0CeBnptrhUVqtk8cQ==", "dependencies": { - "@grafana/faro-core": "^1.2.3", + "@grafana/faro-core": "^1.2.4", "ua-parser-js": "^1.0.32", "web-vitals": "^3.1.1" } }, "node_modules/@grafana/faro-web-tracing": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@grafana/faro-web-tracing/-/faro-web-tracing-1.2.3.tgz", - "integrity": "sha512-3o4xWnItTRpyo5uc7YDPl76LTXu66NV5KrXbse7LrhV4BcPhsoBO11FnFElUwX6aV87+8LnYCZw/6IxJcKfdTQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@grafana/faro-web-tracing/-/faro-web-tracing-1.2.4.tgz", + "integrity": "sha512-0AxOaM9sFWT8DXbdUBNPwbyflqly/0/Jh5VTrNZlG4KCH/PIQ5qoCNdropS2D/myMXVoPUb1ggSrJ0C8dpVrBA==", "dependencies": { - "@grafana/faro-web-sdk": "^1.2.3", + "@grafana/faro-web-sdk": "^1.2.4", "@opentelemetry/api": "^1.4.1", "@opentelemetry/context-zone": "^1.15.2", "@opentelemetry/core": "^1.15.2", @@ -1590,16 +1590,16 @@ "optional": true }, "node_modules/@navikt/aksel-icons": { - "version": "5.9.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/aksel-icons/5.9.0/8df7a1bfb0c064597ae000e6695e31e43e868237", - "integrity": "sha512-Su1yjjrS5pveo1S2jdqJ8Ih4pR/2AwZVUxjlQ3KTJ09UsF4EappJ8eZQh/6nMjljs+iCSFoVdtz6ItQ0Od2MRQ==", + "version": "5.9.2", + "resolved": "https://npm.pkg.github.com/download/@navikt/aksel-icons/5.9.2/482bb83a2bc6b4e954700e278c28614c108117e3", + "integrity": "sha512-5XQI4wzZAlB6CoHDXZrjUqMx+7iUiOPoqFY3H9kT/NwfCdmUSPUFfmiPZHzpV7OzS4S61Joo1GhZ31ZZSIuz3Q==", "dev": true, "license": "MIT" }, "node_modules/@navikt/ds-css": { - "version": "5.9.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-css/5.9.0/fc480aadc815908a8777806718d32d386693e963", - "integrity": "sha512-dV00/SrnUvgGHMSGsByxW6IhhTO1cUZKDj0yOlvF7TLDs5AF3ImOTVB0SB5gBdfQcyPfAmE6eekLRAirNzIAPg==", + "version": "5.9.2", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-css/5.9.2/1ec33efe65cd9a20d1a5e9e5a119702626c568d7", + "integrity": "sha512-uzXl4qgzJ934XGRG29rU3Te6jJ5pEiQEsgqOMKKuPMV8RBB2NP1x125bocvDfwEx5CVvr3WzCvxFnlYfFStDVw==", "dev": true, "license": "MIT" }, @@ -1621,15 +1621,15 @@ } }, "node_modules/@navikt/ds-react": { - "version": "5.9.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-react/5.9.0/cedb5affd4277ebbad9ab25f8f9d7ad3a4ed7fad", - "integrity": "sha512-rotxxFog1MWGw90j5kAQTWdx3XaID0Xty+bPu+gmDG0mEQ/whjKWXF8TH3F1+k9HVjhMH/M4X3Bexe+BnDLXkw==", + "version": "5.9.2", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-react/5.9.2/0a0bf183f7cfd7f1932694e3d1829227ce6e6f33", + "integrity": "sha512-ElZvGW/dAylj9PHoOwdABuJVA1Pgx7+Rh4UR9auWQJTs97jklSJ5w78qC3W9SJAi5rVy+I5raFHGY3mW/m/lwA==", "dev": true, "license": "MIT", "dependencies": { "@floating-ui/react": "0.25.4", - "@navikt/aksel-icons": "^5.9.0", - "@navikt/ds-tokens": "^5.9.0", + "@navikt/aksel-icons": "^5.9.2", + "@navikt/ds-tokens": "^5.9.2", "@radix-ui/react-tabs": "1.0.0", "@radix-ui/react-toggle-group": "1.0.0", "clsx": "^1.2.1", @@ -1769,9 +1769,9 @@ } }, "node_modules/@navikt/ds-tokens": { - "version": "5.9.0", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-tokens/5.9.0/4e159bb29f4fc3f3f0793f1ad48643fa4b060f7f", - "integrity": "sha512-ehR4DFyYnGCvk5HBakTH/jkCC5QuZGJ0k6kUVAXhubpMhJU2fqDvuGye/uJaY4PvFN67YRSl9t4JR5lpTQG5NQ==", + "version": "5.9.2", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-tokens/5.9.2/f410260891058d4d3ec19f1c2c175274c3b637ca", + "integrity": "sha512-MzDHuUE0adzgDfat/CStgHSBtvbIxCpY82VNlJ6qLoC7T/rlDCKAaktjLTD1JHPizlawOqJgQp3tOG2vHJKE6A==", "dev": true, "license": "MIT" }, @@ -1845,11 +1845,11 @@ } }, "node_modules/@opentelemetry/context-zone": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-zone/-/context-zone-1.17.1.tgz", - "integrity": "sha512-BNmQE1hAEYM8EXJDgbUdv8r6adnM557fdPvdNoDN41XCIdSKrtNWS4Ors5tK7okszTMr33pqJrHZInD4VpHlPA==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-zone/-/context-zone-1.18.0.tgz", + "integrity": "sha512-unZGG2KCubQGwl6Z0VuWmOM4Q/Hc4RnCW7phl7EOlkQc6yyOlEulKtRU/NXMWhMVfztaIGXf62JW90e4hakkGw==", "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.17.1", + "@opentelemetry/context-zone-peer-dep": "1.18.0", "zone.js": "^0.11.0" }, "engines": { @@ -1857,29 +1857,29 @@ } }, "node_modules/@opentelemetry/context-zone-peer-dep": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-zone-peer-dep/-/context-zone-peer-dep-1.17.1.tgz", - "integrity": "sha512-HCSznYzaBatWVCxPixeBVIFNGMt7vD7yJcoR6V2SB5/vQnjvzHimNrRpcr0xEgC6kTA9XAqDwovkvs+qlflByw==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-zone-peer-dep/-/context-zone-peer-dep-1.18.0.tgz", + "integrity": "sha512-4q6AEuXm+ZudDT4CAkDz1yyFzIp6mzSJNHjOf1HR484TygnZ+fGZLFoCeNQ7ayPPHgTvcqJVKny5L7l5QxJbgQ==", "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@opentelemetry/api": ">=1.0.0 <1.8.0", "zone.js": "^0.10.2 || ^0.11.0" } }, "node_modules/@opentelemetry/core": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.17.1.tgz", - "integrity": "sha512-I6LrZvl1FF97FQXPR0iieWQmKnGxYtMbWA1GrAXnLUR+B1Hn2m8KqQNEIlZAucyv00GBgpWkpllmULmZfG8P3g==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.18.0.tgz", + "integrity": "sha512-PCW0UCIazJRw4Q8m3Z1A20kJqKTCB4Ob02bFjov3sHozspHGnY21O7T8Q20XKe168N4Px+n7Mt4dkcay3fy92Q==", "dependencies": { - "@opentelemetry/semantic-conventions": "1.17.1" + "@opentelemetry/semantic-conventions": "1.18.0" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.7.0" + "@opentelemetry/api": ">=1.0.0 <1.8.0" } }, "node_modules/@opentelemetry/exporter-trace-otlp-http": { @@ -2140,6 +2140,75 @@ "@opentelemetry/api": "^1.0.0" } }, + "node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/core": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.17.1.tgz", + "integrity": "sha512-I6LrZvl1FF97FQXPR0iieWQmKnGxYtMbWA1GrAXnLUR+B1Hn2m8KqQNEIlZAucyv00GBgpWkpllmULmZfG8P3g==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.17.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.7.0" + } + }, + "node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/resources": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.17.1.tgz", + "integrity": "sha512-M2e5emqg5I7qRKqlzKx0ROkcPyF8PbcSaWEdsm72od9txP7Z/Pl8PDYOyu80xWvbHAWk5mDxOF6v3vNdifzclA==", + "dependencies": { + "@opentelemetry/core": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.7.0" + } + }, + "node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.17.1.tgz", + "integrity": "sha512-pfSJJSjZj5jkCJUQZicSpzN8Iz9UKMryPWikZRGObPnJo6cUSoKkjZh6BM3j+D47G4olMBN+YZKYqkFM1L6zNA==", + "dependencies": { + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.7.0" + } + }, + "node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/sdk-trace-web": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-web/-/sdk-trace-web-1.17.1.tgz", + "integrity": "sha512-Nle48xE1eaR6lRqyOvUlIwW/C2Bz6pptHzlHqrd+a6tGSLWEP1ZhPfuJbNeq/tWX5PX2RgeOsLlvPLEEBKeKxg==", + "dependencies": { + "@opentelemetry/core": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.7.0" + } + }, + "node_modules/@opentelemetry/instrumentation-xml-http-request/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.17.1.tgz", + "integrity": "sha512-xbR2U+2YjauIuo42qmE8XyJK6dYeRMLJuOlUP5SO4auET4VtOHOzgkRVOq+Ik18N+Xf3YPcqJs9dZMiDddz1eQ==", + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/instrumentation/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -2279,18 +2348,18 @@ } }, "node_modules/@opentelemetry/resources": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.17.1.tgz", - "integrity": "sha512-M2e5emqg5I7qRKqlzKx0ROkcPyF8PbcSaWEdsm72od9txP7Z/Pl8PDYOyu80xWvbHAWk5mDxOF6v3vNdifzclA==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.18.0.tgz", + "integrity": "sha512-QXdqtTQRl3fVAMu5PSxIev73iaukww/7fW4656pF607ZMAXueRHfdxOBIpGrTvfnv9mcKC3ZwGsIb366JZ2LSQ==", "dependencies": { - "@opentelemetry/core": "1.17.1", - "@opentelemetry/semantic-conventions": "1.17.1" + "@opentelemetry/core": "1.18.0", + "@opentelemetry/semantic-conventions": "1.18.0" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.7.0" + "@opentelemetry/api": ">=1.0.0 <1.8.0" } }, "node_modules/@opentelemetry/sdk-logs": { @@ -2400,41 +2469,41 @@ } }, "node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.17.1.tgz", - "integrity": "sha512-pfSJJSjZj5jkCJUQZicSpzN8Iz9UKMryPWikZRGObPnJo6cUSoKkjZh6BM3j+D47G4olMBN+YZKYqkFM1L6zNA==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.18.0.tgz", + "integrity": "sha512-OThpwn8JeU4q7exo0e8kQqs5BZGKQ9NNkes66RCs7yhUKShHEKQIYl/A3+xnGzMrbrtgogcf84brH8XD4ahjMg==", "dependencies": { - "@opentelemetry/core": "1.17.1", - "@opentelemetry/resources": "1.17.1", - "@opentelemetry/semantic-conventions": "1.17.1" + "@opentelemetry/core": "1.18.0", + "@opentelemetry/resources": "1.18.0", + "@opentelemetry/semantic-conventions": "1.18.0" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.7.0" + "@opentelemetry/api": ">=1.0.0 <1.8.0" } }, "node_modules/@opentelemetry/sdk-trace-web": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-web/-/sdk-trace-web-1.17.1.tgz", - "integrity": "sha512-Nle48xE1eaR6lRqyOvUlIwW/C2Bz6pptHzlHqrd+a6tGSLWEP1ZhPfuJbNeq/tWX5PX2RgeOsLlvPLEEBKeKxg==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-web/-/sdk-trace-web-1.18.0.tgz", + "integrity": "sha512-ID/s4ajm8AoLFCLoLxweI6P1eg8qV6qi8ckPRH2eOwyyBQkQ/3oXyLo13muDqzdPzvBS/y/zYrXktOQ6btpHfA==", "dependencies": { - "@opentelemetry/core": "1.17.1", - "@opentelemetry/sdk-trace-base": "1.17.1", - "@opentelemetry/semantic-conventions": "1.17.1" + "@opentelemetry/core": "1.18.0", + "@opentelemetry/sdk-trace-base": "1.18.0", + "@opentelemetry/semantic-conventions": "1.18.0" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.7.0" + "@opentelemetry/api": ">=1.0.0 <1.8.0" } }, "node_modules/@opentelemetry/semantic-conventions": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.17.1.tgz", - "integrity": "sha512-xbR2U+2YjauIuo42qmE8XyJK6dYeRMLJuOlUP5SO4auET4VtOHOzgkRVOq+Ik18N+Xf3YPcqJs9dZMiDddz1eQ==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.18.0.tgz", + "integrity": "sha512-Bxtd+h2+rBv3XBHZaoXq133/hzgAQvbl2Kg5a9cG4ozfiUJHC9Xkblt7PrLc9CbzwWQpSxUxWoZJHXT3lUlkOw==", "engines": { "node": ">=14" } @@ -2743,9 +2812,9 @@ } }, "node_modules/@rc-component/trigger": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@rc-component/trigger/-/trigger-1.18.0.tgz", - "integrity": "sha512-vloGnWpeTmt7DBw0OHnG9poQ8h1WFh0hebq6fpgVjGYSxm6JU8rLH+kNwVNNvhL6Rg5He4ESjOk6O7uF9dJhxA==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/@rc-component/trigger/-/trigger-1.18.1.tgz", + "integrity": "sha512-bAcxJJ1Y+EJVgn8BRik7d8JjjAPND5zKkHQ3159zeR0gVoG4Z0RgEDAiXFFoie3/WpoJ9dRJyjrIpnH4Ef7PEg==", "dependencies": { "@babel/runtime": "^7.23.2", "@rc-component/portal": "^1.1.0", @@ -2763,13 +2832,13 @@ } }, "node_modules/@redux-devtools/extension": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/@redux-devtools/extension/-/extension-3.2.5.tgz", - "integrity": "sha512-UhyDF7WmdnCrN1s++YC4sdQCo0z6YUnoB2eCh15nXDDq3QH1jDju1144UNRU6Nvi4inxhaIum4m9BXVYWVC1ng==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/@redux-devtools/extension/-/extension-3.2.6.tgz", + "integrity": "sha512-fWrqYAoFFKc5+78P/xWj+3NcoiJ07ak5qdiPTbO5CAuM5vE3dKk5fajpJyuOab+hLNEUJMTklCBYm+WTFcWWxA==", "dev": true, "dependencies": { - "@babel/runtime": "^7.20.7", - "immutable": "^4.2.2" + "@babel/runtime": "^7.23.2", + "immutable": "^4.3.4" }, "peerDependencies": { "redux": "^3.1.0 || ^4.0.0" @@ -3172,9 +3241,9 @@ "dev": true }, "node_modules/@types/babel__core": { - "version": "7.20.3", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.3.tgz", - "integrity": "sha512-54fjTSeSHwfan8AyHWrKbfBWiEUrNTZsUwPTDSNaaP1QDQIZbeNUg3a59E9D+375MzUw/x1vx2/0F5LBz+AeYA==", + "version": "7.20.4", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.4.tgz", + "integrity": "sha512-mLnSC22IC4vcWiuObSRjrLd9XcBTGf59vUSoq2jkQDJ/QQ8PMI9rSuzE+aEV8karUMbskw07bKYoUJCKTUaygg==", "dev": true, "dependencies": { "@babel/parser": "^7.20.7", @@ -3185,18 +3254,18 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.6", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.6.tgz", - "integrity": "sha512-66BXMKb/sUWbMdBNdMvajU7i/44RkrA3z/Yt1c7R5xejt8qh84iU54yUWCtm0QwGJlDcf/gg4zd/x4mpLAlb/w==", + "version": "7.6.7", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.7.tgz", + "integrity": "sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==", "dev": true, "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.3.tgz", - "integrity": "sha512-ciwyCLeuRfxboZ4isgdNZi/tkt06m8Tw6uGbBSBgWrnnZGNXiEyM27xc/PjXGQLqlZ6ylbgHMnm7ccF9tCkOeQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, "dependencies": { "@babel/parser": "^7.1.0", @@ -3204,24 +3273,24 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.20.3", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.3.tgz", - "integrity": "sha512-Lsh766rGEFbaxMIDH7Qa+Yha8cMVI3qAK6CHt3OR0YfxOIn5Z54iHiyDRycHrBqeIiqGa20Kpsv1cavfBKkRSw==", + "version": "7.20.4", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz", + "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==", "dev": true, "dependencies": { "@babel/types": "^7.20.7" } }, "node_modules/@types/estree": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.4.tgz", - "integrity": "sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, "node_modules/@types/hast": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.7.tgz", - "integrity": "sha512-EVLigw5zInURhzfXUM65eixfadfsHKomGKUakToXo84t8gGIJuTcD2xooM2See7GyQ7DRtYjhCHnSUQez8JaLw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.8.tgz", + "integrity": "sha512-aMIqAlFd2wTIDZuvLbhUT+TGvMxrNC8ECUIVtH6xxy0sQLs3iu6NO8Kp/VT5je7i5ufnebXzdV1dNDMnvaH6IQ==", "dependencies": { "@types/unist": "^2" } @@ -3233,9 +3302,9 @@ "dev": true }, "node_modules/@types/hoist-non-react-statics": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.4.tgz", - "integrity": "sha512-ZchYkbieA+7tnxwX/SCBySx9WwvWR8TaP5tb2jRAzwvLb/rWchGw3v0w3pqUbUvj0GCwW2Xz/AVPSk6kUGctXQ==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", + "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", "dependencies": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" @@ -3247,9 +3316,9 @@ "integrity": "sha512-aLkWa0C0vO5b4Sr798E26QgOkss68Un0bLjs7u9qxzPT5CG+8DuNTffWES58YzJs3hrVAOs1wonycqEBqNJubA==" }, "node_modules/@types/json-schema": { - "version": "7.0.14", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, "node_modules/@types/json5": { @@ -3258,52 +3327,52 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" }, "node_modules/@types/lodash": { - "version": "4.14.200", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz", - "integrity": "sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==", + "version": "4.14.201", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.201.tgz", + "integrity": "sha512-y9euML0cim1JrykNxADLfaG0FgD1g/yTHwUs/Jg9ZIU7WKj2/4IW9Lbb1WZbvck78W/lfGXFfe+u2EGfIJXdLQ==", "dev": true }, "node_modules/@types/lodash-es": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.10.tgz", - "integrity": "sha512-YJP+w/2khSBwbUSFdGsSqmDvmnN3cCKoPOL7Zjle6s30ZtemkkqhjVfFqGwPN7ASil5VyjE2GtyU/yqYY6mC0A==", + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.11.tgz", + "integrity": "sha512-eCw8FYAWHt2DDl77s+AMLLzPn310LKohruumpucZI4oOFJkIgnlaJcy23OKMJxx4r9PeTF13Gv6w+jqjWQaYUg==", "dev": true, "dependencies": { "@types/lodash": "*" } }, "node_modules/@types/node": { - "version": "20.8.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", - "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", + "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/node-forge": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.8.tgz", - "integrity": "sha512-vGXshY9vim9CJjrpcS5raqSjEfKlJcWy2HNdgUasR66fAnVEYarrf1ULV4nfvpC1nZq/moA9qyqBcu83x+Jlrg==", + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.9.tgz", + "integrity": "sha512-meK88cx/sTalPSLSoCzkiUB4VPIFHmxtXm5FaaqRDqBX2i/Sy8bJ4odsan0b20RBjPh06dAQ+OTTdnyQyhJZyQ==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/parse-json": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.1.tgz", - "integrity": "sha512-3YmXzzPAdOTVljVMkTMBdBEvlOLg2cDQaDhnnhT3nT9uDbnJzjWhKlzb+desT12Y7tGqaN6d+AbozcKzyL36Ng==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==" }, "node_modules/@types/prop-types": { - "version": "15.7.9", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.9.tgz", - "integrity": "sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g==" + "version": "15.7.10", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.10.tgz", + "integrity": "sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==" }, "node_modules/@types/react": { - "version": "18.2.34", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.34.tgz", - "integrity": "sha512-U6eW/alrRk37FU/MS2RYMjx0Va2JGIVXELTODaTIYgvWGCV4Y4TfTUzG8DdmpDNIT0Xpj/R7GfyHOJJrDttcvg==", + "version": "18.2.37", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz", + "integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -3311,9 +3380,9 @@ } }, "node_modules/@types/react-datepicker": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/@types/react-datepicker/-/react-datepicker-4.19.1.tgz", - "integrity": "sha512-HV52yjxuRi49psAVuHTFXXr+RSrCbIFDn9ayei0YH8xVVAXCO+5GwHAGKeREAmNbneweN0ySGoByr90yJCAnrQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/@types/react-datepicker/-/react-datepicker-4.19.2.tgz", + "integrity": "sha512-Ta1YGrdK3PNWQjiilXly/ABjxsyjTHj4FoKlvhM4v2RC3aOM+m7xpr2fixjMIHEoS+108gt+sUBNGYGaXlxtfQ==", "dev": true, "dependencies": { "@popperjs/core": "^2.9.2", @@ -3323,27 +3392,27 @@ } }, "node_modules/@types/react-dom": { - "version": "18.2.14", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.14.tgz", - "integrity": "sha512-V835xgdSVmyQmI1KLV2BEIUgqEuinxp9O4G6g3FqO/SqLac049E53aysv0oEFD2kHfejeKU+ZqL2bcFWj9gLAQ==", + "version": "18.2.15", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.15.tgz", + "integrity": "sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==", "dev": true, "dependencies": { "@types/react": "*" } }, "node_modules/@types/react-highlight-words": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@types/react-highlight-words/-/react-highlight-words-0.16.6.tgz", - "integrity": "sha512-iGgne7Sf/vWfuOOWKURqj2LQwC8zBTZvNaw/uh9ZjwQfG40zfZKdkaE6387eWaDYjGdXQYPjUAhxjlaQhg4VYg==", + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@types/react-highlight-words/-/react-highlight-words-0.16.7.tgz", + "integrity": "sha512-+upXTIaRd3rGvh1aDQSs9z5X+sV3UM6Jrmjk03GN2GXl4v/+iOJKQj2LZHo6Vp2IoTvMdtxgME26feqo12xXLg==", "dev": true, "dependencies": { "@types/react": "*" } }, "node_modules/@types/react-redux": { - "version": "7.1.28", - "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.28.tgz", - "integrity": "sha512-EQr7cChVzVUuqbA+J8ArWK1H0hLAHKOs21SIMrskKZ3nHNeE+LFYA+IsoZGhVOT8Ktjn3M20v4rnZKN3fLbypw==", + "version": "7.1.30", + "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.30.tgz", + "integrity": "sha512-i2kqM6YaUwFKduamV6QM/uHbb0eCP8f8ZQ/0yWf+BsAVVsZPRYJ9eeGWZ3uxLfWwwA0SrPRMTPTqsPFkY3HZdA==", "dev": true, "dependencies": { "@types/hoist-non-react-statics": "^3.3.0", @@ -3374,52 +3443,52 @@ } }, "node_modules/@types/react-syntax-highlighter": { - "version": "15.5.9", - "resolved": "https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.9.tgz", - "integrity": "sha512-ven8zRSVMNkqt8ySJ2eEW5ugbfl/V/Z9S1c9UNhGqwkwVZNV5akk10rYDALxgwS25cLmN+/Q5UxlGj9CJmZ6Ew==", + "version": "15.5.10", + "resolved": "https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.10.tgz", + "integrity": "sha512-Vf8nNkGHnjwK37b2wDs92zJSAWS2Mb57NcYHgajCNssHeTNEixvjINnXJkKdY0V0/eLrYkPP1xDKvNmYIr4HIg==", "dev": true, "dependencies": { "@types/react": "*" } }, "node_modules/@types/react-transition-group": { - "version": "4.4.8", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.8.tgz", - "integrity": "sha512-QmQ22q+Pb+HQSn04NL3HtrqHwYMf4h3QKArOy5F8U5nEVMaihBs3SR10WiOM1iwPz5jIo8x/u11al+iEGZZrvg==", + "version": "4.4.9", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.9.tgz", + "integrity": "sha512-ZVNmWumUIh5NhH8aMD9CR2hdW0fNuYInlocZHaZ+dgk/1K49j1w/HoAuK1ki+pgscQrOFRTlXeoURtuzEkV3dg==", "dependencies": { "@types/react": "*" } }, "node_modules/@types/react-window": { - "version": "1.8.7", - "resolved": "https://registry.npmjs.org/@types/react-window/-/react-window-1.8.7.tgz", - "integrity": "sha512-FpPHEhmGVOBKomuR4LD2nvua1Ajcw6PfnfbDysuCwwPae3JNulcq3+uZIpQNbDN2AI1z+Y4tKj2xQ4ELiQ4QDw==", + "version": "1.8.8", + "resolved": "https://registry.npmjs.org/@types/react-window/-/react-window-1.8.8.tgz", + "integrity": "sha512-8Ls660bHR1AUA2kuRvVG9D/4XpRC6wjAaPT9dil7Ckc76eP9TKWZwwmgfq8Q1LANX3QNDnoU4Zp48A3w+zK69Q==", "dev": true, "dependencies": { "@types/react": "*" } }, "node_modules/@types/redux-actions": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/@types/redux-actions/-/redux-actions-2.6.4.tgz", - "integrity": "sha512-oXaibuxd4DOuWAz1W8Mbc18v9KDAi2Ex/pEv7Sml1CO2Xj1+cPYBR2esG/ioawXATBNhR0DXfFNHLPQsKB1wuQ==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/@types/redux-actions/-/redux-actions-2.6.5.tgz", + "integrity": "sha512-RgXOigay5cNweP+xH1ru+Vaaj1xXYLpWIfSVO8cSA8Ii2xvR+HRfWYdLe1UVOA8X0kIklalGOa0DTDyld0obkg==", "dev": true }, "node_modules/@types/scheduler": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.5.tgz", - "integrity": "sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==" + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.6.tgz", + "integrity": "sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA==" }, "node_modules/@types/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.5.tgz", + "integrity": "sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==", "dev": true }, "node_modules/@types/shimmer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.0.4.tgz", - "integrity": "sha512-hsughtxFsdJ9+Gxd/qH8zHE+KT6YEAxx9hJLoSXhxTBKHMQ2NMhN23fRJ75M9RRn2hDMNn13H3gS1EktA9VgDA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.0.5.tgz", + "integrity": "sha512-9Hp0ObzwwO57DpLFF0InUjUm/II8GmKAvzbefxQTihCb7KI6yc9yzf0nLc4mVdby5N4DRCgQM2wCup9KTieeww==" }, "node_modules/@types/sinonjs__fake-timers": { "version": "8.1.1", @@ -3428,20 +3497,20 @@ "dev": true }, "node_modules/@types/sizzle": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.5.tgz", - "integrity": "sha512-tAe4Q+OLFOA/AMD+0lq8ovp8t3ysxAOeaScnfNdZpUxaGl51ZMDEITxkvFl1STudQ58mz6gzVGl9VhMKhwRnZQ==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.6.tgz", + "integrity": "sha512-m04Om5Gz6kbjUwAQ7XJJQ30OdEFsSmAVsvn4NYwcTRyMVpKKa1aPuESw1n2CxS5fYkOQv3nHgDKeNa8e76fUkw==", "dev": true }, "node_modules/@types/stylis": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.2.tgz", - "integrity": "sha512-Rm17MsTpQQP5Jq4BF7CdrxJsDufoiL/q5IbJZYZmOZAJALyijgF7BzLgobXUqraNcQdqFYLYGeglDp6QzaxPpg==" + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.3.tgz", + "integrity": "sha512-86XLCVEmWagiUEbr2AjSbeY4qHN9jMm3pgM3PuBYfLIbT0MpDSnA3GA/4W7KoH/C/eeK77kNaeIxZzjhKYIBgw==" }, "node_modules/@types/unist": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.9.tgz", - "integrity": "sha512-zC0iXxAv1C1ERURduJueYzkzZ2zaGyc+P2c95hgkikHPr3z8EdUZOlgEQ5X0DRmwDZn+hekycQnoeiiRVrmilQ==" + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" }, "node_modules/@types/use-sync-external-store": { "version": "0.0.3", @@ -3450,9 +3519,9 @@ "dev": true }, "node_modules/@types/yauzl": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.2.tgz", - "integrity": "sha512-Km7XAtUIduROw7QPgvcft0lIupeG8a8rdKL8RiSyKvlE7dYY31fEn41HVuQsRFDuROA8tA4K2UVL+WdfFmErBA==", + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "dev": true, "optional": true, "dependencies": { @@ -3460,16 +3529,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.1.tgz", - "integrity": "sha512-w0tiiRc9I4S5XSXXrMHOWgHgxbrBn1Ro+PmiYhSg2ZVdxrAJtQgzU5o2m1BfP6UOn7Vxcc6152vFjQfmZR4xEg==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.10.0.tgz", + "integrity": "sha512-uoLj4g2OTL8rfUQVx2AFO1hp/zja1wABJq77P6IclQs6I/m9GLrm7jCdgzZkvWdDCQf1uEvoa8s8CupsgWQgVg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.1", - "@typescript-eslint/type-utils": "6.9.1", - "@typescript-eslint/utils": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1", + "@typescript-eslint/scope-manager": "6.10.0", + "@typescript-eslint/type-utils": "6.10.0", + "@typescript-eslint/utils": "6.10.0", + "@typescript-eslint/visitor-keys": "6.10.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -3528,15 +3597,15 @@ "dev": true }, "node_modules/@typescript-eslint/parser": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.1.tgz", - "integrity": "sha512-C7AK2wn43GSaCUZ9do6Ksgi2g3mwFkMO3Cis96kzmgudoVaKyt62yNzJOktP0HDLb/iO2O0n2lBOzJgr6Q/cyg==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.10.0.tgz", + "integrity": "sha512-+sZwIj+s+io9ozSxIWbNB5873OSdfeBEH/FR0re14WLI6BaKuSOnnwCJ2foUiu8uXf4dRp1UqHP0vrZ1zXGrog==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.9.1", - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/typescript-estree": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1", + "@typescript-eslint/scope-manager": "6.10.0", + "@typescript-eslint/types": "6.10.0", + "@typescript-eslint/typescript-estree": "6.10.0", + "@typescript-eslint/visitor-keys": "6.10.0", "debug": "^4.3.4" }, "engines": { @@ -3556,13 +3625,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.1.tgz", - "integrity": "sha512-38IxvKB6NAne3g/+MyXMs2Cda/Sz+CEpmm+KLGEM8hx/CvnSRuw51i8ukfwB/B/sESdeTGet1NH1Wj7I0YXswg==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.10.0.tgz", + "integrity": "sha512-TN/plV7dzqqC2iPNf1KrxozDgZs53Gfgg5ZHyw8erd6jd5Ta/JIEcdCheXFt9b1NYb93a1wmIIVW/2gLkombDg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1" + "@typescript-eslint/types": "6.10.0", + "@typescript-eslint/visitor-keys": "6.10.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3573,13 +3642,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.1.tgz", - "integrity": "sha512-eh2oHaUKCK58qIeYp19F5V5TbpM52680sB4zNSz29VBQPTWIlE/hCj5P5B1AChxECe/fmZlspAWFuRniep1Skg==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.10.0.tgz", + "integrity": "sha512-wYpPs3hgTFblMYwbYWPT3eZtaDOjbLyIYuqpwuLBBqhLiuvJ+9sEp2gNRJEtR5N/c9G1uTtQQL5AhV0fEPJYcg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.9.1", - "@typescript-eslint/utils": "6.9.1", + "@typescript-eslint/typescript-estree": "6.10.0", + "@typescript-eslint/utils": "6.10.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -3600,9 +3669,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.1.tgz", - "integrity": "sha512-BUGslGOb14zUHOUmDB2FfT6SI1CcZEJYfF3qFwBeUrU6srJfzANonwRYHDpLBuzbq3HaoF2XL2hcr01c8f8OaQ==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.10.0.tgz", + "integrity": "sha512-36Fq1PWh9dusgo3vH7qmQAj5/AZqARky1Wi6WpINxB6SkQdY5vQoT2/7rW7uBIsPDcvvGCLi4r10p0OJ7ITAeg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3613,13 +3682,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.1.tgz", - "integrity": "sha512-U+mUylTHfcqeO7mLWVQ5W/tMLXqVpRv61wm9ZtfE5egz7gtnmqVIw9ryh0mgIlkKk9rZLY3UHygsBSdB9/ftyw==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.10.0.tgz", + "integrity": "sha512-ek0Eyuy6P15LJVeghbWhSrBCj/vJpPXXR+EpaRZqou7achUWL8IdYnMSC5WHAeTWswYQuP2hAZgij/bC9fanBg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1", + "@typescript-eslint/types": "6.10.0", + "@typescript-eslint/visitor-keys": "6.10.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3673,17 +3742,17 @@ "dev": true }, "node_modules/@typescript-eslint/utils": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.1.tgz", - "integrity": "sha512-L1T0A5nFdQrMVunpZgzqPL6y2wVreSyHhKGZryS6jrEN7bD9NplVAyMryUhXsQ4TWLnZmxc2ekar/lSGIlprCA==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.10.0.tgz", + "integrity": "sha512-v+pJ1/RcVyRc0o4wAGux9x42RHmAjIGzPRo538Z8M1tVx6HOnoQBCX/NoadHQlZeC+QO2yr4nNSFWOoraZCAyg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.1", - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/typescript-estree": "6.9.1", + "@typescript-eslint/scope-manager": "6.10.0", + "@typescript-eslint/types": "6.10.0", + "@typescript-eslint/typescript-estree": "6.10.0", "semver": "^7.5.4" }, "engines": { @@ -3731,12 +3800,12 @@ "dev": true }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.1.tgz", - "integrity": "sha512-MUaPUe/QRLEffARsmNfmpghuQkW436DvESW+h+M52w0coICHRfD6Np9/K6PdACwnrq1HmuLl+cSPZaJmeVPkSw==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.10.0.tgz", + "integrity": "sha512-xMGluxQIEtOM7bqFCo+rCMh5fqI+ZxV5RUUOa29iVPz1OgCZrtc7rFnz5cLUazlkPKYqX+75iuDq7m0HQ48nCg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/types": "6.10.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -3753,15 +3822,15 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" }, "node_modules/@vitejs/plugin-react": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.1.0.tgz", - "integrity": "sha512-rM0SqazU9iqPUraQ2JlIvReeaxOoRj6n+PzB1C0cBzIbd8qP336nC39/R9yPi3wVcah7E7j/kdU1uCUqMEU4OQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.1.1.tgz", + "integrity": "sha512-Jie2HERK+uh27e+ORXXwEP5h0Y2lS9T2PRGbfebiHGlwzDO0dEnd2aNtOR/qjBlPb1YgxwAONeblL1xqLikLag==", "dev": true, "dependencies": { - "@babel/core": "^7.22.20", + "@babel/core": "^7.23.2", "@babel/plugin-transform-react-jsx-self": "^7.22.5", "@babel/plugin-transform-react-jsx-source": "^7.22.5", - "@types/babel__core": "^7.20.2", + "@types/babel__core": "^7.20.3", "react-refresh": "^0.14.0" }, "engines": { @@ -4152,9 +4221,9 @@ } }, "node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", "dev": true }, "node_modules/asynciterator.prototype": { @@ -4502,9 +4571,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001559", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", - "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", + "version": "1.0.30001561", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz", + "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==", "funding": [ { "type": "opencollective", @@ -5125,9 +5194,9 @@ } }, "node_modules/cypress/node_modules/@types/node": { - "version": "18.18.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.8.tgz", - "integrity": "sha512-OLGBaaK5V3VRBS1bAkMVP2/W9B+H8meUfl866OrMNQqt7wDgdpWPp5o6gmIc9pB+lIQHSq4ZL8ypeH1vPxcPaQ==", + "version": "18.18.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", + "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -5671,9 +5740,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.574", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.574.tgz", - "integrity": "sha512-bg1m8L0n02xRzx4LsTTMbBPiUd9yIR+74iPtS/Ao65CuXvhVZHP0ym1kSdDG3yHFDXqHQQBKujlN1AQ8qZnyFg==" + "version": "1.4.578", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.578.tgz", + "integrity": "sha512-V0ZhSu1BQZKfG0yNEL6Dadzik8E1vAzfpVOapdSiT9F6yapEJ3Bk+4tZ4SMPdWiUchCgnM/ByYtBzp5ntzDMIA==" }, "node_modules/emoji-regex": { "version": "9.2.2", @@ -5919,14 +5988,14 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.53.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz", + "integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.53.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -6597,9 +6666,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -9097,9 +9166,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", @@ -9585,9 +9654,9 @@ } }, "node_modules/pdfjs-dist": { - "version": "3.11.174", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz", - "integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==", + "version": "4.0.189", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.0.189.tgz", + "integrity": "sha512-5IWbLRJjQJhk3cu3nNFAvIYoSzT8xRYlRkFCIV1tn7hK1eq9H+6vOP0ytJhZz9YI35IXlu33uQspvmYO6Oir4g==", "engines": { "node": ">=18" }, @@ -9919,9 +9988,9 @@ } }, "node_modules/rc-util": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.38.0.tgz", - "integrity": "sha512-yV/YBNdFn+edyBpBdCqkPE29Su0jWcHNgwx2dJbRqMrMfrUcMJUjCRV+ZPhcvWyKFJ63GzEerPrz9JIVo0zXmA==", + "version": "5.38.1", + "resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.38.1.tgz", + "integrity": "sha512-e4ZMs7q9XqwTuhIK7zBIVFltUtMSjphuPPQXHoHlzRzNdOwUxDejo0Zls5HYaJfRKNURcsS/ceKVULlhjBrxng==", "dependencies": { "@babel/runtime": "^7.18.3", "react-is": "^18.2.0" @@ -10180,6 +10249,19 @@ "node": ">=6" } }, + "node_modules/react-pdf/node_modules/pdfjs-dist": { + "version": "3.11.174", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz", + "integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "canvas": "^2.11.2", + "path2d-polyfill": "^2.0.1" + } + }, "node_modules/react-popper": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-2.3.0.tgz", @@ -10291,9 +10373,9 @@ } }, "node_modules/react-select": { - "version": "5.7.7", - "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.7.7.tgz", - "integrity": "sha512-HhashZZJDRlfF/AKj0a0Lnfs3sRdw/46VJIRd8IbB9/Ovr74+ZIwkAdSBjSPXsFMG+u72c5xShqwLSKIJllzqw==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.0.tgz", + "integrity": "sha512-TfjLDo58XrhP6VG5M/Mi56Us0Yt8X7xD6cDybC7yoRMUNm7BGO7qk8J0TLQOua/prb8vUOtsfnXZwfm30HGsAA==", "dependencies": { "@babel/runtime": "^7.12.0", "@emotion/cache": "^11.4.0", @@ -11332,9 +11414,9 @@ } }, "node_modules/start-server-and-test": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.1.tgz", - "integrity": "sha512-8PFo4DLLLCDMuS51/BEEtE1m9CAXw1LNVtZSS1PzkYQh6Qf9JUwM4huYeSoUumaaoAyuwYBwCa9OsrcpMqcOdQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.2.tgz", + "integrity": "sha512-4sGS2QmETUwqeBUqtTLP7OqXp3PdDnevaWlPlrFQgn8+7uCgVg4Do7/H/ZhAAVyvnL3DqKyANhnLgcgxrjhrMA==", "dev": true, "dependencies": { "arg": "^5.0.2", @@ -11344,7 +11426,7 @@ "execa": "5.1.1", "lazy-ass": "1.6.0", "ps-tree": "1.2.0", - "wait-on": "7.0.1" + "wait-on": "7.1.0" }, "bin": { "server-test": "src/bin/start.js", @@ -11573,9 +11655,9 @@ } }, "node_modules/styled-components": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.0.tgz", - "integrity": "sha512-VWNfYYBuXzuLS/QYEeoPgMErP26WL+dX9//rEh80B2mmlS1yRxRxuL5eax4m6ybYEUoHWlTy2XOU32767mlMkg==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.1.tgz", + "integrity": "sha512-cpZZP5RrKRIClBW5Eby4JM1wElLVP4NQrJbJ0h10TidTyJf4SIIwa3zLXOoPb4gJi8MsJ8mjq5mu2IrEhZIAcQ==", "dependencies": { "@emotion/is-prop-valid": "^1.2.1", "@emotion/unitless": "^0.8.0", @@ -12408,16 +12490,16 @@ } }, "node_modules/wait-on": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.0.1.tgz", - "integrity": "sha512-9AnJE9qTjRQOlTZIldAaf/da2eW0eSRSgcqq85mXQja/DW3MriHxkpODDSUEg+Gri/rKEcXUZHe+cevvYItaog==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.1.0.tgz", + "integrity": "sha512-U7TF/OYYzAg+OoiT/B8opvN48UHt0QYMi4aD3PjRFpybQ+o6czQF8Ig3SKCCMJdxpBrCalIJ4O00FBof27Fu9Q==", "dev": true, "dependencies": { "axios": "^0.27.2", - "joi": "^17.7.0", + "joi": "^17.11.0", "lodash": "^4.17.21", - "minimist": "^1.2.7", - "rxjs": "^7.8.0" + "minimist": "^1.2.8", + "rxjs": "^7.8.1" }, "bin": { "wait-on": "bin/wait-on" diff --git a/apps/dolly-frontend/src/main/js/package.json b/apps/dolly-frontend/src/main/js/package.json index 03cc2b3f0fd..441eeafe249 100644 --- a/apps/dolly-frontend/src/main/js/package.json +++ b/apps/dolly-frontend/src/main/js/package.json @@ -1,6 +1,6 @@ { "name": "dolly", - "version": "2.5.33", + "version": "2.5.34", "description": "", "main": "index.js", "scripts": { @@ -34,7 +34,7 @@ "immer": "^10.0.1", "lodash": "^4.17.21", "lodash.throttle": "^4.1.1", - "pdfjs-dist": "^3.0.279", + "pdfjs-dist": "^4.0.189", "prop-types": "^15.8.1", "rc-progress": "^3.4.0", "rc-tooltip": "^6.0.1", diff --git a/apps/dolly-frontend/src/main/js/src/components/bestilling/statusListe/BestillingResultat/BestillingResultat.tsx b/apps/dolly-frontend/src/main/js/src/components/bestilling/statusListe/BestillingResultat/BestillingResultat.tsx index 32bc80e3422..c1190d11990 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestilling/statusListe/BestillingResultat/BestillingResultat.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestilling/statusListe/BestillingResultat/BestillingResultat.tsx @@ -72,7 +72,7 @@ export default function BestillingResultat({ label="Hvordan var din opplevelse med bruk av Dolly?" feedbackFor="Bruk av Dolly etter bestilling" /> - {bestilling.ferdig && !bestillingHarFeil(bestilling) && ( + {bestilling.ferdig && !bestilling.stoppet && !bestillingHarFeil(bestilling) && (
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx index ebeed941622..493147e4ebe 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/ameldingForm.tsx @@ -212,7 +212,7 @@ export const AmeldingForm = ({ warningMessage }: AmeldingFormProps): JSX.Element name={`aareg[0].arbeidsforholdstype`} label="Type arbeidsforhold" kodeverk={ArbeidKodeverk.Arbeidsforholdstyper} - size="large-plus" + size="xlarge" isClearable={false} onChange={handleArbeidsforholdstypeChange} value={arbeidsforholdstype} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdForm.tsx index 86a568a430b..728cbbf2516 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/aareg/form/partials/arbeidsforholdForm.tsx @@ -278,7 +278,7 @@ export const ArbeidsforholdForm = ({ name={`${path}.arbeidsforholdstype`} label="Type arbeidsforhold" kodeverk={ArbeidKodeverk.Arbeidsforholdstyper} - size="large-plus" + size="xlarge" isClearable={false} onChange={handleArbeidsforholdstypeChange} feil={feilmelding()} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/initialValues.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/initialValues.tsx index ace1c67aef0..86f1f349d4c 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/initialValues.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/arbeidsplassen/form/initialValues.tsx @@ -31,16 +31,16 @@ export const initialJobboenskerVerdier = { ], locations: [ { - location: 'Lørenskog', - code: 'NO02.0230', + location: 'Hamar', + code: 'NO04.0403', }, { - location: 'Oslo', - code: 'NO03', + location: 'Råde', + code: 'NO30.3017', }, { - location: 'Fredrikstad', - code: 'NO01.0106', + location: 'Vestby', + code: 'NO02.0211', }, ], occupationTypes: ['FAST', 'PROSJEKT', 'FERIEJOBB'], diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/NorskBankkonto.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/NorskBankkonto.tsx index 4632bc29cf3..ac00ac2d134 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/NorskBankkonto.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/NorskBankkonto.tsx @@ -33,7 +33,7 @@ export const NorskBankkonto = ({ formikBag }: { formikBag: FormikProps<{}> }) => diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/UtenlandskBankkonto.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/UtenlandskBankkonto.tsx index 1e088825ee7..1f955ff4169 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/UtenlandskBankkonto.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/bankkonto/form/UtenlandskBankkonto.tsx @@ -30,6 +30,7 @@ export const UtenlandskBankkonto = ({ formikBag }: any) => { swift = 'BANK' + mappedLandkode + '11222' } formikBag.setFieldValue(`${path}.swift`, swift, false) + formikBag.setFieldTouched(`${path}.swift`, true) } } @@ -46,7 +47,7 @@ export const UtenlandskBankkonto = ({ formikBag }: any) => { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/Form.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/Form.tsx index 84f13c9e249..ccae46b0791 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/Form.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/Form.tsx @@ -6,12 +6,13 @@ import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import Panel from '@/components/ui/panel/Panel' import { erForsteEllerTest, panelError } from '@/components/ui/form/formUtils' import { EnheterForm } from './partials/enheterForm' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' export const brregAttributt = 'brregstub' export const BrregstubForm = ({ formikBag }) => { const understatuser = SelectOptionsOppslag.hentUnderstatusFraBrregstub() - const understatuserOptions = SelectOptionsOppslag.formatOptions('understatuser', understatuser) + const understatuserOptions = SelectOptionsFormat.formatOptions('understatuser', understatuser) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx index 412dc6410c4..8f965cbc29a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/brregstub/form/partials/enheterForm.tsx @@ -5,6 +5,7 @@ import { FormikSelect } from '@/components/ui/form/inputs/select/Select' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { PersonrollerForm } from '@/components/fagsystem/brregstub/form/partials/personrollerForm' import { OrgnrToggle } from '@/components/fagsystem/brregstub/form/partials/orgnrToggle' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' const initialValues = { rolle: '', @@ -18,7 +19,7 @@ const initialValues = { export const EnheterForm = ({ formikBag }) => { const roller = SelectOptionsOppslag.hentRollerFraBrregstub() - const rollerOptions = SelectOptionsOppslag.formatOptions('roller', roller) + const rollerOptions = SelectOptionsFormat.formatOptions('roller', roller) const setEnhetsinfo = (org, path) => { const currentValues = _.get(formikBag.values, path) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/dokarkiv/visning/Visning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/dokarkiv/visning/Visning.tsx index 4afbfabb318..b5e19eb5d1b 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/dokarkiv/visning/Visning.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/dokarkiv/visning/Visning.tsx @@ -4,6 +4,7 @@ import { MiljoTabs } from '@/components/ui/miljoTabs/MiljoTabs' import { useBestilteMiljoer } from '@/utils/hooks/useBestilling' import Loading from '@/components/ui/loading/Loading' import { Journalpost } from '@/service/services/JoarkDokumentService' +import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' interface Form { data?: Array @@ -16,14 +17,20 @@ type MiljoDataListe = { data: Array } -type DokarkivTypes = { - data?: Journalpost - miljo?: string -} - -const Dokarkiv = ({ data, miljo }: DokarkivTypes) => { - if (!data) return null - return +const Dokarkiv = ({ data, miljo }: MiljoDataListe) => { + if (!data || data?.length < 1) { + return null + } + if (data.length === 1) { + return + } + return ( + + {(dokument: Journalpost) => { + return + }} + + ) } export default ({ data, bestillingIdListe, loading, tilgjengeligMiljoe }: Form) => { @@ -42,8 +49,26 @@ export default ({ data, bestillingIdListe, loading, tilgjengeligMiljoe }: Form) const forsteMiljo = data.find((miljoData) => miljoData?.data)?.miljo + const mergeData = () => { + const mergeMiljo = [] + data.forEach((item) => { + const indexOfMiljo = mergeMiljo.findIndex((dok) => dok?.miljo === item?.miljo) + if (indexOfMiljo >= 0) { + mergeMiljo[indexOfMiljo].data?.push(item.data) + } else { + mergeMiljo.push({ + data: item.data && [item.data], + miljo: item.miljo, + }) + } + }) + return mergeMiljo + } + + const mergedData = mergeData() + const filteredData = - tilgjengeligMiljoe && data.filter((item) => item.miljo === tilgjengeligMiljoe) + tilgjengeligMiljoe && mergedData?.filter((item) => item?.miljo === tilgjengeligMiljoe) return ( <> @@ -52,7 +77,7 @@ export default ({ data, bestillingIdListe, loading, tilgjengeligMiljoe }: Form) bestilteMiljoer={bestilteMiljoer} errorMiljoer={errorMiljoer} forsteMiljo={forsteMiljo} - data={filteredData || data} + data={filteredData || mergedData} > diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/Visning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/Visning.tsx index 32e9163ed9d..eca3124d6cd 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/Visning.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/Visning.tsx @@ -1,123 +1,125 @@ import * as _ from 'lodash-es' -import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' import SubOverskrift from '@/components/ui/subOverskrift/SubOverskrift' import { Bestilling, BestillingData, Inntekt, - TransaksjonId, } from '@/components/fagsystem/inntektsmelding/InntektsmeldingTypes' import { EnkelInntektsmeldingVisning } from './partials/enkelInntektsmeldingVisning' -import { DollyApi } from '@/service/Api' import { erGyldig } from '@/components/transaksjonid/GyldigeBestillinger' -import JoarkDokumentService, { - Dokument, - Journalpost, -} from '@/service/services/JoarkDokumentService' -import LoadableComponentWithRetry from '@/components/ui/loading/LoadableComponentWithRetry' -import Panel from '@/components/ui/panel/Panel' +import { useBestilteMiljoer } from '@/utils/hooks/useBestilling' +import Loading from '@/components/ui/loading/Loading' +import React from 'react' +import { Alert } from '@navikt/ds-react' +import { MiljoTabs } from '@/components/ui/miljoTabs/MiljoTabs' interface InntektsmeldingVisningProps { liste: Array ident: string } -export const InntektsmeldingVisning = ({ liste, ident }: InntektsmeldingVisningProps) => { - //Viser data fra bestillingen - if (!liste || liste.length < 1) { +export const sjekkManglerInntektsmeldingData = (inntektsmeldingData) => { + return ( + !inntektsmeldingData || + inntektsmeldingData?.length < 1 || + inntektsmeldingData?.every((miljoData) => !miljoData.data) + ) +} + +export const sjekkManglerInntektsmeldingBestilling = (inntektsmeldingBestilling) => { + return !inntektsmeldingBestilling || inntektsmeldingBestilling?.length < 1 +} + +export const InntektsmeldingVisning = ({ + data, + loading, + bestillingIdListe, + tilgjengeligMiljoe, + bestillinger, +}: InntektsmeldingVisningProps) => { + const { bestilteMiljoer } = useBestilteMiljoer(bestillingIdListe, 'INNTKMELD') + + if (loading) { + return + } + + if (!data && !bestillinger) { return null } - const getDokumenter = (bestilling: TransaksjonId): Promise => { - const journalpostId = - bestilling.transaksjonId.dokument?.journalpostId || bestilling.transaksjonId.journalpostId - return JoarkDokumentService.hentJournalpost(journalpostId, bestilling.miljoe).then( - (journalpost: Journalpost) => { - return Promise.all( - journalpost.dokumenter.map((document: Dokument) => - JoarkDokumentService.hentDokument( - journalpostId, - document.dokumentInfoId, - bestilling.miljoe, - 'ORIGINAL', - ).then((dokument: string) => ({ - journalpostId, - dokumentInfoId: document.dokumentInfoId, - dokument, - })), - ), - ) - }, - ) + const manglerFagsystemData = + sjekkManglerInntektsmeldingData(data) && sjekkManglerInntektsmeldingBestilling(bestillinger) + + const miljoerMedData = data?.map((miljoData) => miljoData.data && miljoData.miljo) + const errorMiljoer = bestilteMiljoer?.filter((miljo) => !miljoerMedData?.includes(miljo)) + + const forsteMiljo = data?.find((miljoData) => miljoData?.data)?.miljo + + const harTransaksjonsidData = data?.every((inntekt) => inntekt?.data?.request) + + const setTransaksjonsidData = () => { + return data.map((miljo) => { + const request = miljo?.data?.request + const dokument = miljo?.data?.dokument + return { + data: { + dokument: dokument ? dokument : miljo.data, + request: request + ? request + : { + inntekter: bestillinger?.flatMap( + (bestilling) => bestilling?.data.inntektsmelding.inntekter, + ), + miljoe: miljo.miljo, + }, + }, + miljo: miljo.miljo, + } + }) } - return ( - - DollyApi.getTransaksjonid('INNTKMELD', ident) - .then(({ data }: { data: Array }) => { - if (!data) { - return null - } - return data.map((bestilling: TransaksjonId) => { - return getDokumenter(bestilling).then((response) => { - if (response) { - return { - bestillingId: bestilling.bestillingId, - miljoe: bestilling.miljoe, - dokumenter: response, - } - } - }) - }) - }) - .then((data: Array>) => { - return Promise.all(data) - }) + if (!harTransaksjonsidData) { + data = setTransaksjonsidData() + } + + const mergeData = () => { + const mergeMiljo = [] + data.forEach((item) => { + const indexOfMiljo = mergeMiljo.findIndex((inntekt) => inntekt?.miljo === item?.miljo) + if (indexOfMiljo >= 0) { + mergeMiljo[indexOfMiljo].data?.push(item.data) + } else { + mergeMiljo.push({ + data: [item.data], + miljo: item.miljo, + }) } - render={(data: Array) => { - if (data && data.length > 0) { - const gyldigeBestillinger = liste.filter((bestilling) => - data.find((x) => (x && x.bestillingId ? x.bestillingId === bestilling.id : x)), - ) - - if (gyldigeBestillinger && gyldigeBestillinger.length > 0) { - return ( - <> - - {data.length > 5 ? ( - // @ts-ignore - - - {(inntekter: BestillingData) => ( - - )} - - - ) : ( - - {(inntekter: BestillingData) => ( - - )} - - )} - - ) - } - } - }} - label="Laster inntektsmelding data" - /> + }) + return mergeMiljo + } + const mergetData = mergeData() + + const filteredData = + tilgjengeligMiljoe && mergetData?.filter((item) => item?.miljo === tilgjengeligMiljoe) + + return ( + <> + + {manglerFagsystemData ? ( + + Fant ikke inntektsmelding-data på person + + ) : ( + + + + )} + ) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/enkelInntektsmeldingVisning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/enkelInntektsmeldingVisning.tsx index 36531cb1873..b8bfa86deb5 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/enkelInntektsmeldingVisning.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/enkelInntektsmeldingVisning.tsx @@ -10,25 +10,27 @@ import NaturalytelseVisning from './naturalytelseVisning' import { EnkelInntektsmelding, Inntekt, - Journalpost, } from '@/components/fagsystem/inntektsmelding/InntektsmeldingTypes' import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary' import { PersonVisningContent } from '@/components/fagsystem/inntektsmelding/visning/partials/personVisningContent' const getHeader = (data: Inntekt) => { - const arbeidsgiver = data.arbeidsgiver - ? data.arbeidsgiver.virksomhetsnummer - : data.arbeidsgiverPrivat - ? data.arbeidsgiverPrivat.arbeidsgiverFnr + const inntekt = data?.request?.inntekter?.[0] + if (!inntekt) { + return 'Inntekt' + } + const arbeidsgiver = inntekt.arbeidsgiver + ? inntekt.arbeidsgiver?.virksomhetsnummer + : inntekt.arbeidsgiverPrivat + ? inntekt.arbeidsgiverPrivat?.arbeidsgiverFnr : '' return `Inntekt (${arbeidsgiver})` } -export const EnkelInntektsmeldingVisning = ({ bestilling, data }: EnkelInntektsmelding) => { - // Sjekk om bestillingid i bestilling er i data - const journalpostidPaaBestilling = data.filter( - (id) => id.bestillingId === bestilling.id || !id.bestillingId - ) +export const EnkelInntektsmeldingVisning = ({ data }: EnkelInntektsmelding) => { + if (!data) { + return null + } return ( <> @@ -36,59 +38,66 @@ export const EnkelInntektsmeldingVisning = ({ bestilling, data }: EnkelInntektsm 1} + data={data} + expandable={data?.length > 3} + whiteBackground > - {(inntekt: Inntekt, idx: number) => ( - <> -
- - - - - { + const inntekt = inntektsmelding?.request?.inntekter?.[0] + if (!inntekt) { + return null + } + return ( + <> +
+ + + + + + + + +
+ + + + + + - - - -
- - - - - - - - - )} -
- - - - {(id: Journalpost, idx: number) => } + + ) + }} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/personVisningContent.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/personVisningContent.tsx index 97426a3a566..51e8551eef4 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/personVisningContent.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektsmelding/visning/partials/personVisningContent.tsx @@ -1,28 +1,70 @@ import { TitleValue } from '@/components/ui/titleValue/TitleValue' import Button from '@/components/ui/button/Button' import { CodeView } from '@/components/codeView' - import useBoolean from '@/utils/hooks/useBoolean' import { Journalpost } from '@/components/fagsystem/inntektsmelding/InntektsmeldingTypes' +import styled from 'styled-components' +import { useDokument } from '@/utils/hooks/useJoarkDokument' +import { Alert } from '@navikt/ds-react' interface PersonVisningContentProps { id: Journalpost idx: number } -export const PersonVisningContent = ({ id, idx }: PersonVisningContentProps) => { +const StyledJournalpost = styled.div` + background-color: #f7f7f7; + position: relative; + padding: 10px; + border-radius: 4px; + width: 100%; + + && { + h4 { + margin-top: 0px; + } + } + + &&& { + button { + position: absolute; + right: 23px; + top: 60px; + } + } +` + +export const PersonVisningContent = ({ miljoe, dokumentInfo }: PersonVisningContentProps) => { const [viserSkjemainnhold, vis, skjul] = useBoolean(false) - return ( -
- - - + const { dokument, loading, error } = useDokument( + dokumentInfo?.journalpostId, + dokumentInfo?.dokumentInfoId, + miljoe, + 'ORIGINAL', + ) - - {viserSkjemainnhold && } -
+ return ( + +

Journalpost-ID

+
+ + + +
+ {viserSkjemainnhold && + (dokument ? ( + + ) : ( + + Kunne ikke hente skjemainnhold + + ))} +
) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/inntektsinformasjonLister/arbeidsforholdForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/inntektsinformasjonLister/arbeidsforholdForm.tsx index e9e37e2c237..0c6f526fd13 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/inntektsinformasjonLister/arbeidsforholdForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/inntektstub/form/partials/inntektsinformasjonLister/arbeidsforholdForm.tsx @@ -6,6 +6,7 @@ import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Se import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { ArbeidKodeverk } from '@/config/kodeverk' import React from 'react' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' const initialValues = { arbeidsforholdstype: '', @@ -22,9 +23,9 @@ const initialValues = { export const ArbeidsforholdForm = ({ formikBag, inntektsinformasjonPath }) => { const arbeidsforholdstyper = SelectOptionsOppslag.hentArbeidsforholdstyperInntektstub() - const arbeidsforholdstyperFormatted = SelectOptionsOppslag.formatOptions( + const arbeidsforholdstyperFormatted = SelectOptionsFormat.formatOptions( 'arbeidsforholdstyper', - arbeidsforholdstyper + arbeidsforholdstyper, ) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/Form.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/Form.tsx index 97c9aeb68b6..1d7ce242d3c 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/Form.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/krrstub/form/Form.tsx @@ -11,6 +11,7 @@ import { erForsteEllerTest, panelError } from '@/components/ui/form/formUtils' import { Kategori } from '@/components/ui/form/kategori/Kategori' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { FormikProps } from 'formik' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' type KrrstubFormProps = { formikBag: FormikProps<{}> @@ -25,7 +26,7 @@ export const krrAttributt = 'krrstub' export const KrrstubForm = ({ formikBag }: KrrstubFormProps) => { const leverandoerer = SelectOptionsOppslag.hentKrrLeverandoerer() //@ts-ignore - const leverandoerOptions = SelectOptionsOppslag.formatOptions('sdpLeverandoer', leverandoerer) + const leverandoerOptions = SelectOptionsFormat.formatOptions('sdpLeverandoer', leverandoerer) const registrert = _.get(formikBag, 'values.krrstub.registrert') const handleRegistrertChange = (newRegistrert: Change) => { @@ -114,7 +115,7 @@ KrrstubForm.validation = { krrstub: Yup.object({ epost: Yup.string(), gyldigFra: Yup.date().nullable(), - mobil: Yup.string().matches(/^\d*$/, 'Ugyldig mobilnummer'), + mobil: Yup.string().matches(/^\+?\d*$/, 'Ugyldig mobilnummer'), sdpAdresse: Yup.string(), sdpLeverandoer: Yup.string().nullable(), spraak: Yup.string(), diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx index fe7ef703eed..76028a19bb3 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx @@ -23,9 +23,9 @@ import { FormikProps } from 'formik' import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' interface BostedsadresseValues { formikBag: FormikProps<{}> @@ -124,7 +124,7 @@ export const BostedsadresseForm = ({ } const { navnInfo, loading } = useGenererNavn() - const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) + const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx index 710a2d25d91..56e5d3faff9 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx @@ -11,9 +11,9 @@ import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFiel import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Select' import { SelectOptionsManager as Options } from '@/service/SelectOptions' import { - VegadresseVelger, - UtenlandskAdresse, Postboksadresse, + UtenlandskAdresse, + VegadresseVelger, } from '@/components/fagsystem/pdlf/form/partials/adresser/adressetyper' import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' @@ -21,8 +21,8 @@ import { FormikProps } from 'formik' import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' interface KontaktadresseValues { formikBag: FormikProps<{}> @@ -91,7 +91,7 @@ export const KontaktadresseForm = ({ formikBag, path, idx }: KontaktadresseFormV } const { navnInfo, loading } = useGenererNavn() - const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) + const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx index 1d9facd075a..b5c16a9df50 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx @@ -12,10 +12,10 @@ import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFiel import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Select' import { SelectOptionsManager as Options } from '@/service/SelectOptions' import { - VegadresseVelger, - UtenlandskAdresse, - OppholdAnnetSted, MatrikkeladresseVelger, + OppholdAnnetSted, + UtenlandskAdresse, + VegadresseVelger, } from '@/components/fagsystem/pdlf/form/partials/adresser/adressetyper' import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' @@ -23,8 +23,8 @@ import { FormikProps } from 'formik' import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' interface OppholdsadresseValues { formikBag: FormikProps<{}> @@ -112,7 +112,7 @@ export const OppholdsadresseForm = ({ formikBag, path, idx }: OppholdsadresseFor } const { navnInfo, loading } = useGenererNavn() - const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) + const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx index fe55137d11a..48291166104 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx @@ -10,6 +10,7 @@ import { FormikProps } from 'formik' import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils' import * as _ from 'lodash-es' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' interface FullmaktProps { formikBag: FormikProps<{}> @@ -19,7 +20,7 @@ interface FullmaktProps { export const FullmaktForm = ({ formikBag, path, eksisterendeNyPerson = null }: FullmaktProps) => { const fullmaktOmraader = SelectOptionsOppslag.hentFullmaktOmraader() - const fullmaktOptions = SelectOptionsOppslag.formatOptions('fullmaktOmraader', fullmaktOmraader) + const fullmaktOptions = SelectOptionsFormat.formatOptions('fullmaktOmraader', fullmaktOmraader) return (
diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx index 89dd4ab513a..19361de3e94 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx @@ -4,16 +4,16 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions' import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Select' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' import { getPlaceholder, setNavn } from '../../utils' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' import { initialFalskIdentitetValues } from '@/components/fagsystem/pdlf/form/initialValues' import { PdlEksisterendePerson } from '@/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' export const FalskIdentitet = ({ formikBag }) => { - const { navnInfo , loading} = useGenererNavn() - const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) + const { navnInfo, loading } = useGenererNavn() + const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo) const settIdentitetType = (e, path, advancedValues) => { if (!e) { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx index 0ad05cbbbe9..ca4fa5bc947 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Kontakt.tsx @@ -2,7 +2,6 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions' import { Kategori } from '@/components/ui/form/kategori/Kategori' import { DollySelect, FormikSelect } from '@/components/ui/form/inputs/select/Select' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { getPlaceholder, setNavn } from '../utils' import * as _ from 'lodash-es' import { @@ -17,6 +16,7 @@ import { PdlEksisterendePerson } from '@/components/fagsystem/pdlf/form/partials import { useEffect } from 'react' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' interface KontaktValues { formikBag: FormikProps @@ -59,7 +59,7 @@ export const Kontakt = ({ formikBag, path, eksisterendeNyPerson = null }: Kontak } const { navnInfo, loading } = useGenererNavn() - const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) + const navnOptions = SelectOptionsFormat.formatOptions('personnavn', navnInfo) useEffect(() => { if (!_.get(formikBag.values, `${path}.kontaktType`)) { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx index 4906f2a45a4..67910233152 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx @@ -2,7 +2,7 @@ import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFiel import { initialNavn } from '@/components/fagsystem/pdlf/form/initialValues' import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' import { FormikCheckbox } from '@/components/ui/form/inputs/checbox/Checkbox' -import { Option, SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' +import { Option } from '@/service/SelectOptionsOppslag' import { FormikSelect } from '@/components/ui/form/inputs/select/Select' import * as _ from 'lodash-es' import { FormikProps } from 'formik' @@ -14,6 +14,7 @@ import styled from 'styled-components' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' type NavnTypes = { formikBag: FormikProps<{}> @@ -28,7 +29,7 @@ const concatNavnMedTidligereValgt = (type, navnInfo, selectedNavn) => { if (!navnInfo) { return [] } - const navnOptions = SelectOptionsOppslag.formatOptions(type, navnInfo) + const navnOptions = SelectOptionsFormat.formatOptions(type, navnInfo) .concat( selectedNavn?.map((navn) => ({ value: navn, diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx index f55940cb8e0..053cd859dd4 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx @@ -3,10 +3,10 @@ import { SelectOptionsManager as Options } from '@/service/SelectOptions' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' import { AdresseKodeverk } from '@/config/kodeverk' import * as React from 'react' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { FormikProps } from 'formik' import * as _ from 'lodash-es' import { useGenererNavn } from '@/utils/hooks/useGenererNavn' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' interface PdlPersonUtenIdentifikatorValues { formikBag: FormikProps<{}> @@ -19,11 +19,11 @@ export const PdlPersonUtenIdentifikator = ({ }: PdlPersonUtenIdentifikatorValues) => { const { navnInfo, loading } = useGenererNavn() //@ts-ignore - const fornavnOptions = SelectOptionsOppslag.formatOptions('fornavn', navnInfo) + const fornavnOptions = SelectOptionsFormat.formatOptions('fornavn', navnInfo) //@ts-ignore - const mellomnavnOptions = SelectOptionsOppslag.formatOptions('mellomnavn', navnInfo) + const mellomnavnOptions = SelectOptionsFormat.formatOptions('mellomnavn', navnInfo) //@ts-ignore - const etternavnOptions = SelectOptionsOppslag.formatOptions('etternavn', navnInfo) + const etternavnOptions = SelectOptionsFormat.formatOptions('etternavn', navnInfo) const { fornavn, mellomnavn, etternavn } = _.get(formikBag?.values, `${path}.navn`) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx index b8abb8774c7..23a92ce1800 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sigrunstub/form/partials/enkeltinntektForm.tsx @@ -19,7 +19,7 @@ export const EnkeltinntektForm = ({ const { kodeverk: tekniskNavnOptions } = useKodeverk(SigrunKodeverk[tjeneste]) const getFilteredTekniskNavnOptions = () => { - return tekniskNavnOptions?.koder?.filter((item) => { + return tekniskNavnOptions?.filter((item) => { return getYear(new Date(item?.gyldigFra)) <= inntektsaar }) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx index 464a9478002..5e1da51496e 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/sykdom/form/partials/DetaljertSykemelding.tsx @@ -73,7 +73,7 @@ export const DetaljertSykemelding = ({ formikBag }: SykemeldingForm) => { } const { kodeverk: yrker } = useKodeverk(ArbeidKodeverk.Yrker) - const randomYrke = getRandomValue(yrker?.koder) + const randomYrke = getRandomValue(yrker) useEffect(() => { const yrkePath = 'sykemelding.detaljertSykemelding.arbeidsgiver.yrkesbetegnelse' diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx index c7fb579746b..a210c2fef8a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/background/Background.tsx @@ -28,23 +28,27 @@ const day = new Date().getDate() const weekDay = new Date().getDay() const isHalloween = (month === 9 && day > 14) || (month === 10 && day === 0) +const isSpring = month >= 2 && month <= 4 +const isSummer = month >= 5 && month <= 7 +const isFall = month >= 8 && month <= 10 const isWinter = month === 0 || month === 1 const isChristmas = month === 11 const isEaster = (month === 2 && day > 21) || (month === 3 && day === 1) +const isFaarikaal = month === 8 && day > 23 && weekDay === 4 const DefaultBackground = styled.div` background-image: url(${() => { if (isEaster) { return Paaske - } else if (month >= 2 && month <= 4) { + } else if (isSpring) { return Spring - } else if (month >= 5 && month <= 7) { + } else if (isSummer) { return Sommer } else if (isHalloween) { return Halloween - } else if (month === 8 && day > 23 && weekDay === 4) { + } else if (isFaarikaal) { return Faarikaal - } else if (month >= 8 && month <= 10) { + } else if (isFall) { return Fall } else if (isWinter) { return Winter diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx index f309537c574..1e2bca94783 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/button/Tags/TagsButton.tsx @@ -10,6 +10,7 @@ import { DollySelect } from '@/components/ui/form/inputs/select/Select' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { REGEX_BACKEND_GRUPPER, useMatchMutate } from '@/utils/hooks/useMutate' import { Alert } from '@navikt/ds-react' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' type Props = { action: Function @@ -28,7 +29,7 @@ export const TagsButton = ({ action, loading, gruppeId, eksisterendeTags }: Prop } const tagsFraDolly = SelectOptionsOppslag.hentTagsFraDolly() - const tagOptions = SelectOptionsOppslag.formatOptions('tags', tagsFraDolly) + const tagOptions = SelectOptionsFormat.formatOptions('tags', tagsFraDolly) return ( diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx index 41dc0641606..4b050f002e8 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx @@ -75,17 +75,21 @@ export const DollyFaBlokk = ({ children, showDeleteButton, number, -}) => ( -
-
- -

{header}

- {hjelpetekst && {hjelpetekst}} - {showDeleteButton && } + whiteBackground, +}) => { + const className = whiteBackground ? 'dfa-blokk-white' : 'dfa-blokk' + return ( +
+
+ +

{header}

+ {hjelpetekst && {hjelpetekst}} + {showDeleteButton && } +
+
{children}
-
{children}
-
-) + ) +} export const DollyFaBlokkOrg = ({ header, @@ -177,6 +181,7 @@ export const DollyFieldArray = ({ idx={idx} getHeader={getHeader ? getHeader : () => header} data={curr} + whiteBackground={whiteBackground} > {children(curr, idx)} @@ -188,6 +193,7 @@ export const DollyFieldArray = ({ idx={idx} header={getHeader ? getHeader(curr) : header} hjelpetekst={hjelpetekst} + whiteBackground={whiteBackground} > {children(curr, idx)} diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx index 60270de503a..2eacce5084b 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx @@ -22,12 +22,14 @@ export default function ExpandableBlokk({ idx, children, data, + whiteBackground, }: ExpandableBlokkProps) { const [isExpanded, setIsExpanded] = useState(false) - const headerClass = cn('dfa-blokk_header', { clickable: true }) + const className = whiteBackground ? 'dfa-blokk-white' : 'dfa-blokk' + const headerClass = cn(`${className}_header`, { clickable: true }) return ( -
+
setIsExpanded(!isExpanded)}>

{getHeader(data)}

@@ -37,7 +39,7 @@ export default function ExpandableBlokk({ onClick={() => setIsExpanded(!isExpanded)} />
- {isExpanded &&
{children}
} + {isExpanded &&
{children}
}
) } diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less index 5077a093e89..e252132f936 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/dollyFieldArray.less @@ -46,6 +46,16 @@ .dfa-header-og-content(); } +.dfa-blokk-white { + padding: 0 10px 10px; + margin-bottom: 10px; + width: 100%; + border-left: 2px solid @blokk_border; + background-color: @blokk_bg; + background-color: white; + .dfa-header-og-content(); +} + .dfa-blokk-org-odd { padding: 0 10px 10px; margin-bottom: 10px; diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx index 5adf5d7d8c2..69b75febb4a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx @@ -5,11 +5,11 @@ import { Vis } from '@/components/bestillingsveileder/VisAttributt' import { Label } from '@/components/ui/form/inputs/label/Label' import { InputWrapper } from '@/components/ui/form/inputWrapper/InputWrapper' import { fieldError, SyntEvent } from '@/components/ui/form/formUtils' -import KodeverkConnector from '@/components/kodeverk/KodeverkConnector' import './Select.less' import MenuList from '@/components/ui/form/inputs/select/MenuList' import Option from '@/components/ui/form/inputs/select/Option' import * as _ from 'lodash-es' +import { useKodeverk } from '@/utils/hooks/useKodeverk' type SelectProps = { id?: string @@ -55,8 +55,8 @@ export const Select = ({ ...rest }: SelectProps) => { let _value = isMulti - ? options.filter((o) => value?.some((el) => el === o.value)) - : options.filter((o) => o.value === value) + ? options?.filter?.((o) => value?.some((el) => el === o.value)) + : options?.filter?.((o) => o.value === value) return ( { + const { kodeverk: kodeverkResult, loading } = useKodeverk(kodeverk) const getSortedKodeverk = (kodeverkVerdier) => { if (label === 'Bostedskommune') { const kodeverkClone = _.cloneDeep(kodeverkVerdier) @@ -97,15 +98,11 @@ export const SelectMedKodeverk = ({ kodeverk, label, isLoading, ...rest }: Selec } return ( - - {(kodeverkVerdier) => ( - ) } diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx index cbb06dca827..91bb662d817 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/miljoTabs/MiljoTabs.tsx @@ -1,7 +1,6 @@ import { Alert, Tabs } from '@navikt/ds-react' import styled from 'styled-components' import React, { useState } from 'react' -import { random } from 'lodash' const StyledTabs = styled(Tabs)` margin-top: -10px; @@ -36,11 +35,11 @@ export const MiljoTabs = ({ bestilteMiljoer, errorMiljoer = [], forsteMiljo, dat return ( - {data.map((miljoData) => { + {data.map((miljoData, idx: number) => { if (errorMiljoer?.includes(miljoData?.miljo)) { return ( @@ -49,7 +48,7 @@ export const MiljoTabs = ({ bestilteMiljoer, errorMiljoer = [], forsteMiljo, dat if (bestilteMiljoer?.includes(miljoData?.miljo)) { return ( @@ -57,15 +56,15 @@ export const MiljoTabs = ({ bestilteMiljoer, errorMiljoer = [], forsteMiljo, dat } return ( ) })} - {data.map((miljoData) => ( - + {data.map((miljoData, idx: number) => ( + {!miljoData?.data || miljoData?.data?.length < 1 || miljoData?.data?.inntekter?.length === 0 ? ( diff --git a/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx b/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx index a132075ee13..16b41647051 100644 --- a/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx +++ b/apps/dolly-frontend/src/main/js/src/ducks/bestillingStatus/index.tsx @@ -14,7 +14,7 @@ export const { gjenopprettOrganisasjonBestilling: DollyApi.gjenopprettOrganisasjonBestilling, }, 'removeNyBestillingStatus', - { prefix: 'bestillingStatus' } + { prefix: 'bestillingStatus' }, ) // Henter alle bestillinger som er gjort på en ident diff --git a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx index 40ee93de4b1..4a4046f3abb 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonVisning/PersonVisning.tsx @@ -56,6 +56,7 @@ import { harArenaBestilling, harDokarkivBestilling, harHistarkBestilling, + harInntektsmeldingBestilling, harInstBestilling, harMedlBestilling, harPoppBestilling, @@ -135,6 +136,9 @@ export default ({ harAaregBestilling(bestillingerFagsystemer) || ident?.master === 'PDL', ) + const visArbeidsforhold = + ident?.master !== 'PDL' || arbeidsforhold?.some((miljodata) => miljodata?.data?.length > 0) + const { loading: loadingAmelding, ameldinger } = useAmeldinger( ident.ident, harAaregBestilling(bestillingerFagsystemer) || ident?.master === 'PDL', @@ -150,9 +154,6 @@ export default ({ harUdistubBestilling(bestillingerFagsystemer) || ident?.master === 'PDL', ) - const visArbeidsforhold = - ident?.master !== 'PDL' || arbeidsforhold?.some((miljodata) => miljodata?.data?.length > 0) - const { loading: loadingTpData, tpData } = useTpData( ident.ident, harTpBestilling(bestillingerFagsystemer), @@ -215,6 +216,17 @@ export default ({ const sykemeldingBestilling = SykemeldingVisning.filterValues(bestillingListe, ident.ident) + const { loading: loadingInntektsmeldingData, data: inntektsmeldingData } = useTransaksjonIdData( + ident.ident, + 'INNTKMELD', + harInntektsmeldingBestilling(bestillingerFagsystemer), + ) + + const inntektsmeldingBestilling = InntektsmeldingVisning.filterValues( + bestillingListe, + ident.ident, + ) + const getGruppeIdenter = () => { return useAsync(async () => DollyApi.getGruppeById(gruppeId), [DollyApi.getGruppeById]) } @@ -421,8 +433,13 @@ export default ({ /> + foreldreansvar: Array +} +export const SelectOptionsFormat = { + formatOptions: (type: string, data: any, loading?: boolean) => { + if (loading || data?.loading) { + return [] + } + if (!data?.value && _.isEmpty(data)) { + console.error('Fant ingen kodeverk for type: ' + type) + return [] + } + const kodeverk = data?.value?.data || data + if (type === 'personnavn') { + const persondata: any[] = kodeverk || [] + const options: Option[] = [] + persondata?.length > 0 && + persondata.forEach((personInfo) => { + if (!_.isNil(personInfo.fornavn)) { + const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : '' + const navn = personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn + options.push({ value: personInfo.fornavn.toUpperCase(), label: navn.toUpperCase() }) + } + }) + return options + } else if (type === 'fornavn' || type === 'mellomnavn' || type === 'etternavn') { + const navnData = kodeverk || [] + const options: { value: string; label: string }[] = [] + navnData?.length > 0 && + navnData.forEach((navn: { [x: string]: any }) => { + options.push({ value: navn[type], label: navn[type] }) + }) + return options + } else if (type === 'navnOgFnr') { + const persondata = kodeverk.liste || kodeverk || [] + const options: Option[] = [] + persondata?.length > 0 && + persondata.forEach( + (personInfo: { fornavn: string; mellomnavn: string; etternavn: string; fnr: string }) => { + if (!_.isNil(personInfo.fornavn)) { + const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : '' + const navnOgFnr = + (personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn).toUpperCase() + + ': ' + + personInfo.fnr + options.push({ value: personInfo.fnr, label: navnOgFnr }) + } + }, + ) + return options + } else if (type === 'arbeidsforholdstyper') { + const options = kodeverk || [] + options?.length > 0 && + options.forEach((option: Option) => { + if (option.value === 'frilanserOppdragstakerHonorarPersonerMm') { + option.label = 'Frilansere/oppdragstakere, honorar, m.m.' + } + if (option.value === 'pensjonOgAndreTyperYtelserUtenAnsettelsesforhold') { + option.label = 'Pensjoner og andre typer ytelser uten ansettelsesforhold' + } + }) + return options + } else if (type === 'understatuser') { + const statuser = kodeverk ? Object.entries(kodeverk) : [] + const options: Option[] = [] + statuser.forEach((status) => { + options.push({ value: parseInt(status[0]), label: `${status[0]}: ${status[1]}` }) + }) + return options + } else if (type === 'roller') { + const roller = kodeverk ? Object.entries(kodeverk) : [] + const options: Option[] = [] + roller.forEach((rolle: [string, string]) => { + options.push({ value: rolle[0], label: rolle[1] }) + }) + return options + } else if (type === 'sdpLeverandoer') { + const leverandoerer = kodeverk ? Object.entries(kodeverk) : [] + const options: Option[] = [] + leverandoerer.forEach((leverandoer: [string, any]) => { + data = leverandoer[1] + options.push({ value: parseInt(data.id), label: data.navn }) + }) + return options + } else if (type === 'tags') { + const tags = kodeverk ? Object.entries(kodeverk) : [] + const options: Option[] = [] + tags.forEach((leverandoer) => { + data = leverandoer[1] + options.push({ value: data.tag, label: data.beskrivelse }) + }) + return options + } else if (type === 'fullmaktOmraader') { + const omraader = kodeverk ? Object.entries(kodeverk?.koder) : [] + const ugyldigeKoder = ['BII', 'KLA', 'KNA', 'KOM', 'LGA', 'MOT', 'OVR'] + const options: Option[] = [] + options.push({ value: '*', label: '* (Alle)' }) + omraader + .filter((omr: [string, Option]) => { + return !ugyldigeKoder.includes(omr[1].value) + }) + .forEach((omraade: [string, Data]) => { + data = omraade[1] + options.push({ value: data.value, label: data.label }) + }) + return options + } else { + return kodeverk + } + }, +} diff --git a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx index a176a657156..3f331ac34a1 100644 --- a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx @@ -1,7 +1,6 @@ import { useAsync } from 'react-use' import { BrregstubApi, DollyApi, KrrApi, PdlforvalterApi } from '@/service/Api' import Api from '@/api' -import * as _ from 'lodash-es' import { Person, PersonData } from '@/components/fagsystem/pdlf/PdlTypes' import { getAlder } from '@/ducks/fagsystem' @@ -107,107 +106,4 @@ export const SelectOptionsOppslag = { hentTagsFraDolly: () => { return useAsync(async () => DollyApi.getTags(), [DollyApi.getTags]) }, - - formatOptions: (type: string, data: any) => { - if (!data?.value) { - if (!data?.loading) { - console.error('Fant ingen kodeverk for type: ' + type) - } - return [] - } - if (type === 'personnavn') { - const persondata: any[] = data?.value?.data || [] - const options: Option[] = [] - persondata?.length > 0 && - persondata.forEach((personInfo) => { - if (!_.isNil(personInfo.fornavn)) { - const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : '' - const navn = personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn - options.push({ value: personInfo.fornavn.toUpperCase(), label: navn.toUpperCase() }) - } - }) - return options - } else if (type === 'fornavn' || type === 'mellomnavn' || type === 'etternavn') { - const navnData = data?.value?.data || [] - const options: { value: string; label: string }[] = [] - navnData?.length > 0 && - navnData.forEach((navn: { [x: string]: any }) => { - options.push({ value: navn[type], label: navn[type] }) - }) - return options - } else if (type === 'navnOgFnr') { - const persondata = data.value && data.value.data ? data.value.data.liste : [] - const options: Option[] = [] - persondata?.length > 0 && - persondata.forEach( - (personInfo: { fornavn: string; mellomnavn: string; etternavn: string; fnr: string }) => { - if (!_.isNil(personInfo.fornavn)) { - const mellomnavn = !_.isNil(personInfo.mellomnavn) ? ' ' + personInfo.mellomnavn : '' - const navnOgFnr = - (personInfo.fornavn + mellomnavn + ' ' + personInfo.etternavn).toUpperCase() + - ': ' + - personInfo.fnr - options.push({ value: personInfo.fnr, label: navnOgFnr }) - } - }, - ) - return options - } else if (type === 'arbeidsforholdstyper') { - const options = data.value ? data.value.data.koder : [] - options?.length > 0 && - options.forEach((option: Option) => { - if (option.value === 'frilanserOppdragstakerHonorarPersonerMm') { - option.label = 'Frilansere/oppdragstakere, honorar, m.m.' - } - if (option.value === 'pensjonOgAndreTyperYtelserUtenAnsettelsesforhold') { - option.label = 'Pensjoner og andre typer ytelser uten ansettelsesforhold' - } - }) - return options - } else if (type === 'understatuser') { - const statuser = data.value ? Object.entries(data.value.data) : [] - const options: Option[] = [] - statuser.forEach((status) => { - options.push({ value: parseInt(status[0]), label: `${status[0]}: ${status[1]}` }) - }) - return options - } else if (type === 'roller') { - const roller = data.value ? Object.entries(data.value.data) : [] - const options: Option[] = [] - roller.forEach((rolle: [string, string]) => { - options.push({ value: rolle[0], label: rolle[1] }) - }) - return options - } else if (type === 'sdpLeverandoer') { - const leverandoerer = data.value ? Object.entries(data.value.data) : [] - const options: Option[] = [] - leverandoerer.forEach((leverandoer: [string, any]) => { - data = leverandoer[1] - options.push({ value: parseInt(data.id), label: data.navn }) - }) - return options - } else if (type === 'tags') { - const tags = data.value ? Object.entries(data.value.data) : [] - const options: Option[] = [] - tags.forEach((leverandoer) => { - data = leverandoer[1] - options.push({ value: data.tag, label: data.beskrivelse }) - }) - return options - } else if (type === 'fullmaktOmraader') { - const omraader = data.value ? Object.entries(data.value.data.koder) : [] - const ugyldigeKoder = ['BII', 'KLA', 'KNA', 'KOM', 'LGA', 'MOT', 'OVR'] - const options: Option[] = [] - options.push({ value: '*', label: '* (Alle)' }) - omraader - .filter((omr: [string, Option]) => { - return !ugyldigeKoder.includes(omr[1].value) - }) - .forEach((omraade: [string, Data]) => { - data = omraade[1] - options.push({ value: data.value, label: data.label }) - }) - return options - } - }, } diff --git a/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx b/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx index 7cb33b185a5..0f234175a55 100644 --- a/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/services/dolly/Utils.tsx @@ -1,5 +1,10 @@ +import * as _ from 'lodash' + // Specialbehov for modifisering og sortering av kodeverk export const SortKodeverkArray = (data) => { + if (!data || _.isEmpty(data.koder)) { + return [] + } const kodeverk = data.koder if (data.name === 'Språk') { const spesKoder = ['ES', 'EN', 'NN', 'NB'] @@ -75,21 +80,6 @@ export const SortKodeverkArray = (data) => { spesKoder.map((yrke) => kodeverk.unshift(yrke)) } - if (data.name === 'Arbeidsforholdstyper') { - // Kodeverket for arbeidsforholdstyper har en type som AAREG per i dag ikke støtter - return kodeverk - .filter((kode) => kode.value !== 'pensjonOgAndreTyperYtelserUtenAnsettelsesforhold') - .map((kode) => { - if (kode.value === 'frilanserOppdragstakerHonorarPersonerMm') { - return { - ...kode, - label: 'Frilansere/oppdragstakere, honorar, m.m.', - } - } - return kode - }) - } - if (data.name === 'Landkoder') { // Filtrerer bort land som har begrenset gyldighet. Fjernes hvis det oppstår behov for test med nye land. const spesKoder = [ diff --git a/apps/dolly-frontend/src/main/js/src/styles/main.less b/apps/dolly-frontend/src/main/js/src/styles/main.less index c935edfebae..316a854e399 100644 --- a/apps/dolly-frontend/src/main/js/src/styles/main.less +++ b/apps/dolly-frontend/src/main/js/src/styles/main.less @@ -60,6 +60,10 @@ a { margin-bottom: 6px; } +.navds-checkbox--medium > .navds-checkbox__input + .navds-checkbox__label > .navds-checkbox__icon { + margin-top: 2px; +} + .navds-checkboxes { margin-bottom: 1rem; } diff --git a/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx b/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx index 54b8bb7a6fb..f4cc3c24426 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx @@ -188,7 +188,7 @@ export const showLabel = (optionsGruppe, value) => { optionsGruppe.includes('barn') && (copyOptionsGruppe = optionsGruppe.replace('barn_', '')) const obj = Options(copyOptionsGruppe).filter( - (options) => options.value.toUpperCase() === value.toUpperCase() + (options) => options.value.toUpperCase() === value.toUpperCase(), ) if (_.get(obj, 'label') || _.get(obj, '[0].label')) { @@ -209,7 +209,7 @@ export const showKodeverkLabel = (kodeverkNavn, value) => { if (loading || error) { return value } - return kodeverk?.koder?.find((kode) => kode?.value === value)?.label + return kodeverk?.find((kode) => kode?.value === value)?.label } export const getYearRangeOptions = (start, stop) => { diff --git a/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx b/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx index 3d59400a674..dbef5048242 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/SjekkBestillingFagsystem.tsx @@ -127,3 +127,13 @@ export const harSykemeldingBestilling = (bestillingerFagsystemer) => { }) return sykemelding } + +export const harInntektsmeldingBestilling = (bestillingerFagsystemer) => { + let inntektsmelding = false + bestillingerFagsystemer?.forEach((i) => { + if (i.inntektsmelding) { + inntektsmelding = true + } + }) + return inntektsmelding +} diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx index 7ec19fc9802..4d1d05906e1 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useFagsystemer.tsx @@ -40,17 +40,28 @@ const arenaUrl = (miljoer) => miljo: miljoe, })) -const journalpostUrl = (transaksjonsid, miljoer) => - miljoer?.map((miljoe) => { - const journalpostId = transaksjonsid?.find((id) => id.miljoe === miljoe)?.transaksjonId - ?.journalpostId - return { - url: journalpostId - ? `/testnav-joark-dokument-service/api/v2/journalpost/${journalpostId}` - : null, - miljo: miljoe, +const journalpostUrl = (transaksjonsid, miljoer) => { + const urlListe = [] + miljoer.forEach((miljoe) => { + const journalpostId = transaksjonsid + ?.filter((id) => id.miljoe === miljoe) + ?.map((filtrertId) => filtrertId?.transaksjonId?.journalpostId) + if (journalpostId && journalpostId?.length > 0) { + journalpostId?.forEach((journalpost) => { + urlListe.push({ + url: `/testnav-joark-dokument-service/api/v2/journalpost/${journalpost}`, + miljo: miljoe, + }) + }) + } else { + urlListe.push({ + url: null, + miljo: miljoe, + }) } }) + return urlListe +} const histarkUrl = (transaksjonsid: string) => transaksjonsid ? `/testnav-histark-proxy/api/saksmapper/${transaksjonsid}` : null diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useJoarkDokument.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useJoarkDokument.tsx new file mode 100644 index 00000000000..bfa10665899 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useJoarkDokument.tsx @@ -0,0 +1,26 @@ +import useSWR from 'swr' +import { fetcher } from '@/api' + +const joarkUrl = '/testnav-joark-dokument-service/api/v2/journalpost/' + +export const useDokument = ( + journalpostId: number, + dokumentInfoId: number, + miljo: string, + dokumentType: string, +) => { + const { data, isLoading, error } = useSWR( + [ + journalpostId && dokumentInfoId && dokumentType + ? `${joarkUrl}${journalpostId}/dokumenter/${dokumentInfoId}?dokumentType=${dokumentType}` + : null, + { miljo: miljo }, + ], + ([url, headers]) => fetcher(url, headers), + ) + return { + dokument: data, + loading: isLoading, + error: error, + } +} diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx index c18f7707c8e..03e403aa774 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useKodeverk.tsx @@ -1,25 +1,50 @@ import useSWR from 'swr' import { fetcher } from '@/api' +import * as _ from 'lodash' +import { toLower } from 'lodash' +import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' +import { SortKodeverkArray } from '@/service/services/dolly/Utils' type KodeverkListe = { koder: Array + land?: string + landkode?: string + valuta?: string + valutakode?: string } type KodeverkType = { - label: string - value: string + label?: string + value?: string } -const getKodeverkUrl = (kodeverkNavn) => `/dolly-backend/api/v1/kodeverk/${kodeverkNavn}` +const getKodeverkUrl = (kodeverkNavn) => + kodeverkNavn.includes('Valuta') + ? `/testnav-kontoregister-person-proxy/api/system/v1/hent-valutakoder` + : `/dolly-backend/api/v1/kodeverk/${kodeverkNavn}` export const useKodeverk = (kodeverkNavn) => { const { data, isLoading, error } = useSWR( - getKodeverkUrl(kodeverkNavn), - fetcher + [ + getKodeverkUrl(kodeverkNavn), + { accept: 'application/json', 'Content-Type': 'application/json' }, + ], + ([url, headers]) => fetcher(url, headers), ) + const koder = + (_.isArray(data) && + data[0]?.valutakode && + data.map((kode) => ({ + label: kode.valuta + ` (${kode.valutakode})`, + value: kode.valutakode, + }))) || + _.cloneDeep(data?.koder) + + const kodeverkSortert = SortKodeverkArray({ koder: koder, name: kodeverkNavn }) + return { - kodeverk: data, + kodeverk: SelectOptionsFormat.formatOptions(toLower(kodeverkNavn), kodeverkSortert, isLoading), loading: isLoading, error: error, } diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx index 37ae1faaaad..af278d04f0b 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useTransaksjonsid.tsx @@ -23,7 +23,7 @@ export const useTransaksjonsid = (system, ident, bestillingsid = null) => { const { data, isLoading, error } = useSWR( getTransaksjonsidUrl(system, ident, bestillingsid), - fetcher + fetcher, ) return { diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java index 389734bd344..3687476c9d4 100644 --- a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java +++ b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/EndringsmeldingFrontendApplicationStarter.java @@ -1,8 +1,7 @@ package no.nav.testnav.apps.endringsmeldingfrontend; import lombok.RequiredArgsConstructor; -import no.nav.testnav.apps.endringsmeldingfrontend.credentials.EndringsmeldingServiceProperties; -import no.nav.testnav.apps.endringsmeldingfrontend.credentials.ProfilApiServiceProperties; +import no.nav.testnav.apps.endringsmeldingfrontend.config.Consumers; import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig; import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory; @@ -32,24 +31,15 @@ @RequiredArgsConstructor public class EndringsmeldingFrontendApplicationStarter { - private final EndringsmeldingServiceProperties endringsmeldingServiceProperties; - private final ProfilApiServiceProperties profilApiServiceProperties; + private final Consumers consumers; private final TokenExchange tokenExchange; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { return builder .routes() - .route(createRoute( - "endringsmelding-service", - endringsmeldingServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(endringsmeldingServiceProperties) - )) - .route(createRoute( - "testnorge-profil-api", - profilApiServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(profilApiServiceProperties) - )) + .route(createRoute(consumers.getEndringsmeldingService())) + .route(createRoute(consumers.getTestnorgeProfilApi())) .build(); } @@ -66,7 +56,10 @@ private GatewayFilter addAuthenticationHeaderFilterFrom(ServerProperties serverP }); } - private Function> createRoute(String segment, String host, GatewayFilter filter) { + private Function> createRoute(ServerProperties serverProperties) { + var segment = serverProperties.getName(); + var host = serverProperties.getUrl(); + var filter = addAuthenticationHeaderFilterFrom(serverProperties); return spec -> spec .path("/" + segment + "/**") .filters(filterSpec -> filterSpec @@ -74,4 +67,5 @@ private Function> createRoute(String segment, St .filter(filter) ).uri(host); } + } \ No newline at end of file diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/config/Consumers.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/config/Consumers.java new file mode 100644 index 00000000000..a9e4219a8bd --- /dev/null +++ b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.testnav.apps.endringsmeldingfrontend.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties endringsmeldingService; + private ServerProperties testnorgeProfilApi; + +} diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/EndringsmeldingServiceProperties.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/EndringsmeldingServiceProperties.java deleted file mode 100644 index 7a17f8e230e..00000000000 --- a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/EndringsmeldingServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.endringsmeldingfrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.endringsmelding-service") -public class EndringsmeldingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/ProfilApiServiceProperties.java b/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/ProfilApiServiceProperties.java deleted file mode 100644 index 904251d09c8..00000000000 --- a/apps/endringsmelding-frontend/src/main/java/no/nav/testnav/apps/endringsmeldingfrontend/credentials/ProfilApiServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.endringsmeldingfrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-profil-api") -public class ProfilApiServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/Consumers.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/Consumers.java new file mode 100644 index 00000000000..0b633903ee0 --- /dev/null +++ b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.testnav.endringsmeldingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties tpsForvalterenProxy; + private ServerProperties tpsMessagingService; + +} diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsForvalterenProxyServiceProperties.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsForvalterenProxyServiceProperties.java deleted file mode 100644 index ab57ecdd23a..00000000000 --- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsForvalterenProxyServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.endringsmeldingservice.config.credentias; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.tps-forvalteren-proxy") -public class TpsForvalterenProxyServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsMessagingServiceProperties.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsMessagingServiceProperties.java deleted file mode 100644 index 6122e2dc0ba..00000000000 --- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/config/credentias/TpsMessagingServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.endringsmeldingservice.config.credentias; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.tps-messaging-service") -public class TpsMessagingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java index 6ca5ce7490d..c35e4f060e6 100644 --- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java +++ b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsForvalterConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.endringsmeldingservice.consumer; import com.fasterxml.jackson.databind.ObjectMapper; -import no.nav.testnav.endringsmeldingservice.config.credentias.TpsForvalterenProxyServiceProperties; +import no.nav.testnav.endringsmeldingservice.config.Consumers; import no.nav.testnav.endringsmeldingservice.consumer.command.SendDoedsmeldingCommand; import no.nav.testnav.endringsmeldingservice.consumer.command.SendFoedselsmeldingCommand; import no.nav.testnav.endringsmeldingservice.consumer.dto.DoedsmeldingDTO; @@ -27,11 +27,11 @@ public class TpsForvalterConsumer { private final TokenExchange accessTokenService; public TpsForvalterConsumer( - TpsForvalterenProxyServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange, ObjectMapper objectMapper) { - this.serverProperties = serverProperties; + serverProperties = consumers.getTpsForvalterenProxy(); this.accessTokenService = tokenExchange; ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() diff --git a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java index 303dcad5d2d..dbed99e80e6 100644 --- a/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java +++ b/apps/endringsmelding-service/src/main/java/no/nav/testnav/endringsmeldingservice/consumer/TpsMessagingConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.endringsmeldingservice.consumer; import com.fasterxml.jackson.databind.ObjectMapper; -import no.nav.testnav.endringsmeldingservice.config.credentias.TpsMessagingServiceProperties; +import no.nav.testnav.endringsmeldingservice.config.Consumers; import no.nav.testnav.endringsmeldingservice.consumer.command.GetIdentEnvironmentsCommand; import no.nav.testnav.libs.data.tpsmessagingservice.v1.PersonMiljoeDTO; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; @@ -21,11 +21,11 @@ public class TpsMessagingConsumer { private final TokenExchange accessTokenService; public TpsMessagingConsumer( - TpsMessagingServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange, ObjectMapper objectMapper) { - this.serverProperties = serverProperties; + serverProperties = consumers.getTpsMessagingService(); this.accessTokenService = tokenExchange; ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java index cc6f50d6253..dc508c8cdaa 100644 --- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java +++ b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/FasteDataFrontendApplicationStarter.java @@ -2,11 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.fastedatafrontend.credentials.OrganisasjonFasteDataServiceProperties; -import no.nav.testnav.apps.fastedatafrontend.credentials.OrganisasjonServiceProperties; -import no.nav.testnav.apps.fastedatafrontend.credentials.PersonFasteDataServiceProperties; -import no.nav.testnav.apps.fastedatafrontend.credentials.PersonServiceProperties; -import no.nav.testnav.apps.fastedatafrontend.credentials.ProfilApiServiceProperties; +import no.nav.testnav.apps.fastedatafrontend.config.Consumers; import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig; import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory; @@ -37,42 +33,18 @@ @RequiredArgsConstructor public class FasteDataFrontendApplicationStarter { - private final ProfilApiServiceProperties profilApiServiceProperties; - private final OrganisasjonServiceProperties organisasjonServiceProperties; - private final OrganisasjonFasteDataServiceProperties organisasjonFasteDataServiceProperties; - private final PersonServiceProperties personServiceProperties; - private final PersonFasteDataServiceProperties personFasteDataServiceProperties; + private final Consumers consumers; private final TokenExchange tokenExchange; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { return builder .routes() - .route(createRoute( - "testnav-organisasjon-service", - organisasjonServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(organisasjonServiceProperties) - )) - .route(createRoute( - "testnav-organisasjon-faste-data-service", - organisasjonFasteDataServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(organisasjonFasteDataServiceProperties) - )) - .route(createRoute( - "testnorge-profil-api", - profilApiServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(profilApiServiceProperties) - )) - .route(createRoute( - "testnav-person-service", - personServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(personServiceProperties) - )) - .route(createRoute( - "testnav-person-faste-data-service", - personFasteDataServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(personFasteDataServiceProperties) - )) + .route(createRoute(consumers.getTestnavOrganisasjonService())) + .route(createRoute(consumers.getTestnavOrganisasjonFasteDataService())) + .route(createRoute(consumers.getTestnorgeProfilApi())) + .route(createRoute(consumers.getTestnavPersonService())) + .route(createRoute(consumers.getTestnavPersonFasteDataService())) .build(); } @@ -89,7 +61,10 @@ private GatewayFilter addAuthenticationHeaderFilterFrom(ServerProperties serverP }); } - private Function> createRoute(String segment, String host, GatewayFilter filter) { + private Function> createRoute(ServerProperties serverProperties) { + var segment = serverProperties.getName(); + var host = serverProperties.getUrl(); + var filter = addAuthenticationHeaderFilterFrom(serverProperties); log.info("Redirect fra segment {} til host {}.", segment, host); return spec -> spec .path("/" + segment + "/**") @@ -98,4 +73,5 @@ private Function> createRoute(String segment, St .filter(filter) ).uri(host); } + } diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/config/Consumers.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/config/Consumers.java new file mode 100644 index 00000000000..0e6992cc464 --- /dev/null +++ b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/config/Consumers.java @@ -0,0 +1,33 @@ +package no.nav.testnav.apps.fastedatafrontend.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavOrganisasjonFasteDataService; + private ServerProperties testnavOrganisasjonService; + private ServerProperties testnavPersonFasteDataService; + private ServerProperties testnavPersonService; + private ServerProperties testnorgeProfilApi; + +} diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/OrganisasjonFasteDataServiceProperties.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/OrganisasjonFasteDataServiceProperties.java deleted file mode 100644 index 4447d1f762a..00000000000 --- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/OrganisasjonFasteDataServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.fastedatafrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-faste-data-service") -public class OrganisasjonFasteDataServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/OrganisasjonServiceProperties.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index 16e5d4799c1..00000000000 --- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.fastedatafrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/PersonFasteDataServiceProperties.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/PersonFasteDataServiceProperties.java deleted file mode 100644 index 004bf30795c..00000000000 --- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/PersonFasteDataServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.fastedatafrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-faste-data-service") -public class PersonFasteDataServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/PersonServiceProperties.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/PersonServiceProperties.java deleted file mode 100644 index 5c0cc18ea90..00000000000 --- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/PersonServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.fastedatafrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-service") -public class PersonServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/ProfilApiServiceProperties.java b/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/ProfilApiServiceProperties.java deleted file mode 100644 index adec4b144b9..00000000000 --- a/apps/faste-data-frontend/src/main/java/no/nav/testnav/apps/fastedatafrontend/credentials/ProfilApiServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.fastedatafrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-profil-api") -public class ProfilApiServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/config/Consumers.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/config/Consumers.java new file mode 100644 index 00000000000..52a558dc3f0 --- /dev/null +++ b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/config/Consumers.java @@ -0,0 +1,33 @@ +package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavGenererOrganisasjonPopulasjonService; + private ServerProperties testnavHodejegerenProxy; + private ServerProperties oppsummeringsdokumentService; + private ServerProperties testnavOrganisasjonService; + private ServerProperties syntAmelding; + +} diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/GenererOrganisasjonPopulasjonConsumer.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/GenererOrganisasjonPopulasjonConsumer.java index 90ec14f3f18..42a2459962b 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/GenererOrganisasjonPopulasjonConsumer.java +++ b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/GenererOrganisasjonPopulasjonConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer; +import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config.Consumers; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.GetOpplysningspliktigOrgnummerCommand; -import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials.GenererOrganisasjonPopulasjonServerProperties; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; @@ -12,23 +12,23 @@ @Component public class GenererOrganisasjonPopulasjonConsumer { private final WebClient webClient; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public GenererOrganisasjonPopulasjonConsumer( - GenererOrganisasjonPopulasjonServerProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - this.properties = properties; + serverProperties = consumers.getTestnavGenererOrganisasjonPopulasjonService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Set getOpplysningspliktig(String miljo) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetOpplysningspliktigOrgnummerCommand( webClient, accessToken.getTokenValue(), diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/HodejegerenConsumer.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/HodejegerenConsumer.java index 8de2b5e3f82..7cad2607bb2 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/HodejegerenConsumer.java +++ b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/HodejegerenConsumer.java @@ -1,8 +1,9 @@ package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config.Consumers; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.GetLevendeIdenterCommand; -import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials.HodejegerenServerProperties; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -13,13 +14,13 @@ public class HodejegerenConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final HodejegerenServerProperties serverProperties; + private final ServerProperties serverProperties; public HodejegerenConsumer( TokenExchange tokenExchange, - HodejegerenServerProperties serverProperties) { + Consumers consumers) { - this.serverProperties = serverProperties; + serverProperties = consumers.getTestnavHodejegerenProxy(); this.tokenExchange = tokenExchange; this.webClient = WebClient.builder() .baseUrl(serverProperties.getUrl()) diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OppsummeringsdokumentConsumer.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OppsummeringsdokumentConsumer.java index 8e3440a136b..6e03efdc849 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OppsummeringsdokumentConsumer.java +++ b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OppsummeringsdokumentConsumer.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config.Consumers; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.GetOppsummeringsdokumentCommand; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.SaveOppsummeringsdokumenterCommand; -import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials.OppsummeringsdokuemntServerProperties; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.domain.amelding.Oppsummeringsdokument; import no.nav.testnav.libs.commands.GetOppsummeringsdokumenterByIdentCommand; import no.nav.testnav.libs.commands.GetOppsummeringsdokumenterCommand; @@ -34,24 +34,24 @@ public class OppsummeringsdokumentConsumer { private static final int BYTE_COUNT = 16 * 1024 * 1024; private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final ApplicationProperties applicationProperties; private final Executor executor; public OppsummeringsdokumentConsumer( TokenExchange tokenExchange, - OppsummeringsdokuemntServerProperties properties, + Consumers consumers, ObjectMapper objectMapper, ApplicationProperties applicationProperties) { this.applicationProperties = applicationProperties; this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getOppsummeringsdokumentService(); this.executor = Executors.newFixedThreadPool(20); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .codecs(clientDefaultCodecsConfigurer -> { clientDefaultCodecsConfigurer.defaultCodecs().maxInMemorySize(BYTE_COUNT); clientDefaultCodecsConfigurer @@ -75,7 +75,7 @@ public Mono save(OppsummeringsdokumentDTO dto, String miljo) { private CompletableFuture saveFuture(OppsummeringsdokumentDTO dto, String miljo) { return CompletableFuture.supplyAsync( () -> tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new SaveOppsummeringsdokumenterCommand( webClient, accessToken.getTokenValue(), @@ -91,20 +91,20 @@ private CompletableFuture saveFuture(OppsummeringsdokumentDTO dto, Strin public List getAll(String miljo) { log.info("Henter alle oppsummeringsdokument fra {}...", miljo); - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); var list = new GetOppsummeringsdokumenterCommand(webClient, accessToken.getTokenValue(), miljo).call(); log.info("Fant {} opplysningspliktig fra {}.", list.size(), miljo); return list; } public Mono> getAllForIdent(String ident, String miljo) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetOppsummeringsdokumenterByIdentCommand(webClient, accessToken.getTokenValue(), ident, miljo).call()); } public Mono getOppsummeringsdokument(String opplysningspliktigOrgnummer, LocalDate kalendermaaned, String miljo) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GetOppsummeringsdokumentCommand( webClient, accessToken.getTokenValue(), diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OrganisasjonConsumer.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OrganisasjonConsumer.java index a4d1925f0a8..bd34e4564e4 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OrganisasjonConsumer.java +++ b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/OrganisasjonConsumer.java @@ -1,9 +1,10 @@ package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config.Consumers; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.GetOrganisasjonCommand; -import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials.OrganisasjonServiceProperties; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.Cacheable; @@ -18,25 +19,25 @@ @Component @CacheConfig public class OrganisasjonConsumer { - private final OrganisasjonServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; private final WebClient webClient; public OrganisasjonConsumer( - OrganisasjonServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrganisasjonService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @Cacheable("Mini-Norge-EREG") public Flux getOrganisasjoner(Set orgnummerListe, String miljo) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMapMany(accessToken -> Flux.concat( orgnummerListe.stream() .map(orgnummer -> new GetOrganisasjonCommand(webClient, accessToken.getTokenValue(), orgnummer, miljo).call()) diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/SyntArbeidsforholdConsumer.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/SyntArbeidsforholdConsumer.java index 8b78351d9bc..399f55a85d2 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/SyntArbeidsforholdConsumer.java +++ b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/SyntArbeidsforholdConsumer.java @@ -1,9 +1,9 @@ package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer; import com.fasterxml.jackson.databind.ObjectMapper; +import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config.Consumers; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.GenererArbeidsforholdHistorikkCommand; import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.command.GenererStartArbeidsforholdCommand; -import no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials.SyntAmeldingProperties; import no.nav.testnav.libs.dto.syntrest.v1.ArbeidsforholdRequest; import no.nav.testnav.libs.dto.syntrest.v1.ArbeidsforholdResponse; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -21,21 +21,21 @@ @Component public class SyntArbeidsforholdConsumer { private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final WebClient webClient; private final ObjectMapper objectMapper; public SyntArbeidsforholdConsumer( TokenExchange tokenExchange, - SyntAmeldingProperties properties, + Consumers consumers, ObjectMapper objectMapper) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getSyntAmelding(); this.objectMapper = objectMapper; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .codecs(clientDefaultCodecsConfigurer -> { clientDefaultCodecsConfigurer .defaultCodecs() @@ -49,13 +49,13 @@ public SyntArbeidsforholdConsumer( public Mono> genererStartArbeidsforhold(LocalDate startdato) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GenererStartArbeidsforholdCommand(webClient, startdato, accessToken.getTokenValue()).call()); } public Mono>> genererArbeidsforholdHistorikk(List requests) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GenererArbeidsforholdHistorikkCommand(webClient, requests, accessToken.getTokenValue(), objectMapper).call()); } } diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/GenererOrganisasjonPopulasjonServerProperties.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/GenererOrganisasjonPopulasjonServerProperties.java deleted file mode 100644 index 4f3bc4875e7..00000000000 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/GenererOrganisasjonPopulasjonServerProperties.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials; - -import lombok.Getter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-generer-organisasjon-populasjon-service") -public class GenererOrganisasjonPopulasjonServerProperties extends ServerProperties { -} diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/HodejegerenServerProperties.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/HodejegerenServerProperties.java deleted file mode 100644 index 6394025e678..00000000000 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/HodejegerenServerProperties.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials; - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Getter -@Setter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-hodejegeren-proxy") -public class HodejegerenServerProperties extends ServerProperties { -} diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/OppsummeringsdokuemntServerProperties.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/OppsummeringsdokuemntServerProperties.java deleted file mode 100644 index b9bd751cbf9..00000000000 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/OppsummeringsdokuemntServerProperties.java +++ /dev/null @@ -1,13 +0,0 @@ -package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials; - -import lombok.Getter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.oppsummeringsdokument-service") -public class OppsummeringsdokuemntServerProperties extends ServerProperties { -} diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/OrganisasjonServiceProperties.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index b0afd51ff0b..00000000000 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,16 +0,0 @@ -package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials; - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Getter -@Setter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - private Integer threads; -} diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/SyntAmeldingProperties.java b/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/SyntAmeldingProperties.java deleted file mode 100644 index 17518be8212..00000000000 --- a/apps/generer-arbeidsforhold-populasjon-service/src/main/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/consumer/credentials/SyntAmeldingProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.consumer.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-amelding") -public class SyntAmeldingProperties extends ServerProperties { -} diff --git a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/config/Consumers.java b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/config/Consumers.java new file mode 100644 index 00000000000..6449063a4fc --- /dev/null +++ b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.registre.testnav.genererorganisasjonpopulasjonservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties genererNavnService; + private ServerProperties testnavOrgnummerService; + +} diff --git a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/GenererNavnConsumer.java b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/GenererNavnConsumer.java index 41ce7b9c92c..42d16167a22 100644 --- a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/GenererNavnConsumer.java +++ b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/GenererNavnConsumer.java @@ -1,8 +1,9 @@ package no.nav.registre.testnav.genererorganisasjonpopulasjonservice.consumer; -import no.nav.registre.testnav.genererorganisasjonpopulasjonservice.credentials.GenererNavnServiceProperties; +import no.nav.registre.testnav.genererorganisasjonpopulasjonservice.config.Consumers; import no.nav.testnav.libs.commands.generernavnservice.v1.GenererNavnCommand; import no.nav.testnav.libs.dto.generernavnservice.v1.NavnDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -11,21 +12,22 @@ public class GenererNavnConsumer { private final WebClient webClient; - private final GenererNavnServiceProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; - public GenererNavnConsumer(GenererNavnServiceProperties properties, - TokenExchange tokenExchange) { - + public GenererNavnConsumer( + Consumers consumers, + TokenExchange tokenExchange) { this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + serverProperties = consumers.getGenererNavnService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public NavnDTO genereNavn() { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); GenererNavnCommand command = new GenererNavnCommand(webClient, accessToken.getTokenValue(), 1); return command.call()[0]; } diff --git a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/OrgnummerConsumer.java b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/OrgnummerConsumer.java index 47ea4b42f8a..81c2a2806ca 100644 --- a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/OrgnummerConsumer.java +++ b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/consumer/OrgnummerConsumer.java @@ -1,7 +1,8 @@ package no.nav.registre.testnav.genererorganisasjonpopulasjonservice.consumer; +import no.nav.registre.testnav.genererorganisasjonpopulasjonservice.config.Consumers; import no.nav.registre.testnav.genererorganisasjonpopulasjonservice.consumer.command.GetOrgnummerCommand; -import no.nav.registre.testnav.genererorganisasjonpopulasjonservice.credentials.OrgnummerServiceProperties; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -10,22 +11,22 @@ public class OrgnummerConsumer { private final WebClient webClient; - private final OrgnummerServiceProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; - public OrgnummerConsumer(OrgnummerServiceProperties properties, - TokenExchange tokenExchange) { - - this.properties = properties; + public OrgnummerConsumer( + Consumers consumers, + TokenExchange tokenExchange) { + serverProperties = consumers.getTestnavOrgnummerService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public String getOrgnummer() { - var tokenValue = tokenExchange.exchange(properties).block().getTokenValue(); + var tokenValue = tokenExchange.exchange(serverProperties).block().getTokenValue(); return new GetOrgnummerCommand(webClient, tokenValue, 1).call().stream().findFirst().orElseThrow(); } diff --git a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/credentials/GenererNavnServiceProperties.java b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/credentials/GenererNavnServiceProperties.java deleted file mode 100644 index 6c85961805c..00000000000 --- a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/credentials/GenererNavnServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnav.genererorganisasjonpopulasjonservice.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.generer-navn-service") -public class GenererNavnServiceProperties extends ServerProperties { -} diff --git a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/credentials/OrgnummerServiceProperties.java b/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/credentials/OrgnummerServiceProperties.java deleted file mode 100644 index d197f25a2d5..00000000000 --- a/apps/generer-organisasjon-populasjon-service/src/main/java/no/nav/registre/testnav/genererorganisasjonpopulasjonservice/credentials/OrgnummerServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.testnav.genererorganisasjonpopulasjonservice.credentials; - - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-orgnummer-service") -public class OrgnummerServiceProperties extends ServerProperties { -} diff --git a/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/config/Consumers.java b/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/config/Consumers.java new file mode 100644 index 00000000000..3ab25367a16 --- /dev/null +++ b/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.generersyntameldingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties syntAmelding; + +} diff --git a/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumer.java b/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumer.java index de30dcf54e0..5ff0de5ac43 100644 --- a/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumer.java +++ b/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumer.java @@ -1,8 +1,8 @@ package no.nav.registre.testnorge.generersyntameldingservice.consumer; +import no.nav.registre.testnorge.generersyntameldingservice.config.Consumers; import no.nav.registre.testnorge.generersyntameldingservice.consumer.command.PostHentArbeidsforholdCommand; import no.nav.registre.testnorge.generersyntameldingservice.consumer.command.PostHentHistorikkCommand; -import no.nav.registre.testnorge.generersyntameldingservice.consumer.credentials.SyntAmeldingProperties; import no.nav.registre.testnorge.generersyntameldingservice.domain.ArbeidsforholdType; import no.nav.testnav.libs.domain.dto.aareg.amelding.Arbeidsforhold; import no.nav.testnav.libs.domain.dto.aareg.amelding.ArbeidsforholdPeriode; @@ -18,33 +18,35 @@ public class SyntAmeldingConsumer { private final WebClient webClient; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public SyntAmeldingConsumer(TokenExchange tokenExchange, - SyntAmeldingProperties properties) { - + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() - .codecs(configurer -> configurer - .defaultCodecs() - .maxInMemorySize(16 * 1024 * 1024)) - .build()) - .baseUrl(properties.getUrl()) + serverProperties = consumers.getSyntAmelding(); + this.webClient = WebClient + .builder() + .exchangeStrategies( + ExchangeStrategies + .builder() + .codecs(configurer -> configurer + .defaultCodecs() + .maxInMemorySize(16 * 1024 * 1024)) + .build()) + .baseUrl(serverProperties.getUrl()) .build(); } public Arbeidsforhold getEnkeltArbeidsforhold(ArbeidsforholdPeriode periode, ArbeidsforholdType arbeidsforholdType) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostHentArbeidsforholdCommand( webClient, periode, arbeidsforholdType.getPath(), accessToken.getTokenValue()).call()) .block(); } public List getHistorikk(Arbeidsforhold arbeidsforhold) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostHentHistorikkCommand( webClient, arbeidsforhold, accessToken.getTokenValue()).call()) .block(); diff --git a/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/credentials/SyntAmeldingProperties.java b/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/credentials/SyntAmeldingProperties.java deleted file mode 100644 index 34466f8d269..00000000000 --- a/apps/generer-synt-amelding-service/src/main/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/credentials/SyntAmeldingProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.testnorge.generersyntameldingservice.consumer.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-amelding") -public class SyntAmeldingProperties extends ServerProperties{ -} diff --git a/apps/generer-synt-amelding-service/src/test/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumerTest.java b/apps/generer-synt-amelding-service/src/test/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumerTest.java index d2d6508b003..efbc634fe2e 100644 --- a/apps/generer-synt-amelding-service/src/test/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumerTest.java +++ b/apps/generer-synt-amelding-service/src/test/java/no/nav/registre/testnorge/generersyntameldingservice/consumer/SyntAmeldingConsumerTest.java @@ -1,10 +1,10 @@ package no.nav.registre.testnorge.generersyntameldingservice.consumer; -import no.nav.registre.testnorge.generersyntameldingservice.consumer.credentials.SyntAmeldingProperties; import no.nav.registre.testnorge.generersyntameldingservice.domain.ArbeidsforholdType; import no.nav.testnav.libs.domain.dto.aareg.amelding.Arbeidsforhold; import no.nav.testnav.libs.domain.dto.aareg.amelding.ArbeidsforholdPeriode; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -33,6 +33,7 @@ @AutoConfigureWireMock(port = 0) class SyntAmeldingConsumerTest { + @SuppressWarnings("unused") @MockBean private JwtDecoder jwtDecoder; @@ -44,7 +45,7 @@ class SyntAmeldingConsumerTest { @BeforeEach public void setup() { - when(tokenExchange.exchange(ArgumentMatchers.any(SyntAmeldingProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenExchange.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test diff --git a/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/config/Consumers.java b/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/config/Consumers.java new file mode 100644 index 00000000000..fdc9e87ee5d --- /dev/null +++ b/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.hodejegeren.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties tpsfProxy; + +} diff --git a/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/TpsfConsumer.java b/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/TpsfConsumer.java index f8f3a7b0540..25ba1d929e9 100644 --- a/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/TpsfConsumer.java +++ b/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/TpsfConsumer.java @@ -3,13 +3,14 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import io.micrometer.core.annotation.Timed; +import no.nav.testnav.apps.hodejegeren.config.Consumers; import no.nav.testnav.apps.hodejegeren.consumer.command.GetTpsIdenterCommand; import no.nav.testnav.apps.hodejegeren.consumer.command.GetTpsServiceRoutineV1Command; import no.nav.testnav.apps.hodejegeren.consumer.command.GetTpsServiceRoutineV2Command; import no.nav.testnav.apps.hodejegeren.consumer.command.GetTpsStatusPaaIdenterCommand; -import no.nav.testnav.apps.hodejegeren.consumer.credential.TpsfProxyProperties; import no.nav.testnav.apps.hodejegeren.consumer.dto.ServiceRoutineDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.apache.tomcat.util.buf.StringUtils; import org.springframework.http.client.reactive.ReactorClientHttpConnector; @@ -29,26 +30,28 @@ public class TpsfConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final TpsfProxyProperties serviceProperties; + private final ServerProperties serverProperties; public TpsfConsumer( - TpsfProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange ) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTpsfProxy(); this.tokenExchange = tokenExchange; - HttpClient client = HttpClient .create() .responseTimeout(Duration.ofMinutes(2)); - - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() - .codecs(configurer -> configurer - .defaultCodecs() - .maxInMemorySize(16 * 1024 * 1024)) - .build()) - .baseUrl(serviceProperties.getUrl()) + this.webClient = WebClient + .builder() + .exchangeStrategies( + ExchangeStrategies + .builder() + .codecs( + configurer -> configurer + .defaultCodecs() + .maxInMemorySize(16 * 1024 * 1024)) + .build()) + .baseUrl(serverProperties.getUrl()) .clientConnector(new ReactorClientHttpConnector(client)) .build(); } @@ -59,7 +62,7 @@ public Set getIdenterFiltrertPaaAarsakskode( List aarsakskode, String transaksjonstype ) { - return tokenExchange.exchange(serviceProperties).flatMap(accessToken -> new GetTpsIdenterCommand( + return tokenExchange.exchange(serverProperties).flatMap(accessToken -> new GetTpsIdenterCommand( webClient, accessToken.getTokenValue(), StringUtils.join(aarsakskode, ','), @@ -73,14 +76,14 @@ public JsonNode getTpsServiceRoutine( String miljoe, String fnr ) throws IOException { - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetTpsServiceRoutineV1Command( webClient, accessToken.getTokenValue(), routineName, aksjonsKode, miljoe, fnr).call()).block(); return new ObjectMapper().readTree(response); } public Mono getToken() { - return tokenExchange.exchange(serviceProperties); + return tokenExchange.exchange(serverProperties); } public Flux getTpsServiceRoutineV2(String routineName, String aksjonsKode, String miljoe, String fnr, AccessToken token) { @@ -94,7 +97,7 @@ public JsonNode hentTpsStatusPaaIdenter( List identer ) throws IOException { var identerSomString = String.join(",", identer); - var response = tokenExchange.exchange(serviceProperties).flatMap(accessToken -> + var response = tokenExchange.exchange(serverProperties).flatMap(accessToken -> new GetTpsStatusPaaIdenterCommand( webClient, accessToken.getTokenValue(), aksjonskode, identer.size(), miljoe, identerSomString).call()) .block(); diff --git a/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/credential/TpsfProxyProperties.java b/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/credential/TpsfProxyProperties.java deleted file mode 100644 index cf5dd9c1081..00000000000 --- a/apps/hodejegeren/src/main/java/no/nav/testnav/apps/hodejegeren/consumer/credential/TpsfProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.hodejegeren.consumer.credential; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.tpsf-proxy") -public class TpsfProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/Consumers.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/Consumers.java new file mode 100644 index 00000000000..5b3b1edac09 --- /dev/null +++ b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.importpersonservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavPdlForvalter; + +} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java index 28cd037a596..f5a99c7c700 100644 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java +++ b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java @@ -1,9 +1,9 @@ package no.nav.testnav.apps.importpersonservice.consumer; +import no.nav.testnav.apps.importpersonservice.config.Consumers; import no.nav.testnav.apps.importpersonservice.consumer.command.OppdaterPersonCommand; import no.nav.testnav.apps.importpersonservice.consumer.command.SendPersonTilPdlCommand; import no.nav.testnav.apps.importpersonservice.consumer.request.OppdaterPersonRequest; -import no.nav.testnav.apps.importpersonservice.credentias.TestnavPdlForvalterProperties; import no.nav.testnav.apps.importpersonservice.domain.PersonList; import no.nav.testnav.libs.data.pdlforvalter.v1.OrdreResponseDTO; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; @@ -21,12 +21,10 @@ public class PdlForvalterConsumer { private final TokenExchange tokenExchange; public PdlForvalterConsumer( - TestnavPdlForvalterProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serverProperties = serverProperties; + serverProperties = consumers.getTestnavPdlForvalter(); this.tokenExchange = tokenExchange; - this.webClient = WebClient .builder() .baseUrl(serverProperties.getUrl()) diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/credentias/TestnavPdlForvalterProperties.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/credentias/TestnavPdlForvalterProperties.java deleted file mode 100644 index c039fc51126..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/credentias/TestnavPdlForvalterProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.credentias; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pdl-forvalter") -public class TestnavPdlForvalterProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/Consumers.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/Consumers.java new file mode 100644 index 00000000000..cba3a610c2a --- /dev/null +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.registre.testnav.inntektsmeldingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavDokarkivProxy; + private ServerProperties inntektsmeldingGeneratorService; + +} diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/credentials/DokarkivProxyServiceProperties.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/credentials/DokarkivProxyServiceProperties.java deleted file mode 100644 index dd0b83527d8..00000000000 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/credentials/DokarkivProxyServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnav.inntektsmeldingservice.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-dokarkiv-proxy") -public class DokarkivProxyServiceProperties extends ServerProperties { -} diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/credentials/InntektsmeldingGeneratorServiceProperties.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/credentials/InntektsmeldingGeneratorServiceProperties.java deleted file mode 100644 index bbf89081673..00000000000 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/config/credentials/InntektsmeldingGeneratorServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnav.inntektsmeldingservice.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.inntektsmelding-generator-service") -public class InntektsmeldingGeneratorServiceProperties extends ServerProperties { -} diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/DokmotConsumer.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/DokmotConsumer.java index fb1c01a0862..69bef3f8937 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/DokmotConsumer.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/DokmotConsumer.java @@ -2,7 +2,7 @@ import io.swagger.v3.core.util.Json; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnav.inntektsmeldingservice.config.credentials.DokarkivProxyServiceProperties; +import no.nav.registre.testnav.inntektsmeldingservice.config.Consumers; import no.nav.registre.testnav.inntektsmeldingservice.consumer.command.OpprettJournalpostCommand; import no.nav.registre.testnav.inntektsmeldingservice.domain.FilLaster; import no.nav.testnav.libs.dto.dokarkiv.v1.DokmotRequest; @@ -23,16 +23,16 @@ public class DokmotConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public DokmotConsumer( - DokarkivProxyServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + serverProperties = consumers.getTestnavDokarkivProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } @@ -41,7 +41,7 @@ public List opprettJournalpost(String miljoe, List Flux.concat( inntektDokumenter .stream() diff --git a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/GenererInntektsmeldingConsumer.java b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/GenererInntektsmeldingConsumer.java index eeb6fa1ae5b..95cbc6b5c26 100644 --- a/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/GenererInntektsmeldingConsumer.java +++ b/apps/inntektsmelding-service/src/main/java/no/nav/registre/testnav/inntektsmeldingservice/consumer/GenererInntektsmeldingConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.testnav.inntektsmeldingservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnav.inntektsmeldingservice.config.credentials.InntektsmeldingGeneratorServiceProperties; +import no.nav.registre.testnav.inntektsmeldingservice.config.Consumers; import no.nav.registre.testnav.inntektsmeldingservice.consumer.command.GenererInntektsmeldingCommand; import no.nav.testnav.libs.dto.inntektsmeldinggeneratorservice.v1.rs.RsInntektsmelding; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -16,21 +16,21 @@ public class GenererInntektsmeldingConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public GenererInntektsmeldingConsumer( - InntektsmeldingGeneratorServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + serverProperties = consumers.getInntektsmeldingGeneratorService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public String getInntektsmeldingXml201812(RsInntektsmelding inntektsmelding) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(token -> new GenererInntektsmeldingCommand(webClient, inntektsmelding, token.getTokenValue()).call()) .block(); } diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/Consumers.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/Consumers.java new file mode 100644 index 00000000000..fa8f6949bcb --- /dev/null +++ b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.registre.testnorge.jenkinsbatchstatusservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties jenkins; + private ServerProperties organisasjonBestillingService; + +} diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/credentials/JenkinsServiceProperties.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/credentials/JenkinsServiceProperties.java deleted file mode 100644 index 9cb6c0058f8..00000000000 --- a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/credentials/JenkinsServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.jenkinsbatchstatusservice.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.jenkins") -public class JenkinsServiceProperties extends ServerProperties { -} diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/credentials/OrganisasjonBestillingServiceProperties.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/credentials/OrganisasjonBestillingServiceProperties.java deleted file mode 100644 index a6f772cade2..00000000000 --- a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/config/credentials/OrganisasjonBestillingServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.jenkinsbatchstatusservice.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.organisasjon-bestilling-service") -public class OrganisasjonBestillingServiceProperties extends ServerProperties { -} diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/JenkinsConsumer.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/JenkinsConsumer.java index 4b0885d6fe6..a4f9c271894 100644 --- a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/JenkinsConsumer.java +++ b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/JenkinsConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.jenkinsbatchstatusservice.config.credentials.JenkinsServiceProperties; +import no.nav.registre.testnorge.jenkinsbatchstatusservice.config.Consumers; import no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer.command.GetBEREG007LogCommand; import no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer.command.GetQueueItemCommand; import no.nav.testnav.libs.commands.GetCrumbCommand; @@ -16,32 +16,32 @@ public class JenkinsConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public JenkinsConsumer( - JenkinsServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + serverProperties = consumers.getJenkins(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } private JenkinsCrumb getCrumb() { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); return new GetCrumbCommand(webClient, accessToken.getTokenValue()).call(); } public Long getJobNumber(Long itemId) { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); var dto = new GetQueueItemCommand(webClient, accessToken.getTokenValue(), getCrumb(), itemId).call(); return dto.getNumber(); } public String getJobLog(Long jobNumber) { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); return new GetBEREG007LogCommand(webClient, accessToken.getTokenValue(), jobNumber).call(); } } \ No newline at end of file diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java index 9c1bc0e1320..1fa23bc274e 100644 --- a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java @@ -4,7 +4,7 @@ import io.netty.handler.timeout.ReadTimeoutHandler; import io.netty.handler.timeout.WriteTimeoutHandler; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.jenkinsbatchstatusservice.config.credentials.OrganisasjonBestillingServiceProperties; +import no.nav.registre.testnorge.jenkinsbatchstatusservice.config.Consumers; import no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer.command.SaveOrganisasjonBestillingCommand; import no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer.command.UpdateOrganisasjonBestillingCommand; import no.nav.testnav.libs.dto.organiasjonbestilling.v1.OrderDTO; @@ -23,30 +23,30 @@ public class OrganisasjonBestillingConsumer { private static final int TIMEOUT_SECONDS = 10; private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public OrganisasjonBestillingConsumer( - OrganisasjonBestillingServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - - this.properties = properties; + serverProperties = consumers.getOrganisasjonBestillingService(); this.tokenExchange = tokenExchange; this.webClient = WebClient - .builder() - .baseUrl(properties.getUrl()) - .clientConnector(new ReactorClientHttpConnector( - HttpClient - .create() - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, TIMEOUT_SECONDS * 1000) - .doOnConnected(connection -> connection - .addHandlerLast(new ReadTimeoutHandler(TIMEOUT_SECONDS)) - .addHandlerLast(new WriteTimeoutHandler(TIMEOUT_SECONDS))) - )) - .build(); + .builder() + .baseUrl(serverProperties.getUrl()) + .clientConnector( + new ReactorClientHttpConnector( + HttpClient + .create() + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, TIMEOUT_SECONDS * 1000) + .doOnConnected(connection -> connection + .addHandlerLast(new ReadTimeoutHandler(TIMEOUT_SECONDS)) + .addHandlerLast(new WriteTimeoutHandler(TIMEOUT_SECONDS))) + )) + .build(); } public Long save(String uuid) { - var accessToken = Objects.requireNonNull(tokenExchange.exchange(properties).block(), "Token var null."); + var accessToken = Objects.requireNonNull(tokenExchange.exchange(serverProperties).block(), "Token var null."); log.info("Registrerer jobb med uuid: {}.", uuid); var id = new SaveOrganisasjonBestillingCommand(webClient, accessToken.getTokenValue(), uuid).call(); log.info("Jobb registert med id {} og uuid: {}.", uuid, id); @@ -54,7 +54,7 @@ public Long save(String uuid) { } public void update(String uuid, String miljo, Long jobId, Long id) { - var accessToken = Objects.requireNonNull(tokenExchange.exchange(properties).block(), "Token var null."); + var accessToken = Objects.requireNonNull(tokenExchange.exchange(serverProperties).block(), "Token var null."); log.info("Oppretter organisasjon bestilling for uuid {} med job id: {}", uuid, jobId); var dto = new OrderDTO(miljo, jobId); new UpdateOrganisasjonBestillingCommand(webClient, dto, accessToken.getTokenValue(), uuid, id).run(); diff --git a/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/config/Consumers.java b/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/config/Consumers.java new file mode 100644 index 00000000000..73a75fdbee3 --- /dev/null +++ b/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.joarkdokumentservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavSafProxy; + +} diff --git a/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/config/credentias/TestnavSafProxyServiceProperties.java b/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/config/credentias/TestnavSafProxyServiceProperties.java deleted file mode 100644 index 4448eae36c4..00000000000 --- a/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/config/credentias/TestnavSafProxyServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.joarkdokumentservice.config.credentias; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-saf-proxy") -public class TestnavSafProxyServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/consumer/SafConsumer.java b/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/consumer/SafConsumer.java index b31aa876627..88268b987eb 100644 --- a/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/consumer/SafConsumer.java +++ b/apps/joark-dokument-service/src/main/java/no/nav/testnav/joarkdokumentservice/consumer/SafConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.joarkdokumentservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.joarkdokumentservice.config.credentias.TestnavSafProxyServiceProperties; +import no.nav.testnav.joarkdokumentservice.config.Consumers; import no.nav.testnav.joarkdokumentservice.consumer.command.GetDokumentCommand; import no.nav.testnav.joarkdokumentservice.consumer.command.GetDokumentInfoCommand; import no.nav.testnav.joarkdokumentservice.consumer.command.GetPDFCommand; @@ -10,7 +10,6 @@ import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; - import org.springframework.web.reactive.function.client.ExchangeStrategies; import org.springframework.web.reactive.function.client.WebClient; @@ -21,25 +20,27 @@ public class SafConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public SafConsumer( - TestnavSafProxyServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() + serverProperties = consumers.getTestnavSafProxy(); + this.webClient = WebClient + .builder() .exchangeStrategies( - ExchangeStrategies.builder() - .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(1024 * 1024 * 50)).build()) - .baseUrl(properties.getUrl()) + ExchangeStrategies + .builder() + .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(1024 * 1024 * 50)) + .build()) + .baseUrl(serverProperties.getUrl()) .build(); } public JournalpostDTO getJournalpost(String journalpostId, String miljo) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GetDokumentInfoCommand( webClient, accessToken.getTokenValue(), @@ -58,7 +59,7 @@ public JournalpostDTO getJournalpost(String journalpostId, String miljo) { public String getDokument(String journalpostId, String dokumentInfoId, DokumentType dokumentType, String miljo) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GetDokumentCommand( webClient, accessToken.getTokenValue(), @@ -72,7 +73,7 @@ public String getDokument(String journalpostId, String dokumentInfoId, DokumentT public byte[] getPDF(String journalpostId, String dokumentInfoId, String miljo) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GetPDFCommand( webClient, accessToken.getTokenValue(), diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/Consumers.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/Consumers.java new file mode 100644 index 00000000000..00bb01cfcb3 --- /dev/null +++ b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/Consumers.java @@ -0,0 +1,33 @@ +package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavGenererOrganisasjonPopulasjonService; + private ServerProperties hodejegeren; + private ServerProperties oppsummeringsdokumentService; + private ServerProperties testnavOrganisasjonService; + private ServerProperties syntAmelding; + +} diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/GenererOrganisasjonPopulasjonServerProperties.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/GenererOrganisasjonPopulasjonServerProperties.java deleted file mode 100644 index ccb11ce9e19..00000000000 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/GenererOrganisasjonPopulasjonServerProperties.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials; - -import lombok.Getter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-generer-organisasjon-populasjon-service") -public class GenererOrganisasjonPopulasjonServerProperties extends ServerProperties { -} diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/HodejegerenProperties.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/HodejegerenProperties.java deleted file mode 100644 index c7287245cb4..00000000000 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/HodejegerenProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.hodejegeren") -public class HodejegerenProperties extends ServerProperties { -} diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/OppsummeringsdokuemntServerProperties.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/OppsummeringsdokuemntServerProperties.java deleted file mode 100644 index 59e862d5eed..00000000000 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/OppsummeringsdokuemntServerProperties.java +++ /dev/null @@ -1,13 +0,0 @@ -package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials; - -import lombok.Getter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.oppsummeringsdokument-service") -public class OppsummeringsdokuemntServerProperties extends ServerProperties { -} diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/OrganisasjonServiceProperties.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index 347bdb8c52d..00000000000 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Getter -@Setter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - private Integer threads; -} diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/SyntAmeldingProperties.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/SyntAmeldingProperties.java deleted file mode 100644 index 3eb861d8e8a..00000000000 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/config/credentials/SyntAmeldingProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-amelding") -public class SyntAmeldingProperties extends ServerProperties{ -} diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/GenererOrganisasjonPopulasjonConsumer.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/GenererOrganisasjonPopulasjonConsumer.java index 86c043c7a73..0c5033f8881 100644 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/GenererOrganisasjonPopulasjonConsumer.java +++ b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/GenererOrganisasjonPopulasjonConsumer.java @@ -1,6 +1,6 @@ package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer; -import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials.GenererOrganisasjonPopulasjonServerProperties; +import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.Consumers; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer.command.GetOpplysningspliktigOrgnummerCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; @@ -12,23 +12,22 @@ @Component public class GenererOrganisasjonPopulasjonConsumer { private final WebClient webClient; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public GenererOrganisasjonPopulasjonConsumer( - GenererOrganisasjonPopulasjonServerProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - - this.properties = properties; + serverProperties = consumers.getTestnavGenererOrganisasjonPopulasjonService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Set getOpplysningspliktig(String miljo) { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); return new GetOpplysningspliktigOrgnummerCommand(webClient, accessToken.getTokenValue(), miljo).call(); } } diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/HodejegerenConsumer.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/HodejegerenConsumer.java index 4562f3a8d42..5120bd92b9a 100644 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/HodejegerenConsumer.java +++ b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/HodejegerenConsumer.java @@ -1,6 +1,6 @@ package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer; -import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials.HodejegerenProperties; +import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.Consumers; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer.command.GetLevendeIdenterCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; @@ -14,16 +14,14 @@ public class HodejegerenConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public HodejegerenConsumer( @Value("${consumers.hodejegeren.url}") String url, - HodejegerenProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + serverProperties = consumers.getHodejegeren(); this.tokenExchange = tokenExchange; - this.webClient = WebClient .builder() .baseUrl(url) @@ -31,7 +29,7 @@ public HodejegerenConsumer( } public Flux getIdenter(String miljo, int antall) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMapMany(accessToken -> new GetLevendeIdenterCommand(webClient, miljo, antall, accessToken.getTokenValue()).call()); } } diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OppsummeringsdokumentConsumer.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OppsummeringsdokumentConsumer.java index 60faaa4c920..b138593fa54 100644 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OppsummeringsdokumentConsumer.java +++ b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OppsummeringsdokumentConsumer.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials.OppsummeringsdokuemntServerProperties; +import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.Consumers; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.domain.Opplysningspliktig; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.domain.Organisajon; import no.nav.testnav.libs.commands.GetOppsummeringsdokumentCommand; @@ -35,25 +35,26 @@ public class OppsummeringsdokumentConsumer { private static final int BYTE_COUNT = 16 * 1024 * 1024; private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final Executor executor; private final ApplicationProperties applicationProperties; public OppsummeringsdokumentConsumer( TokenExchange tokenExchange, - OppsummeringsdokuemntServerProperties properties, + Consumers consumers, ObjectMapper objectMapper, ApplicationProperties applicationProperties) { - this.applicationProperties = applicationProperties; this.executor = Executors.newFixedThreadPool(10); this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getOppsummeringsdokumentService(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .codecs(clientDefaultCodecsConfigurer -> { - clientDefaultCodecsConfigurer.defaultCodecs().maxInMemorySize(BYTE_COUNT); + clientDefaultCodecsConfigurer + .defaultCodecs() + .maxInMemorySize(BYTE_COUNT); clientDefaultCodecsConfigurer .defaultCodecs() .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); @@ -65,7 +66,7 @@ public OppsummeringsdokumentConsumer( } public Optional getOpplysningspliktig(Organisajon organisajon, LocalDate kalendermaaned, String miljo) { - AccessToken accessToken = tokenExchange.exchange(properties).block(); + AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); var dto = new GetOppsummeringsdokumentCommand(webClient, accessToken.getTokenValue(), organisajon.getOrgnummer(), kalendermaaned, miljo).call().block(); if (dto == null) { return Optional.empty(); @@ -76,7 +77,7 @@ public Optional getOpplysningspliktig(Organisajon organisajo public List getAlleOpplysningspliktig(String miljo) { log.info("Henter alle opplysningspliktige fra {}...", miljo); - AccessToken accessToken = tokenExchange.exchange(properties).block(); + AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); var list = new GetOppsummeringsdokumenterCommand(webClient, accessToken.getTokenValue(), miljo).call(); log.info("Fant {} opplysningspliktig fra {}.", list.size(), miljo); return list.stream().map(value -> new Opplysningspliktig(value, new ArrayList<>())).collect(Collectors.toList()); @@ -97,7 +98,7 @@ public void sendOpplysningspliktig(List opplysningspliktig, } private CompletableFuture saveOpplysningspliktig(Opplysningspliktig opplysningspliktig, String miljo) { - AccessToken accessToken = tokenExchange.exchange(properties).block(); + AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); return CompletableFuture.supplyAsync( () -> new SaveOppsummeringsdokumenterCommand( webClient, diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OrganisasjonConsumer.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OrganisasjonConsumer.java index cd7307ab969..97e2e66b0ee 100644 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OrganisasjonConsumer.java +++ b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/OrganisasjonConsumer.java @@ -1,10 +1,11 @@ package no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials.OrganisasjonServiceProperties; +import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.Consumers; import no.nav.testnav.libs.commands.organisasjonservice.v1.GetOrganisasjonCommand; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.Cacheable; @@ -24,16 +25,15 @@ @Component @CacheConfig public class OrganisasjonConsumer { - private final OrganisasjonServiceProperties serviceProperties; + private final ServerProperties serviceProperties; private final TokenExchange tokenExchange; private final WebClient webClient; private final ExecutorService executorService; public OrganisasjonConsumer( - OrganisasjonServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + serviceProperties = consumers.getTestnavOrganisasjonService(); this.tokenExchange = tokenExchange; this.executorService = Executors.newFixedThreadPool(serviceProperties.getThreads()); this.webClient = WebClient diff --git a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/SyntAmeldingConsumer.java b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/SyntAmeldingConsumer.java index 35c4f4fa253..88d446b25af 100644 --- a/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/SyntAmeldingConsumer.java +++ b/apps/mn-synt-arbeidsforhold-service/src/main/java/no/nav/registre/testnorge/mn/syntarbeidsforholdservice/consumer/SyntAmeldingConsumer.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.credentials.SyntAmeldingProperties; +import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.config.Consumers; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer.command.GenerateArbeidsforholdHistorikkCommand; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.consumer.command.GenerateStartArbeidsforholdCommand; import no.nav.registre.testnorge.mn.syntarbeidsforholdservice.domain.Arbeidsforhold; @@ -28,33 +28,35 @@ public class SyntAmeldingConsumer { private static final String OPPRETTELSE_FEILMELDING = "Feil med opprettelse av arbeidsforhold: "; private final WebClient webClient; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; private final ObjectMapper objectMapper; public SyntAmeldingConsumer( TokenExchange tokenExchange, - SyntAmeldingProperties properties, + Consumers consumers, ObjectMapper objectMapper) { - this.objectMapper = objectMapper; this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() + serverProperties = consumers.getSyntAmelding(); + this.webClient = WebClient + .builder() + .exchangeStrategies(ExchangeStrategies + .builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) - .codecs(clientDefaultCodecsConfigurer -> { - clientDefaultCodecsConfigurer - .defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - clientDefaultCodecsConfigurer - .defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) - .baseUrl(properties.getUrl()) + .codecs( + clientDefaultCodecsConfigurer -> { + clientDefaultCodecsConfigurer + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + clientDefaultCodecsConfigurer + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -62,7 +64,7 @@ public SyntAmeldingConsumer( private List getArbeidsforholdHistorikkResponse(Arbeidsforhold arbeidsforhold, LocalDate kalendermaaned, Integer count) { var dto = arbeidsforhold.toSyntrestDTO(kalendermaaned, count); try { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); return new GenerateArbeidsforholdHistorikkCommand(webClient, dto, accessToken.getTokenValue()).call(); } catch (WebClientResponseException.InternalServerError e) { throw new SyntetiseringException(OPPRETTELSE_FEILMELDING + objectMapper.writeValueAsString(dto), e); @@ -107,7 +109,7 @@ public List getArbeidsforholdHistorikk( public Arbeidsforhold getFirstArbeidsforhold(LocalDate startdato, String ident, String virksomhetsnummer) { try { log.info("Oppretter nytt arbeidsforhold den {}.", startdato); - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); ArbeidsforholdResponse response = new GenerateStartArbeidsforholdCommand(webClient, startdato, accessToken.getTokenValue()).call(); log.trace("Nytt arbeidsforhold av type: {}.", response.getArbeidsforholdType()); return new Arbeidsforhold(response, ident, virksomhetsnummer); diff --git a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/Consumers.java b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/Consumers.java new file mode 100644 index 00000000000..5692ee22c85 --- /dev/null +++ b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.oppsummeringsdokumentservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties aaregSyntServices; + +} diff --git a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/credentials/AaregSyntServiceProperties.java b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/credentials/AaregSyntServiceProperties.java deleted file mode 100644 index 42ade9ab8d4..00000000000 --- a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/credentials/AaregSyntServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.oppsummeringsdokumentservice.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.aareg-synt-services") -public class AaregSyntServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/consumer/AaregSyntConsumer.java b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/consumer/AaregSyntConsumer.java index 2f4f456ee75..ffc3c7e5d2e 100644 --- a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/consumer/AaregSyntConsumer.java +++ b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/consumer/AaregSyntConsumer.java @@ -2,7 +2,7 @@ import io.swagger.v3.core.util.Json; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.oppsummeringsdokumentservice.config.credentials.AaregSyntServiceProperties; +import no.nav.testnav.apps.oppsummeringsdokumentservice.config.Consumers; import no.nav.testnav.apps.oppsummeringsdokumentservice.consumer.command.SaveOpplysningspliktigCommand; import no.nav.testnav.apps.oppsummeringsdokumentservice.domain.Oppsummeringsdokument; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -17,16 +17,16 @@ public class AaregSyntConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; - - public AaregSyntConsumer(TokenExchange tokenExchange, - AaregSyntServiceProperties properties) { + private final ServerProperties serverProperties; + public AaregSyntConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getAaregSyntServices(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -41,7 +41,7 @@ public void saveOpplysningspliktig(Oppsummeringsdokument oppsummeringsdokument, } private String getAccessToken() { - var token = tokenExchange.exchange(properties).block(); + var token = tokenExchange.exchange(serverProperties).block(); if (isNull(token)) { throw new IllegalArgumentException("Klarte ikke å generere AccessToken for AaregSyntService"); } diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/config/Consumers.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/config/Consumers.java new file mode 100644 index 00000000000..e2efb76d5a7 --- /dev/null +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.testnav.apps.organisasjonbestillingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties eregBatchStatusService; + private ServerProperties jenkins; + +} diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/config/credentials/EregBatchStatusServiceProperties.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/config/credentials/EregBatchStatusServiceProperties.java deleted file mode 100644 index 8165a90e3e5..00000000000 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/config/credentials/EregBatchStatusServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.organisasjonbestillingservice.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.ereg-batch-status-service") -public class EregBatchStatusServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/EregBatchStatusConsumer.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/EregBatchStatusConsumer.java index 2eb3ab8a5e9..689d95aebd1 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/EregBatchStatusConsumer.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/EregBatchStatusConsumer.java @@ -1,6 +1,6 @@ package no.nav.testnav.apps.organisasjonbestillingservice.consumer; -import no.nav.testnav.apps.organisasjonbestillingservice.config.credentials.EregBatchStatusServiceProperties; +import no.nav.testnav.apps.organisasjonbestillingservice.config.Consumers; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.command.GetEregBatchStatusCommand; import no.nav.testnav.apps.organisasjonbestillingservice.domain.v2.Order; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -12,22 +12,22 @@ public class EregBatchStatusConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public EregBatchStatusConsumer( - EregBatchStatusServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange ) { - - this.serviceProperties = serviceProperties; + serverProperties = consumers.getEregBatchStatusService(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public Long getStatusKode(no.nav.testnav.apps.organisasjonbestillingservice.domain.v1.Order order) { - var accessToken = tokenExchange.exchange(serviceProperties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); var command = new GetEregBatchStatusCommand( webClient, order.getBatchId(), @@ -38,7 +38,7 @@ public Long getStatusKode(no.nav.testnav.apps.organisasjonbestillingservice.doma } public Long getStatusKode(Order order) { - var accessToken = tokenExchange.exchange(serviceProperties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); var command = new GetEregBatchStatusCommand( webClient, order.getBatchId(), diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/JenkinsConsumer.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/JenkinsConsumer.java index 76fd0f80e87..d047e9feb0a 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/JenkinsConsumer.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/consumer/JenkinsConsumer.java @@ -1,12 +1,12 @@ package no.nav.testnav.apps.organisasjonbestillingservice.consumer; +import no.nav.testnav.apps.organisasjonbestillingservice.config.Consumers; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.command.GetBEREG007Command; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.command.GetBEREG007LogCommand; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.command.GetCrumbCommand; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.command.GetQueueItemCommand; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.dto.BuildDTO; import no.nav.testnav.apps.organisasjonbestillingservice.consumer.dto.ItemDTO; -import no.nav.testnav.apps.organisasjonbestillingservice.credentials.JenkinsServiceProperties; import no.nav.testnav.libs.dto.jenkins.v1.JenkinsCrumb; import no.nav.testnav.libs.securitycore.domain.AccessToken; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -20,16 +20,16 @@ public class JenkinsConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public JenkinsConsumer( - JenkinsServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + serverProperties = consumers.getJenkins(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } @@ -39,7 +39,7 @@ private Mono getCrumb(AccessToken accessToken) { public Mono getBuildId(Long itemId) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> getCrumb(accessToken) .flatMap(jenkinsCrumb -> new GetQueueItemCommand(webClient, accessToken.getTokenValue(), jenkinsCrumb, itemId).call()) .map(ItemDTO::getNumber) @@ -48,13 +48,13 @@ public Mono getBuildId(Long itemId) { public Mono getBuildLog(Long buildId) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GetBEREG007LogCommand(webClient, accessToken.getTokenValue(), buildId).call()); } public Mono getBuild(Long buildId) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMap(accessToken -> new GetBEREG007Command(webClient, accessToken.getTokenValue(), buildId).call()); } diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/credentials/JenkinsServiceProperties.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/credentials/JenkinsServiceProperties.java deleted file mode 100644 index 3f546b31e19..00000000000 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/credentials/JenkinsServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.organisasjonbestillingservice.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.jenkins") -public class JenkinsServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/config/Consumers.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/config/Consumers.java new file mode 100644 index 00000000000..9eef5389340 --- /dev/null +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.organisasjonfastedataservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties organisasjonBestillingService; + +} diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/config/credentials/OrganisasjonBestillingServiceProperties.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/config/credentials/OrganisasjonBestillingServiceProperties.java deleted file mode 100644 index d52d41670bd..00000000000 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/config/credentials/OrganisasjonBestillingServiceProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.registre.testnorge.organisasjonfastedataservice.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Setter -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.organisasjon-bestilling-service") -public class OrganisasjonBestillingServiceProperties extends ServerProperties { - private Integer threads; -} diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java index 41799f96c70..89d98e35e9c 100644 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java @@ -1,8 +1,9 @@ package no.nav.registre.testnorge.organisasjonfastedataservice.consumer; -import no.nav.registre.testnorge.organisasjonfastedataservice.config.credentials.OrganisasjonBestillingServiceProperties; +import no.nav.registre.testnorge.organisasjonfastedataservice.config.Consumers; import no.nav.registre.testnorge.organisasjonfastedataservice.consumer.command.GetOrdreCommand; import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -12,14 +13,13 @@ @Component public class OrganisasjonBestillingConsumer { private final WebClient webClient; - private final OrganisasjonBestillingServiceProperties serverProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public OrganisasjonBestillingConsumer( - OrganisasjonBestillingServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serverProperties = serverProperties; + serverProperties = consumers.getOrganisasjonBestillingService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/Consumers.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/Consumers.java new file mode 100644 index 00000000000..e34dc6e62f9 --- /dev/null +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/Consumers.java @@ -0,0 +1,35 @@ +package no.nav.organisasjonforvalter.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavAdresseService; + private ServerProperties genererNavnService; + private ServerProperties testnavMiljoerService; + private ServerProperties organisasjonBestillingService; + private ServerProperties testnavOrganisasjonService; + private ServerProperties testnavOrgnummerService; + + +} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/AdresseServiceProperties.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/AdresseServiceProperties.java deleted file mode 100644 index 1fb9984e207..00000000000 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/AdresseServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.organisasjonforvalter.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-adresse-service") -public class AdresseServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/GenererNavnServiceProperties.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/GenererNavnServiceProperties.java deleted file mode 100644 index 770bbf7ee4a..00000000000 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/GenererNavnServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.organisasjonforvalter.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.generer-navn-service") -public class GenererNavnServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/MiljoerServiceProperties.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/MiljoerServiceProperties.java deleted file mode 100644 index 3d454241f23..00000000000 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/MiljoerServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.organisasjonforvalter.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-miljoer-service") -public class MiljoerServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/OrganisasjonBestillingServiceProperties.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/OrganisasjonBestillingServiceProperties.java deleted file mode 100644 index 401b99c6f8c..00000000000 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/OrganisasjonBestillingServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.organisasjonforvalter.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.organisasjon-bestilling-service") -public class OrganisasjonBestillingServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/OrganisasjonServiceProperties.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index b2710faf6da..00000000000 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.nav.organisasjonforvalter.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Getter -@Setter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - - private int threads; -} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/TestnavOrgnummerServiceProperties.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/TestnavOrgnummerServiceProperties.java deleted file mode 100644 index f24da713883..00000000000 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/config/credentials/TestnavOrgnummerServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.organisasjonforvalter.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-orgnummer-service") -public class TestnavOrgnummerServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/AdresseServiceConsumer.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/AdresseServiceConsumer.java index 3c42e7a3e11..d8661811e24 100644 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/AdresseServiceConsumer.java +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/AdresseServiceConsumer.java @@ -1,9 +1,10 @@ package no.nav.organisasjonforvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.organisasjonforvalter.config.credentials.AdresseServiceProperties; +import no.nav.organisasjonforvalter.config.Consumers; import no.nav.organisasjonforvalter.consumer.command.AdresseServiceCommand; import no.nav.testnav.libs.dto.adresseservice.v1.VegadresseDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; @@ -18,16 +19,16 @@ public class AdresseServiceConsumer { private final WebClient webClient; - private final AdresseServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public AdresseServiceConsumer( - AdresseServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavAdresseService(); this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -48,7 +49,7 @@ public List getAdresser(String query) { long startTime = currentTimeMillis(); try { - var adresser = tokenExchange.exchange(serviceProperties) + var adresser = tokenExchange.exchange(serverProperties) .flatMap(token -> new AdresseServiceCommand(webClient, query, token.getTokenValue()).call()).block(); log.info("Adresseoppslag tok {} ms", currentTimeMillis() - startTime); diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/GenererNavnServiceConsumer.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/GenererNavnServiceConsumer.java index e41aa5e07fc..93226c6a644 100644 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/GenererNavnServiceConsumer.java +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/GenererNavnServiceConsumer.java @@ -1,8 +1,9 @@ package no.nav.organisasjonforvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.organisasjonforvalter.config.credentials.GenererNavnServiceProperties; +import no.nav.organisasjonforvalter.config.Consumers; import no.nav.testnav.libs.commands.generernavnservice.v1.GenererNavnCommand; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; @@ -24,15 +25,15 @@ public class GenererNavnServiceConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final GenererNavnServiceProperties serviceProperties; + private final ServerProperties serverProperties; public GenererNavnServiceConsumer( - GenererNavnServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getGenererNavnService(); this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -41,7 +42,7 @@ public List getOrgName(Integer antall) { long startTime = currentTimeMillis(); try { - var accessToken = tokenExchange.exchange(serviceProperties); + var accessToken = tokenExchange.exchange(serverProperties); var navn = new GenererNavnCommand(webClient, accessToken.block().getTokenValue(), antall).call(); log.info("Generer-navn-service svarte etter {} ms", currentTimeMillis() - startTime); diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/MiljoerServiceConsumer.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/MiljoerServiceConsumer.java index cd7a5ea618a..e6cb117a184 100644 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/MiljoerServiceConsumer.java +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/MiljoerServiceConsumer.java @@ -1,8 +1,9 @@ package no.nav.organisasjonforvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.organisasjonforvalter.config.credentials.MiljoerServiceProperties; +import no.nav.organisasjonforvalter.config.Consumers; import no.nav.organisasjonforvalter.consumer.command.MiljoerServiceCommand; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @@ -21,15 +22,15 @@ public class MiljoerServiceConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final MiljoerServiceProperties serviceProperties; + private final ServerProperties serverProperties; public MiljoerServiceConsumer( - MiljoerServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavMiljoerService(); this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -38,7 +39,7 @@ public MiljoerServiceConsumer( public Set getOrgMiljoer() { try { - return Stream.of(tokenExchange.exchange(serviceProperties) + return Stream.of(tokenExchange.exchange(serverProperties) .flatMap(token -> new MiljoerServiceCommand(webClient, token.getTokenValue()).call()).block()) .filter(env -> !env.equals("u5") && !env.equals("qx")) diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonBestillingConsumer.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonBestillingConsumer.java index c2ab87e2cb8..2a05f8976a6 100644 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonBestillingConsumer.java @@ -1,11 +1,12 @@ package no.nav.organisasjonforvalter.consumer; -import no.nav.organisasjonforvalter.config.credentials.OrganisasjonBestillingServiceProperties; +import no.nav.organisasjonforvalter.config.Consumers; import no.nav.organisasjonforvalter.consumer.command.OrganisasjonBestillingCommand; import no.nav.organisasjonforvalter.consumer.command.OrganisasjonBestillingIdsCommand; import no.nav.organisasjonforvalter.consumer.command.OrganisasjonBestillingStatusCommand; import no.nav.organisasjonforvalter.dto.responses.BestillingStatus; import no.nav.organisasjonforvalter.jpa.entity.Status; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Service; @@ -17,36 +18,36 @@ public class OrganisasjonBestillingConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final OrganisasjonBestillingServiceProperties serviceProperties; + private final ServerProperties serverProperties; public OrganisasjonBestillingConsumer( - OrganisasjonBestillingServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getOrganisasjonBestillingService(); this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } public Flux getBestillingStatus(Status status) { - return Flux.from(tokenExchange.exchange(serviceProperties) + return Flux.from(tokenExchange.exchange(serverProperties) .flatMap(token -> new OrganisasjonBestillingStatusCommand(webClient, status, token.getTokenValue()).call())); } public Flux getBestillingId(Status status) { - return Flux.from(tokenExchange.exchange(serviceProperties) + return Flux.from(tokenExchange.exchange(serverProperties) .flatMap(token -> new OrganisasjonBestillingIdsCommand(webClient, status, token.getTokenValue()).call())); } public BestillingStatus getBestillingStatus(String uuid) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(token -> new OrganisasjonBestillingCommand(webClient, Status.builder() .uuid(uuid) .build(), diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonOrgnummerServiceConsumer.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonOrgnummerServiceConsumer.java index f90eb46cda9..5dda07d389f 100644 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonOrgnummerServiceConsumer.java +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonOrgnummerServiceConsumer.java @@ -1,8 +1,9 @@ package no.nav.organisasjonforvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.organisasjonforvalter.config.credentials.TestnavOrgnummerServiceProperties; +import no.nav.organisasjonforvalter.config.Consumers; import no.nav.organisasjonforvalter.consumer.command.OrganisasjonOrgnummerServiceCommand; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; @@ -23,15 +24,15 @@ public class OrganisasjonOrgnummerServiceConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final TestnavOrgnummerServiceProperties serviceProperties; + private final ServerProperties serverProperties; public OrganisasjonOrgnummerServiceConsumer( - TestnavOrgnummerServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrgnummerService(); this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -40,7 +41,7 @@ public List getOrgnummer(Integer antall) { long startTime = currentTimeMillis(); try { - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(token -> new OrganisasjonOrgnummerServiceCommand(webClient, antall, token.getTokenValue()).call()) .block(); diff --git a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonServiceConsumer.java b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonServiceConsumer.java index db306cbd4f8..3bf3779ccd2 100644 --- a/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonServiceConsumer.java +++ b/apps/organisasjon-forvalter/src/main/java/no/nav/organisasjonforvalter/consumer/OrganisasjonServiceConsumer.java @@ -5,9 +5,10 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.organisasjonforvalter.config.credentials.OrganisasjonServiceProperties; +import no.nav.organisasjonforvalter.config.Consumers; import no.nav.testnav.libs.commands.organisasjonservice.v1.GetOrganisasjonCommand; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Service; @@ -30,19 +31,18 @@ public class OrganisasjonServiceConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final OrganisasjonServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final ExecutorService executorService; public OrganisasjonServiceConsumer( - OrganisasjonServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrganisasjonService(); this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; - this.executorService = Executors.newFixedThreadPool(serviceProperties.getThreads()); + this.executorService = Executors.newFixedThreadPool(serverProperties.getThreads()); } public Optional getStatus(String orgnummer, String miljoe) { @@ -59,7 +59,7 @@ public Map>> getStatus(Set long startTime = currentTimeMillis(); - var token = tokenExchange.exchange(serviceProperties).block().getTokenValue(); + var token = tokenExchange.exchange(serverProperties).block().getTokenValue(); var completables = miljoer.stream() .map(miljoe -> OrgFutureDTO.builder() diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/Consumers.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/Consumers.java new file mode 100644 index 00000000000..702b1125875 --- /dev/null +++ b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/Consumers.java @@ -0,0 +1,31 @@ +package no.nav.registre.testnorge.organisasjonmottak.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties jenkinsBatchStatusService; + private ServerProperties jenkins; + private ServerProperties organisasjonBestillingService; + +} diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/JenkinsBatchStatusServiceProperties.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/JenkinsBatchStatusServiceProperties.java deleted file mode 100644 index b4656e77a3e..00000000000 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/JenkinsBatchStatusServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.organisasjonmottak.config.properties; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.jenkins-batch-status-service") -public class JenkinsBatchStatusServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/JenkinsServiceProperties.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/JenkinsServiceProperties.java deleted file mode 100644 index 6282ceb1753..00000000000 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/JenkinsServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.organisasjonmottak.config.properties; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.jenkins") -public class JenkinsServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/OrganisasjonBestillingServiceProperties.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/OrganisasjonBestillingServiceProperties.java deleted file mode 100644 index 1ae52a4b280..00000000000 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/config/properties/OrganisasjonBestillingServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.organisasjonmottak.config.properties; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.organisasjon-bestilling-service") -public class OrganisasjonBestillingServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsBatchStatusConsumer.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsBatchStatusConsumer.java index 80cb9584ec5..41b250e67e3 100644 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsBatchStatusConsumer.java +++ b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsBatchStatusConsumer.java @@ -1,6 +1,6 @@ package no.nav.registre.testnorge.organisasjonmottak.consumer; -import no.nav.registre.testnorge.organisasjonmottak.config.properties.JenkinsBatchStatusServiceProperties; +import no.nav.registre.testnorge.organisasjonmottak.config.Consumers; import no.nav.registre.testnorge.organisasjonmottak.consumer.command.RegisterEregBestillingCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -11,21 +11,21 @@ public class JenkinsBatchStatusConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public JenkinsBatchStatusConsumer( - JenkinsBatchStatusServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - - this.properties = properties; + serverProperties = consumers.getJenkinsBatchStatusService(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public void registerBestilling(String uuid, String miljo, Long itemId) { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); new RegisterEregBestillingCommand(webClient, accessToken.getTokenValue(), uuid, miljo, itemId).run(); } } diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsConsumer.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsConsumer.java index ee1ca1e3fbf..cbca5cea52c 100644 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsConsumer.java +++ b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/JenkinsConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.testnorge.organisasjonmottak.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.organisasjonmottak.config.properties.JenkinsServiceProperties; +import no.nav.registre.testnorge.organisasjonmottak.config.Consumers; import no.nav.registre.testnorge.organisasjonmottak.consumer.command.StartBEREG007Command; import no.nav.registre.testnorge.organisasjonmottak.domain.Flatfil; import no.nav.testnav.libs.commands.GetCrumbCommand; @@ -21,29 +21,28 @@ public class JenkinsConsumer { private final Environment env; private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final OrganisasjonBestillingConsumer organisasjonBestillingConsumer; public JenkinsConsumer( Environment env, - JenkinsServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange, JenkinsBatchStatusConsumer jenkinsBatchStatusConsumer, OrganisasjonBestillingConsumer organisasjonBestillingConsumer) { - this.organisasjonBestillingConsumer = organisasjonBestillingConsumer; - this.properties = properties; + serverProperties = consumers.getJenkins(); this.tokenExchange = tokenExchange; this.jenkinsBatchStatusConsumer = jenkinsBatchStatusConsumer; this.env = env; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public void send(Flatfil flatFile, String miljo, Set uuids) { - var accessToken = tokenExchange.exchange(properties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); var server = env.getProperty("JENKINS_SERVER_" + miljo.toUpperCase()); if (server == null) { diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java index 205d5618bba..3963338dcb5 100644 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.testnorge.organisasjonmottak.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.organisasjonmottak.config.properties.OrganisasjonBestillingServiceProperties; +import no.nav.registre.testnorge.organisasjonmottak.config.Consumers; import no.nav.registre.testnorge.organisasjonmottak.consumer.command.RegisterBestillingCommand; import no.nav.testnav.libs.dto.organiasjonbestilling.v2.OrderDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -14,17 +14,16 @@ public class OrganisasjonBestillingConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public OrganisasjonBestillingConsumer( - OrganisasjonBestillingServiceProperties properties, + Consumers consumers, TokenExchange tokenExchange) { - - this.properties = properties; + serverProperties = consumers.getOrganisasjonBestillingService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -37,7 +36,7 @@ public void registerBestilling(String uuid, String miljo, Long queueId) { .uuid(uuid) .build(); - var order = tokenExchange.exchange(properties) + var order = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new RegisterBestillingCommand(webClient, accessToken.getTokenValue(), orderDTO).call()) .block(); log.info("Ordre med id:{} opprettet.", order.getId()); diff --git a/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/config/Consumers.java b/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/config/Consumers.java new file mode 100644 index 00000000000..9e3f6954eba --- /dev/null +++ b/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.organisasjonservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavEregProxy; + +} diff --git a/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/config/credentials/EregServiceProperties.java b/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/config/credentials/EregServiceProperties.java deleted file mode 100644 index 0b4fdc250cd..00000000000 --- a/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/config/credentials/EregServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.organisasjonservice.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-ereg-proxy") -public class EregServiceProperties extends ServerProperties { -} diff --git a/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/consumer/EregConsumer.java b/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/consumer/EregConsumer.java index 1f44ae07150..094eb3ff75c 100644 --- a/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/consumer/EregConsumer.java +++ b/apps/organisasjon-service/src/main/java/no/nav/registre/testnorge/organisasjonservice/consumer/EregConsumer.java @@ -1,10 +1,11 @@ package no.nav.registre.testnorge.organisasjonservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.organisasjonservice.config.credentials.EregServiceProperties; +import no.nav.registre.testnorge.organisasjonservice.config.Consumers; import no.nav.registre.testnorge.organisasjonservice.consumer.command.GetOrganisasjonCommand; import no.nav.registre.testnorge.organisasjonservice.consumer.dto.OrganisasjonDTO; import no.nav.registre.testnorge.organisasjonservice.domain.Organisasjon; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -14,23 +15,23 @@ @Component public class EregConsumer { private final WebClient webClient; - private final EregServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public EregConsumer( - EregServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getTestnavEregProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); - this.serviceProperties = serviceProperties; this.tokenExchange = tokenExchange; } public Organisasjon getOrganisasjon(String orgnummer, String miljo) { - var accessToken = tokenExchange.exchange(serviceProperties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); OrganisasjonDTO dto = new GetOrganisasjonCommand(webClient, accessToken.getTokenValue(), miljo, orgnummer).call(); return dto != null ? new Organisasjon(dto) : null; } diff --git a/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/OrganisasjonTilgangFrontendApplicationStarter.java b/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/OrganisasjonTilgangFrontendApplicationStarter.java index 0f8f334d9b7..e6e15ed3d06 100644 --- a/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/OrganisasjonTilgangFrontendApplicationStarter.java +++ b/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/OrganisasjonTilgangFrontendApplicationStarter.java @@ -1,7 +1,7 @@ package no.nav.testnav.apps.organisasjontilgangfrontend; import lombok.RequiredArgsConstructor; -import no.nav.testnav.apps.organisasjontilgangfrontend.credentials.TestnavOrganisasjonTilgangServiceProperties; +import no.nav.testnav.apps.organisasjontilgangfrontend.config.Consumers; import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig; import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory; @@ -32,17 +32,14 @@ @RequiredArgsConstructor public class OrganisasjonTilgangFrontendApplicationStarter { - private final TestnavOrganisasjonTilgangServiceProperties testnavOrganisasjonTilgangServiceProperties; + private final Consumers consumers; private final TokenExchange tokenExchange; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { return builder .routes() - .route(createRoute( - testnavOrganisasjonTilgangServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(testnavOrganisasjonTilgangServiceProperties) - )) + .route(createRoute(consumers.getTestnavOrganisasjonTilgangService())) .build(); } @@ -59,7 +56,9 @@ private GatewayFilter addAuthenticationHeaderFilterFrom(ServerProperties serverP }); } - private Function> createRoute(String host, GatewayFilter filter) { + private Function> createRoute(ServerProperties serverProperties) { + var host = serverProperties.getUrl(); + var filter = addAuthenticationHeaderFilterFrom(serverProperties); return spec -> spec .path("/organisasjon-tilgang-service/**") .filters(filterSpec -> filterSpec diff --git a/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/config/Consumers.java b/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/config/Consumers.java new file mode 100644 index 00000000000..b9ccbfe89d9 --- /dev/null +++ b/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.organisasjontilgangfrontend.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavOrganisasjonTilgangService; + +} diff --git a/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/credentials/TestnavOrganisasjonTilgangServiceProperties.java b/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/credentials/TestnavOrganisasjonTilgangServiceProperties.java deleted file mode 100644 index 92d5a58f5eb..00000000000 --- a/apps/organisasjon-tilgang-frontend/src/main/java/no/nav/testnav/apps/organisasjontilgangfrontend/credentials/TestnavOrganisasjonTilgangServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.organisasjontilgangfrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-tilgang-service") -public class TestnavOrganisasjonTilgangServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/Consumers.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/Consumers.java new file mode 100644 index 00000000000..40cbcebd0e8 --- /dev/null +++ b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.registre.orgnrservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavMiljoerService; + private ServerProperties testnavOrganisasjonService; + +} diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/MiljoerServiceProperties.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/MiljoerServiceProperties.java deleted file mode 100644 index 5b81c6013c4..00000000000 --- a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/MiljoerServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.orgnrservice.config.credentials; - - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-miljoer-service") -public class MiljoerServiceProperties extends ServerProperties { -} diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/OrganisasjonServiceProperties.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index 5144fac42c3..00000000000 --- a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,16 +0,0 @@ -package no.nav.registre.orgnrservice.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Setter -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - private Integer threads; -} diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java index 6c3f2c84034..ee5f741461d 100644 --- a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java +++ b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java @@ -1,10 +1,10 @@ package no.nav.registre.orgnrservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.orgnrservice.config.credentials.MiljoerServiceProperties; -import no.nav.registre.orgnrservice.config.credentials.OrganisasjonServiceProperties; +import no.nav.registre.orgnrservice.config.Consumers; import no.nav.registre.orgnrservice.consumer.command.GetOrganisasjonCommand; import no.nav.registre.orgnrservice.consumer.command.MiljoerCommand; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -25,22 +25,22 @@ public class OrganisasjonConsumer { private final WebClient organisasjonWebClient; private final WebClient miljoerWebClient; private final TokenExchange tokenExchange; - private final MiljoerServiceProperties miljoerServiceProperties; - private final OrganisasjonServiceProperties organisasjonServiceProperties; + private final ServerProperties miljoerServerProperties; + private final ServerProperties organisasjonServerProperties; public OrganisasjonConsumer( - MiljoerServiceProperties miljoerServiceProperties, - OrganisasjonServiceProperties organisasjonServiceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.miljoerServiceProperties = miljoerServiceProperties; - this.organisasjonServiceProperties = organisasjonServiceProperties; + miljoerServerProperties = consumers.getTestnavMiljoerService(); + organisasjonServerProperties = consumers.getTestnavOrganisasjonService(); this.tokenExchange = tokenExchange; - this.organisasjonWebClient = WebClient.builder() - .baseUrl(organisasjonServiceProperties.getUrl()) + this.organisasjonWebClient = WebClient + .builder() + .baseUrl(organisasjonServerProperties.getUrl()) .build(); - this.miljoerWebClient = WebClient.builder() - .baseUrl(miljoerServiceProperties.getUrl()) + this.miljoerWebClient = WebClient + .builder() + .baseUrl(miljoerServerProperties.getUrl()) .build(); } @@ -52,8 +52,8 @@ private static boolean supportedEnv(String miljoe) { public boolean finnesOrgnrIEreg(String orgnummer) { var organisasjoner = - Mono.zip(tokenExchange.exchange(miljoerServiceProperties), - tokenExchange.exchange(organisasjonServiceProperties)) + Mono.zip(tokenExchange.exchange(miljoerServerProperties), + tokenExchange.exchange(organisasjonServerProperties)) .flatMapMany(token -> new MiljoerCommand(miljoerWebClient, token.getT1().getTokenValue()).call() .flatMapMany(miljoer -> Flux.fromIterable(Arrays.asList(miljoer)) .filter(OrganisasjonConsumer::supportedEnv) diff --git a/apps/orgnummer-service/src/main/resources/application.yml b/apps/orgnummer-service/src/main/resources/application.yml index 30c23da1782..2112fa117a2 100644 --- a/apps/orgnummer-service/src/main/resources/application.yml +++ b/apps/orgnummer-service/src/main/resources/application.yml @@ -35,7 +35,6 @@ consumers: name: testnav-organisasjon-service cluster: dev-gcp namespace: dolly - threads: 5 testnav-miljoer-service: url: http://testnav-miljoer-service.dolly.svc.cluster.local name: testnav-miljoer-service diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/OversiktFrontendApplicationStarter.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/OversiktFrontendApplicationStarter.java index 05960b9f055..7ea13647004 100644 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/OversiktFrontendApplicationStarter.java +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/OversiktFrontendApplicationStarter.java @@ -1,8 +1,7 @@ package no.nav.testnav.apps.oversiktfrontend; import lombok.RequiredArgsConstructor; -import no.nav.testnav.apps.oversiktfrontend.credentials.PersonOrganisasjonTilgangServiceProperties; -import no.nav.testnav.apps.oversiktfrontend.credentials.ProfilApiServiceProperties; +import no.nav.testnav.apps.oversiktfrontend.config.Consumers; import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactivefrontend.config.FrontendConfig; import no.nav.testnav.libs.reactivefrontend.filter.AddAuthenticationHeaderToRequestGatewayFilterFactory; @@ -32,8 +31,7 @@ @RequiredArgsConstructor public class OversiktFrontendApplicationStarter { - private final ProfilApiServiceProperties profilApiServiceProperties; - private final PersonOrganisasjonTilgangServiceProperties personOrganisasjonTilgangServiceProperties; + private final Consumers consumers; private final TokenExchange tokenExchange; @Bean @@ -42,13 +40,13 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { .routes() .route(createRoute( "testnorge-profil-api", - profilApiServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(profilApiServiceProperties) + consumers.getTestnorgeProfilApi().getUrl(), + addAuthenticationHeaderFilterFrom(consumers.getTestnorgeProfilApi()) )) .route(createRoute( "testnav-organisasjon-tilgang-service", - personOrganisasjonTilgangServiceProperties.getUrl(), - addAuthenticationHeaderFilterFrom(personOrganisasjonTilgangServiceProperties) + consumers.getTestnavPersonOrganisasjonTilgangService().getUrl(), + addAuthenticationHeaderFilterFrom(consumers.getTestnavPersonOrganisasjonTilgangService()) )) .build(); } diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/config/Consumers.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/config/Consumers.java new file mode 100644 index 00000000000..9906d9803e5 --- /dev/null +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/config/Consumers.java @@ -0,0 +1,32 @@ +package no.nav.testnav.apps.oversiktfrontend.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavAppTilgangAnalyseService; + private ServerProperties testnavPersonOrganisasjonTilgangService; + private ServerProperties testnorgeProfilApi; + private ServerProperties testnavBrukerService; + +} diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/AppTilgangAnalyseConsumer.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/AppTilgangAnalyseConsumer.java index 74a3642a989..c7b7112ffe6 100644 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/AppTilgangAnalyseConsumer.java +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/AppTilgangAnalyseConsumer.java @@ -1,11 +1,12 @@ package no.nav.testnav.apps.oversiktfrontend.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.oversiktfrontend.config.Consumers; import no.nav.testnav.apps.oversiktfrontend.consumer.command.GetApplicationAccessCommand; -import no.nav.testnav.apps.oversiktfrontend.credentials.AppTilgangAnalyseServiceProperties; import no.nav.testnav.apps.oversiktfrontend.domain.Application; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; @@ -17,17 +18,17 @@ @Component public class AppTilgangAnalyseConsumer { private final WebClient webClient; - private final AppTilgangAnalyseServiceProperties appTilgangAnalyseServiceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; - public AppTilgangAnalyseConsumer(AppTilgangAnalyseServiceProperties appTilgangAnalyseServiceProperties, - TokenExchange tokenExchange) { - - this.appTilgangAnalyseServiceProperties = appTilgangAnalyseServiceProperties; + public AppTilgangAnalyseConsumer( + Consumers consumers, + TokenExchange tokenExchange) { + serverProperties = consumers.getTestnavAppTilgangAnalyseService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(appTilgangAnalyseServiceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -41,7 +42,7 @@ private Flux getApplications( Function getCommand ) { return tokenExchange - .exchange(appTilgangAnalyseServiceProperties) + .exchange(serverProperties) .flatMap(accessToken -> getCommand.apply(accessToken).call()) .map(access -> access .getAccessTo() diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/BrukerConsumer.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/BrukerConsumer.java index c94c59a7239..706b76f469d 100644 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/BrukerConsumer.java +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/BrukerConsumer.java @@ -1,11 +1,12 @@ package no.nav.testnav.apps.oversiktfrontend.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.oversiktfrontend.config.Consumers; import no.nav.testnav.apps.oversiktfrontend.consumer.command.GetBrukerCommand; import no.nav.testnav.apps.oversiktfrontend.consumer.command.GetTokenCommand; import no.nav.testnav.apps.oversiktfrontend.consumer.dto.BrukerDTO; -import no.nav.testnav.apps.oversiktfrontend.credentials.TestnavBrukerServiceProperties; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -15,27 +16,27 @@ @Component public class BrukerConsumer { private final WebClient webClient; - private final TestnavBrukerServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; - public BrukerConsumer(TestnavBrukerServiceProperties serviceProperties, - TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + public BrukerConsumer( + Consumers consumers, + TokenExchange tokenExchange) { + serverProperties = consumers.getTestnavBrukerService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Mono getBruker(String orgnummer) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetBrukerCommand(webClient, accessToken.getTokenValue(), orgnummer).call()); } public Mono getToken(String id) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetTokenCommand(webClient, accessToken.getTokenValue(), id).call()); } diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/PersonOrganisasjonTilgangConsumer.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/PersonOrganisasjonTilgangConsumer.java index 99fa37c188a..273a13b01a4 100644 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/PersonOrganisasjonTilgangConsumer.java +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/consumer/PersonOrganisasjonTilgangConsumer.java @@ -2,11 +2,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.oversiktfrontend.config.Consumers; import no.nav.testnav.apps.oversiktfrontend.consumer.command.GetPersonOrganisasjonTilgangCommand; import no.nav.testnav.apps.oversiktfrontend.consumer.command.GetPersonOrganisasjonerTilgangCommand; import no.nav.testnav.apps.oversiktfrontend.consumer.dto.OrganisasjonDTO; -import no.nav.testnav.apps.oversiktfrontend.credentials.PersonOrganisasjonTilgangServiceProperties; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.http.codec.json.Jackson2JsonEncoder; @@ -21,37 +22,41 @@ @Component public class PersonOrganisasjonTilgangConsumer { private final WebClient webClient; - private final PersonOrganisasjonTilgangServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public PersonOrganisasjonTilgangConsumer( - PersonOrganisasjonTilgangServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange, ObjectMapper objectMapper) { - - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavPersonOrganisasjonTilgangService(); this.tokenExchange = tokenExchange; - ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }).build(); + ExchangeStrategies jacksonStrategy = ExchangeStrategies + .builder() + .codecs( + config -> { + config + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + config + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) + .build(); this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Flux getOrganisasjoner() { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMapMany(accessToken -> new GetPersonOrganisasjonerTilgangCommand(webClient, accessToken.getTokenValue()).call()); } public Mono hasAccess(String organisasjonsnummer) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetPersonOrganisasjonTilgangCommand(webClient, accessToken.getTokenValue(), organisasjonsnummer).call()) .onErrorResume( WebClientResponseException.class::isInstance, diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/AppTilgangAnalyseServiceProperties.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/AppTilgangAnalyseServiceProperties.java deleted file mode 100644 index 65a40b7fce6..00000000000 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/AppTilgangAnalyseServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.oversiktfrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-app-tilgang-analyse-service") -public class AppTilgangAnalyseServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/PersonOrganisasjonTilgangServiceProperties.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/PersonOrganisasjonTilgangServiceProperties.java deleted file mode 100644 index 2d3cadcdcd8..00000000000 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/PersonOrganisasjonTilgangServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.oversiktfrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-organisasjon-tilgang-service") -public class PersonOrganisasjonTilgangServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/ProfilApiServiceProperties.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/ProfilApiServiceProperties.java deleted file mode 100644 index 4fb7c4e71c8..00000000000 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/ProfilApiServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.oversiktfrontend.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-profil-api") -public class ProfilApiServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/TestnavBrukerServiceProperties.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/TestnavBrukerServiceProperties.java deleted file mode 100644 index 6e0e1c565fb..00000000000 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/credentials/TestnavBrukerServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.oversiktfrontend.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-bruker-service") -public class TestnavBrukerServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/domain/Application.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/domain/Application.java index 6ae10c85871..6db5d0db456 100644 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/domain/Application.java +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/domain/Application.java @@ -3,7 +3,6 @@ import lombok.Value; import no.nav.testnav.apps.oversiktfrontend.dto.ApplicationDTO; -import no.nav.testnav.apps.oversiktfrontend.service.TokenService; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @Value @@ -34,7 +33,7 @@ public ApplicationDTO toDTO() { } public ServerProperties toServerProperties() { - return new TokenService.MagicServerProperties(cluster, namespace, name); + return ServerProperties.of(cluster, namespace, name, "http://valid.but.not.used"); } } diff --git a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/service/TokenService.java b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/service/TokenService.java index 7a315b87466..8bfbe285cf0 100644 --- a/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/service/TokenService.java +++ b/apps/oversikt-frontend/src/main/java/no/nav/testnav/apps/oversiktfrontend/service/TokenService.java @@ -14,22 +14,11 @@ public class TokenService { private final TokenExchange tokenExchange; public Mono getMagicToken() { - return tokenExchange.exchange(new MagicServerProperties("dev-gcp", "dolly", "team-dolly-lokal-app")); + return tokenExchange.exchange(ServerProperties.of("dev-gcp", "dolly", "team-dolly-lokal-app", "http://valid.but.not.used")); } public Mono getToken(Application application) { return tokenExchange.exchange(application.toServerProperties()); } - public static class MagicServerProperties extends ServerProperties { - public MagicServerProperties(String cluster, String namespace, String name) { - super(); - super.setCluster(cluster); - super.setNamespace(namespace); - super.setName(name); - super.setUrl("http://valid.but.not.used"); - } - - } - } diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/Consumers.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/Consumers.java new file mode 100644 index 00000000000..ea8ebbd9a00 --- /dev/null +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/Consumers.java @@ -0,0 +1,34 @@ +package no.nav.pdl.forvalter.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties adresseService; + private ServerProperties genererNavnService; + private ServerProperties geografiskeKodeverkService; + private ServerProperties identPool; + private ServerProperties orgForvalter; + private ServerProperties pdlService; + +} diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/AdresseServiceProperties.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/AdresseServiceProperties.java deleted file mode 100644 index 5e737255b5c..00000000000 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/AdresseServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.pdl.forvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.adresse-service") -public class AdresseServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/GenererNavnServiceProperties.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/GenererNavnServiceProperties.java deleted file mode 100644 index 182fa68f806..00000000000 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/GenererNavnServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.pdl.forvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.generer-navn-service") -public class GenererNavnServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/GeografiskeKodeverkServiceProperties.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/GeografiskeKodeverkServiceProperties.java deleted file mode 100644 index d3a56dd27d3..00000000000 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/GeografiskeKodeverkServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.pdl.forvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.geografiske-kodeverk-service") -public class GeografiskeKodeverkServiceProperties extends ServerProperties { -} diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/IdentPoolProperties.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/IdentPoolProperties.java deleted file mode 100644 index 09febecc43a..00000000000 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/IdentPoolProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.pdl.forvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.ident-pool") -public class IdentPoolProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/OrgForvalterServiceProperties.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/OrgForvalterServiceProperties.java deleted file mode 100644 index 0cc9cba422e..00000000000 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/OrgForvalterServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.pdl.forvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.org-forvalter") -public class OrgForvalterServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/PdlServiceProperties.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/PdlServiceProperties.java deleted file mode 100644 index bee30acc495..00000000000 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/config/credentials/PdlServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.pdl.forvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-service") -public class PdlServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/AdresseServiceConsumer.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/AdresseServiceConsumer.java index 43cc19d1798..4edede67b23 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/AdresseServiceConsumer.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/AdresseServiceConsumer.java @@ -1,7 +1,7 @@ package no.nav.pdl.forvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.pdl.forvalter.config.credentials.AdresseServiceProperties; +import no.nav.pdl.forvalter.config.Consumers; import no.nav.pdl.forvalter.consumer.command.MatrikkeladresseServiceCommand; import no.nav.pdl.forvalter.consumer.command.VegadresseServiceCommand; import no.nav.testnav.libs.data.pdlforvalter.v1.MatrikkeladresseDTO; @@ -23,16 +23,16 @@ public class AdresseServiceConsumer { private static final String UOPPGITT = "9999"; private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; - - public AdresseServiceConsumer(TokenExchange tokenExchange, - AdresseServiceProperties properties) { + private final ServerProperties serverProperties; + public AdresseServiceConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getAdresseService(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -41,7 +41,7 @@ public no.nav.testnav.libs.dto.adresseservice.v1.VegadresseDTO getVegadresse(Veg var startTime = currentTimeMillis(); if (UOPPGITT.equals(vegadresse.getKommunenummer())) { - var adresser = tokenExchange.exchange(properties) + var adresser = tokenExchange.exchange(serverProperties) .flatMap(token -> new VegadresseServiceCommand(webClient, new VegadresseDTO(), null, token.getTokenValue()).call()) .block(); @@ -55,7 +55,7 @@ public no.nav.testnav.libs.dto.adresseservice.v1.VegadresseDTO getVegadresse(Veg .build(); } - var adresser = tokenExchange.exchange(properties).flatMap( + var adresser = tokenExchange.exchange(serverProperties).flatMap( token -> new VegadresseServiceCommand(webClient, vegadresse, matrikkelId, token.getTokenValue()).call()) .block(); @@ -68,7 +68,7 @@ public no.nav.testnav.libs.dto.adresseservice.v1.MatrikkeladresseDTO getMatrikke var startTime = currentTimeMillis(); - var adresser = tokenExchange.exchange(properties).flatMap( + var adresser = tokenExchange.exchange(serverProperties).flatMap( token -> new MatrikkeladresseServiceCommand(webClient, adresse, matrikkelId, token.getTokenValue()).call()) .block(); diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GenererNavnServiceConsumer.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GenererNavnServiceConsumer.java index 6c9c156bb5d..e4bea7113bc 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GenererNavnServiceConsumer.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GenererNavnServiceConsumer.java @@ -1,7 +1,7 @@ package no.nav.pdl.forvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.pdl.forvalter.config.credentials.GenererNavnServiceProperties; +import no.nav.pdl.forvalter.config.Consumers; import no.nav.pdl.forvalter.consumer.command.GenererNavnServiceCommand; import no.nav.pdl.forvalter.consumer.command.VerifiserNavnServiceCommand; import no.nav.testnav.libs.dto.generernavnservice.v1.NavnDTO; @@ -23,22 +23,22 @@ public class GenererNavnServiceConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; - - public GenererNavnServiceConsumer(TokenExchange tokenExchange, - GenererNavnServiceProperties properties) { + private final ServerProperties serverProperties; + public GenererNavnServiceConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getGenererNavnService(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Optional getNavn(Integer antall) { - return Arrays.asList(tokenExchange.exchange(properties).flatMap( + return Arrays.asList(tokenExchange.exchange(serverProperties).flatMap( token -> new GenererNavnServiceCommand(webClient, NAVN_URL, antall, token.getTokenValue()).call()) .block()) .stream().findFirst(); @@ -46,7 +46,7 @@ public Optional getNavn(Integer antall) { public Boolean verifyNavn(NavnDTO navn) { - return tokenExchange.exchange(properties).flatMap( + return tokenExchange.exchange(serverProperties).flatMap( token -> new VerifiserNavnServiceCommand(webClient, NAVN_CHECK_URL, navn, token.getTokenValue()).call()) .block(); } diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GeografiskeKodeverkConsumer.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GeografiskeKodeverkConsumer.java index a773e77c2b7..9ee1353a760 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GeografiskeKodeverkConsumer.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/GeografiskeKodeverkConsumer.java @@ -1,7 +1,7 @@ package no.nav.pdl.forvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.pdl.forvalter.config.credentials.GeografiskeKodeverkServiceProperties; +import no.nav.pdl.forvalter.config.Consumers; import no.nav.pdl.forvalter.consumer.command.GeografiskeKodeverkCommand; import no.nav.testnav.libs.dto.geografiskekodeverkservice.v1.GeografiskeKodeverkDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -25,24 +25,24 @@ public class GeografiskeKodeverkConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private Flux kommuneKodeverkFlux; private Flux landkodeverkFlux; - public GeografiskeKodeverkConsumer(TokenExchange tokenExchange, - GeografiskeKodeverkServiceProperties properties) { - + public GeografiskeKodeverkConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getGeografiskeKodeverkService(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } private Flux cache(String url) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMapMany(token -> new GeografiskeKodeverkCommand(webClient, url, null, token.getTokenValue()).call()) .cache(Duration.ofDays(7)); } @@ -73,7 +73,7 @@ public String getTilfeldigLand() { public String getPoststedNavn(String postnummer) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMapMany(token -> new GeografiskeKodeverkCommand(webClient, POSTNUMMER_URL, "postnummer=" + postnummer, token.getTokenValue()).call()) .next() .blockOptional() @@ -83,7 +83,7 @@ public String getPoststedNavn(String postnummer) { public String getEmbeteNavn(String embete) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMapMany(token -> new GeografiskeKodeverkCommand(webClient, EMBETE_URL, "embetekode=" + embete, token.getTokenValue()).call()) .next() .blockOptional() diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/IdentPoolConsumer.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/IdentPoolConsumer.java index 34bc94da8f0..8dedeafed77 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/IdentPoolConsumer.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/IdentPoolConsumer.java @@ -1,7 +1,7 @@ package no.nav.pdl.forvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.pdl.forvalter.config.credentials.IdentPoolProperties; +import no.nav.pdl.forvalter.config.Consumers; import no.nav.pdl.forvalter.consumer.command.IdentpoolGetLedigCommand; import no.nav.pdl.forvalter.consumer.command.IdentpoolPostCommand; import no.nav.pdl.forvalter.consumer.command.IdentpoolPostVoidCommand; @@ -30,36 +30,36 @@ public class IdentPoolConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; - - public IdentPoolConsumer(TokenExchange tokenExchange, - IdentPoolProperties properties) { + private final ServerProperties serverProperties; + public IdentPoolConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getIdentPool(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Flux> acquireIdents(HentIdenterRequest request) { - return Flux.from(tokenExchange.exchange(properties).flatMap( + return Flux.from(tokenExchange.exchange(serverProperties).flatMap( token -> new IdentpoolPostCommand(webClient, ACQUIRE_IDENTS_URL, null, request, token.getTokenValue()).call())); } public Flux> releaseIdents(Set identer, Bruker bruker) { - return Flux.from(tokenExchange.exchange(properties).flatMap( + return Flux.from(tokenExchange.exchange(serverProperties).flatMap( token -> new IdentpoolPostCommand(webClient, RELEASE_IDENTS_URL, REKVIRERT_AV + bruker, identer, token.getTokenValue()).call())); } public Flux getErLedig(Set identer) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMapMany(token -> Flux.concat(identer.stream() .map(ident -> new IdentpoolGetLedigCommand(webClient, ident, token.getTokenValue()).call()) @@ -68,7 +68,7 @@ public Flux getErLedig(Set identer) { public Mono allokerIdent(String ident) { - return Mono.from(tokenExchange.exchange(properties).flatMap( + return Mono.from(tokenExchange.exchange(serverProperties).flatMap( token -> new IdentpoolPostVoidCommand(webClient, IBRUK_IDENTS_URL, null, AllokerIdentRequest.builder() .personidentifikator(ident) diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/OrganisasjonForvalterConsumer.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/OrganisasjonForvalterConsumer.java index 7eb4a480c80..a4015edc50f 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/OrganisasjonForvalterConsumer.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/OrganisasjonForvalterConsumer.java @@ -1,7 +1,7 @@ package no.nav.pdl.forvalter.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.pdl.forvalter.config.credentials.OrgForvalterServiceProperties; +import no.nav.pdl.forvalter.config.Consumers; import no.nav.pdl.forvalter.consumer.command.OrganisasjonForvalterCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; @@ -19,22 +19,22 @@ public class OrganisasjonForvalterConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; - - public OrganisasjonForvalterConsumer(TokenExchange tokenExchange, - OrgForvalterServiceProperties properties) { + private final ServerProperties serverProperties; + public OrganisasjonForvalterConsumer( + TokenExchange tokenExchange, + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = properties; + serverProperties = consumers.getOrgForvalter(); this.webClient = WebClient .builder() - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Map> get(String orgNummer) { - return tokenExchange.exchange(properties).flatMap( + return tokenExchange.exchange(serverProperties).flatMap( token -> new OrganisasjonForvalterCommand(webClient, IMPORT_ORG_URL, String.format("orgnummer=%s", orgNummer), token.getTokenValue()).call()) .block(); diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/PdlTestdataConsumer.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/PdlTestdataConsumer.java index 6716aad7df8..771e35e0456 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/PdlTestdataConsumer.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/consumer/PdlTestdataConsumer.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import no.nav.pdl.forvalter.config.credentials.PdlServiceProperties; +import no.nav.pdl.forvalter.config.Consumers; import no.nav.pdl.forvalter.consumer.command.PdlAktoerNpidCommand; import no.nav.pdl.forvalter.consumer.command.PdlDeleteCommandPdl; import no.nav.pdl.forvalter.consumer.command.PdlOpprettArtifactCommandPdl; @@ -37,19 +37,19 @@ public class PdlTestdataConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final ObjectMapper objectMapper; - public PdlTestdataConsumer(TokenExchange tokenExchange, - PdlServiceProperties properties, - ObjectMapper objectMapper) { - + public PdlTestdataConsumer( + TokenExchange tokenExchange, + Consumers consumers, + ObjectMapper objectMapper) { this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) - .filters(exchangeFilterFunctions -> - exchangeFilterFunctions.add(logRequest())) + serverProperties = consumers.getPdlService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) + .filters(exchangeFilterFunctions -> exchangeFilterFunctions.add(logRequest())) .build(); this.objectMapper = objectMapper; } @@ -79,7 +79,7 @@ private ExchangeFilterFunction logRequest() { public Flux send(OrdreRequest orders) { return tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMapMany(accessToken -> Flux.concat( Flux.fromIterable(orders.getSletting()) .parallel() @@ -101,7 +101,7 @@ public Flux send(OrdreRequest orders) { public Flux> delete(Set identer) { return Flux.from(tokenExchange - .exchange(properties) + .exchange(serverProperties) .flatMapMany(accessToken -> identer .stream() .map(ident -> Flux.from(new PdlDeleteCommandPdl(webClient, getBestillingUrl().get(PDL_SLETTING), ident, accessToken.getTokenValue()).call())) diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java index 34241993761..db04ad92139 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java @@ -66,10 +66,11 @@ public PersonDTO convert(PersonDTO person) { if (isTrue(type.getIsNew())) { + type.setFoedtEtter(person.getFoedsel().getFirst().getFoedselsdato().plusDays(index + 1L)); + nyPerson = handle(type, nyPerson); type.setKilde(isNotBlank(type.getKilde()) ? type.getKilde() : "Dolly"); type.setMaster(nonNull(type.getMaster()) ? type.getMaster() : DbVersjonDTO.Master.FREG); - type.setFoedtEtter(person.getFoedsel().getFirst().getFoedselsdato().plusDays(index + 1L)); } } return nyPerson; @@ -105,22 +106,31 @@ public void validate(IdentRequestDTO request) { private PersonDTO handle(IdentRequestDTO request, PersonDTO person) { - var nyPerson = isNotBlank(request.getEksisterendeIdent()) ? - - personRepository.findByIdent(request.getEksisterendeIdent()) - .orElseThrow(() -> new NotFoundException(String.format("Eksisterende ident %s ble ikke funnet", - request.getEksisterendeIdent()))) - .getPerson() : - - createPersonService.execute(PersonRequestDTO.builder() - .eksisterendeIdent(request.getEksisterendeIdent()) - .identtype(getIdenttype(request, person.getIdent())) - .kjoenn(getKjoenn(request, person.getIdent())) - .foedtEtter(getFoedtEtter(request, person.getIdent())) - .foedtFoer(getFoedtFoer(request, person.getIdent())) - .nyttNavn(mapperFacade.map(request.getNyttNavn(), NyttNavnDTO.class)) - .syntetisk(isSyntetisk(request, person.getIdent())) - .build()); + PersonDTO nyPerson = null; + + if (isNotBlank(request.getEksisterendeIdent())) { + + nyPerson = personRepository.findByIdent(request.getEksisterendeIdent()) + .orElseThrow(() -> new NotFoundException(String.format("Eksisterende ident %s ble ikke funnet", + request.getEksisterendeIdent()))) + .getPerson(); + } else { + + var nyRequest = PersonRequestDTO.builder() + .eksisterendeIdent(request.getEksisterendeIdent()) + .identtype(getIdenttype(request, person.getIdent())) + .kjoenn(getKjoenn(request, person.getIdent())) + .foedtEtter(getFoedtEtter(request, person.getIdent())) + .foedtFoer(getFoedtFoer(request, person.getIdent())) + .nyttNavn(mapperFacade.map(request.getNyttNavn(), NyttNavnDTO.class)) + .syntetisk(isSyntetisk(request, person.getIdent())) + .build(); + + if (nyRequest.getFoedtFoer().isBefore(nyRequest.getFoedtEtter())) { + nyRequest.setFoedtFoer(nyRequest.getFoedtEtter().plusDays(3)); + } + nyPerson = createPersonService.execute(nyRequest); + } var oppdatertPerson = swopIdentsService.execute(person.getIdent(), nyPerson.getIdent()); diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/Consumers.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/Consumers.java new file mode 100644 index 00000000000..e9b4af4af4f --- /dev/null +++ b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.testnav.apps.personexportapi.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties kodeverk; + private ServerProperties tpsForvalter; + +} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java index 6b5d44256d1..e426ddacbaa 100644 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java +++ b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Map; +import no.nav.testnav.apps.personexportapi.config.Consumers; import no.nav.testnav.apps.personexportapi.consumer.command.GetKodeverkCommand; -import no.nav.testnav.apps.personexportapi.consumer.credential.KodeverkProperties; import no.nav.testnav.apps.personexportapi.consumer.response.KodeverkBetydningerResponse; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; @@ -25,16 +25,16 @@ public class KodeverkConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; public KodeverkConsumer( TokenExchange tokenExchange, - KodeverkProperties serviceProperties) { - + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getKodeverk(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) @@ -55,7 +55,7 @@ public String getKodeverkOppslag(String kodeverk, String verdi) { @Cacheable(sync = true) public Map> getKodeverkByName(String kodeverk) { - var kodeverkResponse = tokenExchange.exchange(properties) + var kodeverkResponse = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetKodeverkCommand(webClient, accessToken.getTokenValue(), kodeverk).call()) .block(); diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java index 6217a70b446..e7d9d485d13 100644 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java +++ b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java @@ -1,14 +1,13 @@ package no.nav.testnav.apps.personexportapi.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.personexportapi.config.Consumers; import no.nav.testnav.apps.personexportapi.consumer.command.GetTpsfGrupperCommand; import no.nav.testnav.apps.personexportapi.consumer.command.GetTpsfMeldingerFromPageCommand; -import no.nav.testnav.apps.personexportapi.consumer.credential.TpsfProperties; import no.nav.testnav.apps.personexportapi.consumer.dto.GruppeDTO; import no.nav.testnav.apps.personexportapi.domain.Person; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; @@ -32,26 +31,25 @@ public class TpsfConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties properties; + private final ServerProperties serverProperties; private final ExecutorService executorService; public TpsfConsumer( TokenExchange tokenExchange, - TpsfProperties serviceProperties, - @Value("${consumers.tps-forvalter.threads}") Integer threads) { - + Consumers consumers) { this.tokenExchange = tokenExchange; - this.properties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + serverProperties = consumers.getTpsForvalter(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); - this.executorService = Executors.newFixedThreadPool(threads); + this.executorService = Executors.newFixedThreadPool(serverProperties.getThreads()); } private GruppeDTO getGruppe(String avspillingsgruppe) { log.info("Henter avspillingsgruppe med id {}...", avspillingsgruppe); - var list = tokenExchange.exchange(properties) + var list = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetTpsfGrupperCommand(webClient, accessToken.getTokenValue()).call()) .block(); @@ -71,7 +69,7 @@ private int getNumberOfPages(String avspillingsgruppe) { private CompletableFuture> getPersonFromPage(String avspillingsgruppe, int page, int numberOfPages) { return CompletableFuture.supplyAsync( - () -> tokenExchange.exchange(properties) + () -> tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetTpsfMeldingerFromPageCommand( webClient, accessToken.getTokenValue(), avspillingsgruppe, page).call()) .block(), diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/credential/KodeverkProperties.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/credential/KodeverkProperties.java deleted file mode 100644 index dd2dd7d21c0..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/credential/KodeverkProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.kodeverk") -public class KodeverkProperties extends ServerProperties { -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/credential/TpsfProperties.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/credential/TpsfProperties.java deleted file mode 100644 index f69fa3e48a4..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/credential/TpsfProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.tps-forvalter") -public class TpsfProperties extends ServerProperties { -} diff --git a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/Consumers.java b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/Consumers.java new file mode 100644 index 00000000000..ffba1b4d5d2 --- /dev/null +++ b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.personsearchservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavPdlProxy; + +} diff --git a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/credentials/PdlProxyProperties.java b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/credentials/PdlProxyProperties.java deleted file mode 100644 index a961c6b8a0b..00000000000 --- a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/credentials/PdlProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.testnorge.personsearchservice.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pdl-proxy") -public class PdlProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/ElasticSearchConsumer.java b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/ElasticSearchConsumer.java index f8a630ab72b..55851220bad 100644 --- a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/ElasticSearchConsumer.java +++ b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/ElasticSearchConsumer.java @@ -4,10 +4,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.personsearchservice.config.credentials.PdlProxyProperties; +import no.nav.registre.testnorge.personsearchservice.config.Consumers; import no.nav.registre.testnorge.personsearchservice.consumer.command.ElasticSearchCommand; import no.nav.registre.testnorge.personsearchservice.model.Response; import no.nav.registre.testnorge.personsearchservice.model.SearchResponse; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.opensearch.action.search.SearchRequest; import org.springframework.stereotype.Component; @@ -23,24 +24,26 @@ public class ElasticSearchConsumer { private final ObjectMapper objectMapper; private final WebClient webClient; private final TokenExchange tokenExchange; - private final PdlProxyProperties pdlProxyProperties; + private final ServerProperties serverProperties; - public ElasticSearchConsumer(TokenExchange tokenExchange, - PdlProxyProperties pdlProxyProperties, - ObjectMapper objectMapper) { - - this.webClient = WebClient.builder() - .baseUrl(pdlProxyProperties.getUrl()) + public ElasticSearchConsumer( + TokenExchange tokenExchange, + Consumers consumers, + ObjectMapper objectMapper + ) { + serverProperties = consumers.getTestnavPdlProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) .build(); this.tokenExchange = tokenExchange; - this.pdlProxyProperties = pdlProxyProperties; this.objectMapper = objectMapper; } @SneakyThrows private Flux getSearchResponse(SearchRequest searchRequest) { - return tokenExchange.exchange(pdlProxyProperties) + return tokenExchange.exchange(serverProperties) .flatMapMany(token -> new ElasticSearchCommand(webClient, searchRequest.indices()[0], token.getTokenValue(), searchRequest.source().toString()).call()) .map(SearchResponse::getHits) diff --git a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/config/Consumers.java b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/config/Consumers.java new file mode 100644 index 00000000000..f5191676903 --- /dev/null +++ b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.personservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties pdlProxy; + +} diff --git a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/config/credentials/PdlProxyProperties.java b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/config/credentials/PdlProxyProperties.java deleted file mode 100644 index 8b4d89335a8..00000000000 --- a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/config/credentials/PdlProxyProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.personservice.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-proxy") -public class PdlProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlApiConsumer.java b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlApiConsumer.java index 16ad7610911..65143c79100 100644 --- a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlApiConsumer.java +++ b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlApiConsumer.java @@ -2,12 +2,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.personservice.config.credentials.PdlProxyProperties; +import no.nav.testnav.apps.personservice.config.Consumers; import no.nav.testnav.apps.personservice.consumer.v1.command.GetPdlAktoerCommand; import no.nav.testnav.apps.personservice.consumer.v1.command.GetPdlPersonCommand; import no.nav.testnav.apps.personservice.consumer.v1.pdl.graphql.MetadataDTO; import no.nav.testnav.apps.personservice.consumer.v1.pdl.graphql.PdlAktoer; import no.nav.testnav.apps.personservice.domain.Person; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; @@ -37,29 +38,31 @@ public class PdlApiConsumer { private static final String PDL_Q1_URL = "/pdl-api-q1"; private final WebClient webClient; - private final PdlProxyProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public PdlApiConsumer( - PdlProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange, - ObjectMapper objectMapper) { - - this.serviceProperties = serviceProperties; + ObjectMapper objectMapper + ) { + serverProperties = consumers.getPdlProxy(); this.tokenExchange = tokenExchange; ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) + .codecs( + config -> { + config + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + config + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) .build(); - this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -67,7 +70,7 @@ public Mono> getPerson(String ident) { log.info("Henter person {} fra PDL", ident); return tokenExchange - .exchange(serviceProperties) + .exchange(serverProperties) .flatMap(token -> new GetPdlPersonCommand(webClient, PDL_URL, ident, token.getTokenValue()).call()) .map(pdlPerson -> { if (pdlPerson.getErrors().stream().anyMatch(value -> value.getMessage().equals("Fant ikke person"))) { @@ -140,7 +143,7 @@ public Mono> getAktoer(String ident) { log.info("Henter ident {} fra PDL", ident); return tokenExchange - .exchange(serviceProperties) + .exchange(serverProperties) .flatMap(token -> Mono.zip(new GetPdlAktoerCommand(webClient, PDL_URL, ident, token.getTokenValue()).call(), new GetPdlAktoerCommand(webClient, PDL_Q1_URL, ident, token.getTokenValue()).call()) .map(tuple -> { @@ -154,7 +157,7 @@ public Mono> getAktoer(String ident) { public Mono isPerson(String ident, Set opplysningId) { return tokenExchange - .exchange(serviceProperties) + .exchange(serverProperties) .flatMap(token -> Mono.zip(new GetPdlAktoerCommand(webClient, PDL_Q1_URL, ident, token.getTokenValue()).call(), new GetPdlAktoerCommand(webClient, PDL_URL, ident, token.getTokenValue()).call()) .map(tuple -> isPresent(ident, tuple, opplysningId))); diff --git a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlTestdataConsumer.java b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlTestdataConsumer.java index 4ac3a7c0ab6..ed8dfdbb406 100644 --- a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlTestdataConsumer.java +++ b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v1/PdlTestdataConsumer.java @@ -2,20 +2,16 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.personservice.consumer.v1.command.OpprettFoedselCommand; -import no.nav.testnav.apps.personservice.consumer.v1.command.OpprettPersonCommand; -import no.nav.testnav.apps.personservice.consumer.v1.command.PostAdresseCommand; -import no.nav.testnav.apps.personservice.consumer.v1.command.PostNavnCommand; -import no.nav.testnav.apps.personservice.consumer.v1.command.PostTagsCommand; +import no.nav.testnav.apps.personservice.config.Consumers; +import no.nav.testnav.apps.personservice.consumer.v1.command.*; import no.nav.testnav.apps.personservice.consumer.v1.exception.PdlCreatePersonException; -import no.nav.testnav.apps.personservice.config.credentials.PdlProxyProperties; import no.nav.testnav.apps.personservice.domain.Person; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.ExchangeStrategies; import org.springframework.web.reactive.function.client.WebClient; @@ -25,28 +21,31 @@ public class PdlTestdataConsumer { private final WebClient webClient; - private final PdlProxyProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public PdlTestdataConsumer( - PdlProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange, - ObjectMapper objectMapper) { - - this.serviceProperties = serviceProperties; + ObjectMapper objectMapper + ) { + serverProperties = consumers.getPdlProxy(); this.tokenExchange = tokenExchange; - ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() + ExchangeStrategies jacksonStrategy = ExchangeStrategies + .builder() .codecs(config -> { - config.defaultCodecs() + config + .defaultCodecs() .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() + config + .defaultCodecs() .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }).build(); - + }) + .build(); this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -81,7 +80,7 @@ public String ordrePerson(Person person, String kilde) { log.info("Oppretter person med ident {} i PDL", person.getIdent()); try { - var accessToken = tokenExchange.exchange(serviceProperties).block(); + var accessToken = tokenExchange.exchange(serverProperties).block(); opprettPerson(person, kilde, accessToken); opprettNavn(person, kilde, accessToken); opprettAdresse(person, kilde, accessToken); diff --git a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v2/PdlPersonConsumer.java b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v2/PdlPersonConsumer.java index 40a69cb2909..844b7fe7b32 100644 --- a/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v2/PdlPersonConsumer.java +++ b/apps/person-service/src/main/java/no/nav/testnav/apps/personservice/consumer/v2/PdlPersonConsumer.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import lombok.val; -import no.nav.testnav.apps.personservice.config.credentials.PdlProxyProperties; +import no.nav.testnav.apps.personservice.config.Consumers; import no.nav.testnav.apps.personservice.consumer.v2.commad.PdlBolkPersonCommand; import no.nav.testnav.apps.personservice.consumer.v2.commad.PdlPersonGetCommand; import no.nav.testnav.apps.personservice.provider.v2.PdlMiljoer; @@ -34,40 +34,43 @@ public class PdlPersonConsumer { private final TokenExchange tokenService; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final WebClient webClient; public PdlPersonConsumer( TokenExchange tokenService, - PdlProxyProperties serverProperties, + Consumers consumers, ObjectMapper objectMapper, WebClient.Builder webClientBuilder ) { - this.serviceProperties = serverProperties; + serverProperties = consumers.getPdlProxy(); this.tokenService = tokenService; webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create(ConnectionProvider.builder("custom") - .maxConnections(10) - .pendingAcquireMaxCount(5000) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()) - .responseTimeout(Duration.ofSeconds(5)))) + .clientConnector( + new ReactorClientHttpConnector( + HttpClient.create( + ConnectionProvider + .builder("custom") + .maxConnections(10) + .pendingAcquireMaxCount(5000) + .pendingAcquireTimeout(Duration.ofMinutes(15)) + .build()) + .responseTimeout(Duration.ofSeconds(5)))) .build(); } public Mono getPdlPerson(String ident, PdlMiljoer pdlMiljoe) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap((AccessToken token) -> new PdlPersonGetCommand(webClient, ident, token.getTokenValue(), pdlMiljoe) .call()); } public Mono getPdlPersoner(List identer) { - return tokenService.exchange(serviceProperties) + return tokenService.exchange(serverProperties) .flatMap(token -> new PdlBolkPersonCommand(webClient, identer, token.getTokenValue()).call()); } diff --git a/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/config/Consumers.java b/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/config/Consumers.java new file mode 100644 index 00000000000..121e1e769d9 --- /dev/null +++ b/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.profil.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavPersonOrganisasjonTilgangService; + +} diff --git a/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/config/TestnavPersonOrganisasjonTilgangServiceProperties.java b/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/config/TestnavPersonOrganisasjonTilgangServiceProperties.java deleted file mode 100644 index f74fef2e1ce..00000000000 --- a/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/config/TestnavPersonOrganisasjonTilgangServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.profil.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-organisasjon-tilgang-service") -public class TestnavPersonOrganisasjonTilgangServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/consumer/PersonOrganisasjonTilgangConsumer.java b/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/consumer/PersonOrganisasjonTilgangConsumer.java index 311c16186b0..2f466963955 100644 --- a/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/consumer/PersonOrganisasjonTilgangConsumer.java +++ b/apps/profil-api/src/main/java/no/nav/registre/testnorge/profil/consumer/PersonOrganisasjonTilgangConsumer.java @@ -2,9 +2,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.profil.config.TestnavPersonOrganisasjonTilgangServiceProperties; +import no.nav.registre.testnorge.profil.config.Consumers; import no.nav.registre.testnorge.profil.consumer.command.GetPersonOrganisasjonTilgangCommand; import no.nav.registre.testnorge.profil.consumer.dto.OrganisasjonDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; @@ -20,34 +21,37 @@ @Component public class PersonOrganisasjonTilgangConsumer { private final WebClient webClient; - private final TestnavPersonOrganisasjonTilgangServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public PersonOrganisasjonTilgangConsumer( - TestnavPersonOrganisasjonTilgangServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange, - ObjectMapper objectMapper) { - - this.serviceProperties = serviceProperties; + ObjectMapper objectMapper + ) { + serverProperties = consumers.getTestnavPersonOrganisasjonTilgangService(); this.tokenExchange = tokenExchange; - ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) + ExchangeStrategies jacksonStrategy = ExchangeStrategies + .builder() + .codecs( + config -> { + config + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + config + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) .build(); - this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public Mono getOrganisasjon(String organisasjonsnummer) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetPersonOrganisasjonTilgangCommand(webClient, accessToken.getTokenValue(), organisasjonsnummer).call()) .onErrorResume( WebClientResponseException.class::isInstance, diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/Consumers.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/Consumers.java new file mode 100644 index 00000000000..a66743fa4f9 --- /dev/null +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/Consumers.java @@ -0,0 +1,34 @@ +package no.nav.testnav.apps.syntsykemeldingapi.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavArbeidsforholdService; + private ServerProperties testnavHelsepersonellService; + private ServerProperties testnavOrganisasjonService; + private ServerProperties testnavPdlProxy; + private ServerProperties sykemeldingApi; + private ServerProperties syntSykemelding; + +} diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/ArbeidsforholdServiceProperties.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/ArbeidsforholdServiceProperties.java deleted file mode 100644 index 77e65c96583..00000000000 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/ArbeidsforholdServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.syntsykemeldingapi.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-arbeidsforhold-service") -public class ArbeidsforholdServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/HelsepersonellServiceProperties.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/HelsepersonellServiceProperties.java deleted file mode 100644 index 40f56ee83a8..00000000000 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/HelsepersonellServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.syntsykemeldingapi.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-helsepersonell-service") -public class HelsepersonellServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/OrganisasjonServiceProperties.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index 30b9bbef27b..00000000000 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,13 +0,0 @@ -package no.nav.testnav.apps.syntsykemeldingapi.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - -} diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/PdlProxyProperties.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/PdlProxyProperties.java deleted file mode 100644 index de8361fd207..00000000000 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/PdlProxyProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.syntsykemeldingapi.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pdl-proxy") -public class PdlProxyProperties extends ServerProperties { -} diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/SykemeldingProperties.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/SykemeldingProperties.java deleted file mode 100644 index 5569d93a0b5..00000000000 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/SykemeldingProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.syntsykemeldingapi.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.sykemelding-api") -public class SykemeldingProperties extends ServerProperties { -} diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/SyntSykemeldingProperties.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/SyntSykemeldingProperties.java deleted file mode 100644 index 25c0f68c241..00000000000 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/config/credentials/SyntSykemeldingProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.syntsykemeldingapi.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-sykemelding") -public class SyntSykemeldingProperties extends ServerProperties { -} diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumer.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumer.java index 8c0e780199f..dab75aeb371 100644 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumer.java +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumer.java @@ -2,9 +2,10 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.ArbeidsforholdServiceProperties; +import no.nav.testnav.apps.syntsykemeldingapi.config.Consumers; import no.nav.testnav.apps.syntsykemeldingapi.consumer.command.GetArbeidsforholdCommand; import no.nav.testnav.libs.dto.oppsummeringsdokumentservice.v1.ArbeidsforholdDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; @@ -15,24 +16,23 @@ public class ArbeidsforholdConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final ArbeidsforholdServiceProperties serviceProperties; + private final ServerProperties serverProperties; public ArbeidsforholdConsumer( TokenExchange tokenExchange, - ArbeidsforholdServiceProperties serviceProperties) { - + Consumers consumers) { this.tokenExchange = tokenExchange; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavArbeidsforholdService(); this.webClient = WebClient .builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @SneakyThrows public ArbeidsforholdDTO getArbeidsforhold(String ident, String orgnummer, String arbeidsforholdId) { log.info("Henter arbeidsforhold for {} i org {} med id {}", ident, orgnummer, arbeidsforholdId); - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetArbeidsforholdCommand( webClient, accessToken.getTokenValue(), diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumer.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumer.java index d3b7d3b598a..764ecafc324 100644 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumer.java +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumer.java @@ -2,10 +2,11 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.HelsepersonellServiceProperties; +import no.nav.testnav.apps.syntsykemeldingapi.config.Consumers; import no.nav.testnav.apps.syntsykemeldingapi.consumer.command.GetHelsepersonellCommand; import no.nav.testnav.apps.syntsykemeldingapi.domain.HelsepersonellListe; import no.nav.testnav.apps.syntsykemeldingapi.exception.HelsepersonellNotFoundException; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; @@ -19,24 +20,23 @@ public class HelsepersonellConsumer { private final TokenExchange tokenExchange; private final WebClient webClient; - private final HelsepersonellServiceProperties serviceProperties; + private final ServerProperties serverProperties; public HelsepersonellConsumer( TokenExchange tokenExchange, - HelsepersonellServiceProperties serviceProperties) { - + Consumers consumers) { this.tokenExchange = tokenExchange; - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavHelsepersonellService(); this.webClient = WebClient .builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @SneakyThrows public HelsepersonellListe hentHelsepersonell() { log.info("Henter helsepersonell..."); - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetHelsepersonellCommand(webClient, accessToken.getTokenValue()).call()) .block(); diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumer.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumer.java index e0e0429c22a..9ec63bd3238 100644 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumer.java +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumer.java @@ -1,34 +1,34 @@ package no.nav.testnav.apps.syntsykemeldingapi.consumer; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.OrganisasjonServiceProperties; +import no.nav.testnav.apps.syntsykemeldingapi.config.Consumers; import no.nav.testnav.apps.syntsykemeldingapi.consumer.command.GetOrganisasjonCommand; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @Component public class OrganisasjonConsumer { - private final OrganisasjonServiceProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; private final WebClient webClient; private static final String MILJOE = "q1"; public OrganisasjonConsumer( - OrganisasjonServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnavOrganisasjonService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } public OrganisasjonDTO getOrganisasjon(String orgnummer) { - return tokenExchange.exchange(serviceProperties).flatMap(accessToken -> + return tokenExchange.exchange(serverProperties).flatMap(accessToken -> new GetOrganisasjonCommand(webClient, accessToken.getTokenValue(), orgnummer, MILJOE).call()) .block(); } diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumer.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumer.java index 9d4cf703f59..2b718ea5212 100644 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumer.java +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.apps.syntsykemeldingapi.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.PdlProxyProperties; +import no.nav.testnav.apps.syntsykemeldingapi.config.Consumers; import no.nav.testnav.apps.syntsykemeldingapi.consumer.command.GetPdlPersonCommand; import no.nav.testnav.apps.syntsykemeldingapi.domain.pdl.PdlPerson; import no.nav.testnav.apps.syntsykemeldingapi.exception.PdlPersonException; @@ -26,24 +26,25 @@ @Component public class PdlProxyConsumer { private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final WebClient webClient; private static final String SINGLE_PERSON_QUERY = "pdlperson/pdlquery.graphql"; public PdlProxyConsumer( - PdlProxyProperties pdlProxyProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = pdlProxyProperties; + serverProperties = consumers.getTestnavPdlProxy(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() + this.webClient = WebClient + .builder() + .exchangeStrategies(ExchangeStrategies + .builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) - .baseUrl(pdlProxyProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -53,7 +54,7 @@ public PdlPerson getPdlPerson(String ident) { } try { var query = getQueryFromFile(SINGLE_PERSON_QUERY); - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetPdlPersonCommand(ident, query, accessToken.getTokenValue(), webClient).call()) .block(); if (nonNull(response) && !response.getErrors().isEmpty()) { diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumer.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumer.java index 32b3a715ef4..ebdbb06776e 100644 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumer.java +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.apps.syntsykemeldingapi.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.SykemeldingProperties; +import no.nav.testnav.apps.syntsykemeldingapi.config.Consumers; import no.nav.testnav.apps.syntsykemeldingapi.consumer.command.PostSykemeldingCommand; import no.nav.testnav.libs.dto.sykemelding.v1.SykemeldingDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -15,22 +15,22 @@ public class SykemeldingConsumer { private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final WebClient webClient; public SykemeldingConsumer( - SykemeldingProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + serverProperties = consumers.getSykemeldingApi(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public void opprettSykemelding(SykemeldingDTO sykemelding) { - tokenExchange.exchange(serviceProperties).flatMap(accessToken -> + tokenExchange.exchange(serverProperties).flatMap(accessToken -> new PostSykemeldingCommand(webClient, accessToken.getTokenValue(), sykemelding).call()) .block(); } diff --git a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumer.java b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumer.java index a8a49528784..b24c6224954 100644 --- a/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumer.java +++ b/apps/synt-sykemelding-api/src/main/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumer.java @@ -2,7 +2,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.SyntSykemeldingProperties; +import no.nav.testnav.apps.syntsykemeldingapi.config.Consumers; import no.nav.testnav.apps.syntsykemeldingapi.consumer.command.PostSyntSykemeldingCommand; import no.nav.testnav.apps.syntsykemeldingapi.consumer.dto.SyntSykemeldingHistorikkDTO; import no.nav.testnav.apps.syntsykemeldingapi.exception.GenererSykemeldingerException; @@ -22,22 +22,23 @@ public class SyntElsamConsumer { private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final WebClient webClient; public SyntElsamConsumer( - SyntSykemeldingProperties syntProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = syntProperties; + serverProperties = consumers.getSyntSykemelding(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() + this.webClient = WebClient + .builder() + .exchangeStrategies(ExchangeStrategies + .builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) - .baseUrl(syntProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -47,7 +48,7 @@ public SyntSykemeldingHistorikkDTO genererSykemeldinger(String ident, LocalDate var request = Map.of(ident, startDato.toString()); - var response = tokenExchange.exchange(serviceProperties).flatMap(accessToken -> + var response = tokenExchange.exchange(serverProperties).flatMap(accessToken -> new PostSyntSykemeldingCommand(request, accessToken.getTokenValue(), webClient).call()) .block(); diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java index 9dd5270ee0c..da2d3262e83 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.ArbeidsforholdServiceProperties; import no.nav.testnav.libs.dto.oppsummeringsdokumentservice.v1.ArbeidsforholdDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -58,7 +58,7 @@ public class ArbeidsforholdConsumerTest { @Before public void before() { WireMock.reset(); - when(tokenService.exchange(ArgumentMatchers.any(ArbeidsforholdServiceProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); arbeidsforholdResponse = getTestArbeidsforholdDTO(arbeidsforholdId, orgnr); } diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java index 943c714ddcb..06e4636c8d3 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.HelsepersonellServiceProperties; import no.nav.testnav.libs.dto.helsepersonell.v1.HelsepersonellListeDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -55,7 +55,7 @@ public class HelsepersonellConsumerTest { @Before public void before() { WireMock.reset(); - when(tokenService.exchange(ArgumentMatchers.any(HelsepersonellServiceProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); helsepersonellResponse = getTestLegeListeDTO(); } diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java index dd218e07728..c4d5863f604 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.OrganisasjonServiceProperties; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -55,7 +55,7 @@ public class OrganisasjonConsumerTest { @Before public void before() { WireMock.reset(); - when(tokenService.exchange(ArgumentMatchers.any(OrganisasjonServiceProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); organisasjonResponse = getTestOrganisasjonDTO(orgnr); } diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java index 808df3a2895..e41ca52e23e 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.PdlProxyProperties; import no.nav.testnav.apps.syntsykemeldingapi.domain.pdl.PdlPerson; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -55,7 +55,7 @@ public class PdlProxyConsumerTest { @Before public void before() { WireMock.reset(); - when(tokenService.exchange(ArgumentMatchers.any(PdlProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); pdlResponse = getTestPdlPerson(ident); } diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java index 28aa0b7c631..79c2b3dea2a 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.SykemeldingProperties; import no.nav.testnav.apps.syntsykemeldingapi.consumer.dto.SyntSykemeldingHistorikkDTO; import no.nav.testnav.apps.syntsykemeldingapi.domain.Arbeidsforhold; import no.nav.testnav.apps.syntsykemeldingapi.domain.Helsepersonell; @@ -16,6 +15,7 @@ import no.nav.testnav.libs.dto.sykemelding.v1.SykemeldingDTO; import no.nav.testnav.libs.dto.synt.sykemelding.v1.SyntSykemeldingDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -83,7 +83,7 @@ public class SykemeldingConsumerTest { @Before public void setUp() { - when(tokenService.exchange(ArgumentMatchers.any(SykemeldingProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); dto = SyntSykemeldingDTO.builder() .arbeidsforholdId(arbeidsforholdId) diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java index d84d0738e36..e568818dcc9 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.testnav.apps.syntsykemeldingapi.config.credentials.SyntSykemeldingProperties; import no.nav.testnav.apps.syntsykemeldingapi.consumer.dto.SyntSykemeldingHistorikkDTO; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -58,7 +58,7 @@ public class SyntElsamConsumerTest { @Before public void before() { WireMock.reset(); - when(tokenService.exchange(ArgumentMatchers.any(SyntSykemeldingProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); syntResponse = getTestHistorikk(ident); } diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/config/Consumers.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/config/Consumers.java new file mode 100644 index 00000000000..4cfc1d14e2c --- /dev/null +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/config/Consumers.java @@ -0,0 +1,36 @@ +package no.nav.testnav.apps.syntvedtakshistorikkservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavArenaForvalterenProxy; + private ServerProperties testnavInntektstubProxy; + private ServerProperties testnavOrganisasjonFasteDataService; + private ServerProperties pdlApiProxy; + private ServerProperties testnavPensjonTestdataFacadeProxy; + private ServerProperties testnavPersonSearchService; + private ServerProperties syntDagpenger; + private ServerProperties syntVedtakshistorikk; + +} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumer.java index af1b2330dbb..ebf6163dd63 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumer.java @@ -1,6 +1,7 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.arena.GetArenaBrukereCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.arena.PostArenaBrukerCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.arena.PostDagpengerCommand; @@ -8,7 +9,6 @@ import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.arena.PostFinnTiltakCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.arena.PostRettighetCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.arena.SlettArenaBrukerCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.ArenaForvalterenProxyProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.arena.EndreInnsatsbehovRequest; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.arena.FinnTiltakRequest; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.arena.rettighet.RettighetRequest; @@ -42,19 +42,19 @@ public class ArenaForvalterConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private static final String MOTTA_DAGPENGESOKNAD_PATH = "/api/v1/mottadagpengesoknad"; private static final String MOTTA_DAGPENGEVEDTAK_PATH = "/api/v1/mottadagpengevedtak"; private static final String DAGPENGEVEDTAK_PATH = "/api/v1/dagpenger"; public ArenaForvalterConsumer( - ArenaForvalterenProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getTestnavArenaForvalterenProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -63,7 +63,7 @@ public NyeBrukereResponse sendBrukereTilArenaForvalter( List nyeBrukere ) { try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostArenaBrukerCommand(nyeBrukere, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -74,7 +74,7 @@ public NyeBrukereResponse sendBrukereTilArenaForvalter( public void slettBrukerIArenaForvalteren(String ident, String miljoe) { try { - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new SlettArenaBrukerCommand(ident, miljoe, accessToken.getTokenValue(), webClient).call()) .block(); @@ -92,7 +92,7 @@ public Map> opprettRettighet(List new PostRettighetCommand(rettighet, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -117,7 +117,7 @@ public Map> opprettRettighet(List new PostFinnTiltakCommand(rettighet, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -129,7 +129,7 @@ public NyttVedtakResponse finnTiltak(FinnTiltakRequest rettighet) { public void endreInnsatsbehovForBruker(EndreInnsatsbehovRequest endreRequest) { EndreInnsatsbehovResponse response = null; try { - response = tokenExchange.exchange(serviceProperties) + response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostEndreInnsatsbehovCommand(endreRequest, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -150,7 +150,7 @@ public List hentArbeidsoekere( var queryParams = getQueryParams(personident, eier, miljoe, null); NyeBrukereResponse response = null; try { - response = tokenExchange.exchange(serviceProperties) + response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetArenaBrukereCommand(queryParams, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -199,7 +199,7 @@ private List gaaGjennomSider( var queryParams = getQueryParams(personident, eier, miljoe, page + ""); NyeBrukereResponse response = null; try { - response = tokenExchange.exchange(serviceProperties) + response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetArenaBrukereCommand(queryParams, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -231,7 +231,7 @@ public DagpengerResponseDTO opprettDagpengerVedtak(DagpengerRequestDTO vedtak) { private DagpengerResponseDTO opprettDagpenger(DagpengerRequestDTO request, String path) { try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostDagpengerCommand( request, path, accessToken.getTokenValue(), webClient).call()) .block(); diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/InntektstubConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/InntektstubConsumer.java index 6905a462ce4..7af751749ac 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/InntektstubConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/InntektstubConsumer.java @@ -1,9 +1,9 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.inntektstub.DeleteInntekterCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.inntektstub.PostInntekterCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.InntektstubProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.domain.inntektstub.Inntektsinformasjon; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -21,21 +21,24 @@ public class InntektstubConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public InntektstubConsumer( - InntektstubProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange ) { - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder().baseUrl(serviceProperties.getUrl()).build(); + serverProperties = consumers.getTestnavInntektstubProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) + .build(); this.tokenExchange = tokenExchange; } public List postInntekter(List inntektsinformasjon) { try { log.info("Oppretter inntekt i inntektstub for ident"); - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostInntekterCommand(inntektsinformasjon, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -47,7 +50,7 @@ public List postInntekter(List inntekt public void deleteInntekter(List identer) { try { log.info("Sletter ident(er) fra Inntektstub"); - tokenExchange.exchange(serviceProperties) + tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new DeleteInntekterCommand(identer, accessToken.getTokenValue(), webClient).call()) .subscribe(response -> log.info("Slettet identer fra Inntektstub")); } catch (Exception e) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/OrgFasteDataServiceConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/OrgFasteDataServiceConsumer.java index 0a8c1749545..396e5f80bcf 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/OrgFasteDataServiceConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/OrgFasteDataServiceConsumer.java @@ -1,8 +1,8 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.fastedata.GetOrganisasjonerCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.OrgFasteDataServiceProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.response.fastedata.Organisasjon; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -18,20 +18,23 @@ public class OrgFasteDataServiceConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public OrgFasteDataServiceConsumer( - OrgFasteDataServiceProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange ) { - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder().baseUrl(serviceProperties.getUrl()).build(); + serverProperties = consumers.getTestnavOrganisasjonFasteDataService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) + .build(); this.tokenExchange = tokenExchange; } public List getOrganisasjoner() { try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetOrganisasjonerCommand(accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlProxyConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlProxyConsumer.java index 51b1af17747..317d5aa4fc6 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlProxyConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlProxyConsumer.java @@ -1,11 +1,11 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.pdl.GetPdlPersonCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.pdl.GetPdlPersonerCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.pdl.TagsOpprettingCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.pdl.TagsSlettingCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.PdlProxyProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.response.pdl.PdlPerson; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.response.pdl.PdlPersonBolk; import no.nav.testnav.apps.syntvedtakshistorikkservice.domain.FilLaster; @@ -33,18 +33,18 @@ public class PdlProxyConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private static final String SINGLE_PERSON_QUERY = "pdlperson/pdlquery.graphql"; private static final String BOLK_PERSON_QUERY = "pdlperson/pdlbolkquery.graphql"; public PdlProxyConsumer( - PdlProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getPdlApiProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -53,7 +53,7 @@ public PdlPerson getPdlPerson(String ident) { if (isNullOrEmpty(ident)) return null; try { var query = getQueryFromFile(SINGLE_PERSON_QUERY); - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetPdlPersonCommand(ident, query, accessToken.getTokenValue(), webClient).call()) .block(); if (nonNull(response) && nonNull(response.getErrors()) && !response.getErrors().isEmpty()) { @@ -72,7 +72,7 @@ public PdlPersonBolk getPdlPersoner(List identer) { if (isNull(identer) || identer.isEmpty()) return null; try { var query = getQueryFromFile(BOLK_PERSON_QUERY); - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetPdlPersonerCommand(identer, query, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { @@ -95,7 +95,7 @@ private static String getQueryFromFile(String file) { public boolean createTags(List identer, List tags) { try { if (isNull(identer) || identer.isEmpty()) return false; - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new TagsOpprettingCommand(webClient, identer, tags, accessToken.getTokenValue()).call()) .block(); @@ -114,7 +114,7 @@ public boolean createTags(List identer, List tags) { public boolean deleteTags(List identer, List tags){ try { if (isNull(identer) || identer.isEmpty()) return false; - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new TagsSlettingCommand(webClient, identer, tags, accessToken.getTokenValue()).call()) .block(); if (isNull(response) || !response.getStatusCode().is2xxSuccessful()) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumer.java index fed8be05462..71b796916a7 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumer.java @@ -1,9 +1,9 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.pensjon.PostPensjonTestdataInntektCommand; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.pensjon.PostPensjonTestdataPersonCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.PensjonTestdataFacadeProxyProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.pensjon.PensjonTestdataInntekt; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.pensjon.PensjonTestdataPerson; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.response.pensjon.PensjonTestdataResponse; @@ -21,15 +21,15 @@ public class PensjonTestdataFacadeConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public PensjonTestdataFacadeConsumer( - PensjonTestdataFacadeProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getTestnavPensjonTestdataFacadeProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -38,7 +38,7 @@ public PensjonTestdataResponse opprettPerson( PensjonTestdataPerson person ) { try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostPensjonTestdataPersonCommand(webClient, person, accessToken.getTokenValue()).call()) .block(); } catch (Exception e) { @@ -51,7 +51,7 @@ public PensjonTestdataResponse opprettInntekt( PensjonTestdataInntekt inntekt ) { try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostPensjonTestdataInntektCommand(webClient, inntekt, accessToken.getTokenValue()).call()) .block(); } catch (Exception e) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumer.java index b222bf4cf9e..73b1f62f91c 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumer.java @@ -1,8 +1,8 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.search.PersonSearchCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.PersonSearchProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.response.search.PersonSearchResponse; import no.nav.testnav.libs.dto.personsearchservice.v1.search.PersonSearch; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -16,22 +16,22 @@ public class PersonSearchConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public PersonSearchConsumer( - PersonSearchProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getTestnavPersonSearchService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } public PersonSearchResponse search(PersonSearch request) { try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PersonSearchCommand(request, accessToken.getTokenValue(), webClient).call()) .block(); } catch (Exception e) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntDagpengerConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntDagpengerConsumer.java index 0aa0392d494..47f801aafd2 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntDagpengerConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntDagpengerConsumer.java @@ -1,8 +1,8 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.synt.HentDagpengevedtakCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.SyntDagpengerProperties; import no.nav.testnav.libs.dto.syntvedtakshistorikkservice.v1.DagpengevedtakDTO; import no.nav.testnav.libs.dto.syntvedtakshistorikkservice.v1.dagpenger.Dagpengerettighet; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -21,22 +21,24 @@ public class SyntDagpengerConsumer { private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final WebClient webClient; public SyntDagpengerConsumer( - SyntDagpengerProperties properties, + Consumers consumers, TokenExchange tokenExchange ) { - this.serviceProperties = properties; + serverProperties = consumers.getSyntDagpenger(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() + this.webClient = WebClient + .builder() + .exchangeStrategies(ExchangeStrategies + .builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) - .baseUrl(properties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -44,7 +46,7 @@ public DagpengevedtakDTO syntetiserDagpengevedtak(Dagpengerettighet rettighet, L var request = Collections.singletonList(startdato.toString()); try { - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new HentDagpengevedtakCommand(webClient, request, rettighet, accessToken.getTokenValue()).call()) .block(); if (nonNull(response) && !response.isEmpty()) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumer.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumer.java index 8da83e9683f..e2b7dda6bb8 100644 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumer.java +++ b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumer.java @@ -1,8 +1,8 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.apps.syntvedtakshistorikkservice.config.Consumers; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.command.synt.HentVedtakshistorikkCommand; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.SyntVedtakshistorikkProperties; import no.nav.testnav.libs.domain.dto.arena.testnorge.historikk.Vedtakshistorikk; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; @@ -26,23 +26,24 @@ public class SyntVedtakshistorikkConsumer { private static final LocalDate MINIMUM_DATE = LocalDate.of(2015, 1, 1); private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final WebClient webClient; private final Random rand = new Random(); public SyntVedtakshistorikkConsumer( - SyntVedtakshistorikkProperties syntVedtakshistorikkProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = syntVedtakshistorikkProperties; + serverProperties = consumers.getSyntVedtakshistorikk(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() + this.webClient = WebClient + .builder() + .exchangeStrategies(ExchangeStrategies + .builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) - .baseUrl(syntVedtakshistorikkProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -54,7 +55,7 @@ public List syntetiserVedtakshistorikk(int antallIdenter) { oppstartsdatoer.add(dato.toString()); } try { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new HentVedtakshistorikkCommand(webClient, oppstartsdatoer, accessToken.getTokenValue()).call()) .block(); } catch (Exception e) { diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/ArenaForvalterenProxyProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/ArenaForvalterenProxyProperties.java deleted file mode 100644 index 050c0af079e..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/ArenaForvalterenProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-arena-forvalteren-proxy") -public class ArenaForvalterenProxyProperties extends ServerProperties { -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/InntektstubProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/InntektstubProperties.java deleted file mode 100644 index d0f6b6989a2..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/InntektstubProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-inntektstub-proxy") -public class InntektstubProperties extends ServerProperties { -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/OrgFasteDataServiceProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/OrgFasteDataServiceProperties.java deleted file mode 100644 index f2fc88228eb..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/OrgFasteDataServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-faste-data-service") -public class OrgFasteDataServiceProperties extends ServerProperties { -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PdlProxyProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PdlProxyProperties.java deleted file mode 100644 index 2fd3617624c..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PdlProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-api-proxy") -public class PdlProxyProperties extends ServerProperties{ -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PensjonTestdataFacadeProxyProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PensjonTestdataFacadeProxyProperties.java deleted file mode 100644 index 97892e5d75d..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PensjonTestdataFacadeProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-pensjon-testdata-facade-proxy") -public class PensjonTestdataFacadeProxyProperties extends ServerProperties { -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PersonSearchProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PersonSearchProperties.java deleted file mode 100644 index e007f194771..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/PersonSearchProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-search-service") -public class PersonSearchProperties extends ServerProperties{ -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/SyntDagpengerProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/SyntDagpengerProperties.java deleted file mode 100644 index f9e942ef9a2..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/SyntDagpengerProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-dagpenger") -public class SyntDagpengerProperties extends ServerProperties{ -} diff --git a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/SyntVedtakshistorikkProperties.java b/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/SyntVedtakshistorikkProperties.java deleted file mode 100644 index 53bf9762180..00000000000 --- a/apps/synt-vedtakshistorikk-service/src/main/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/credential/SyntVedtakshistorikkProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-vedtakshistorikk") -public class SyntVedtakshistorikkProperties extends ServerProperties { -} diff --git a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumerTest.java b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumerTest.java index 4fda1a3d65b..a37b8a6e2f3 100644 --- a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumerTest.java +++ b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/ArenaForvalterConsumerTest.java @@ -1,9 +1,9 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.ArenaForvalterenProxyProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.arena.rettighet.*; import no.nav.testnav.libs.domain.dto.arena.testnorge.brukere.Arbeidsoeker; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; @@ -52,7 +52,7 @@ class ArenaForvalterConsumerTest { @BeforeEach public void setup() { - when(tokenExchange.exchange(ArgumentMatchers.any(ArenaForvalterenProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenExchange.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test diff --git a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlConsumerTest.java b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlConsumerTest.java index 9eda49a5615..bf6f7fe9a56 100644 --- a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlConsumerTest.java +++ b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PdlConsumerTest.java @@ -1,8 +1,8 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.PdlProxyProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.response.pdl.PdlPerson; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -144,6 +144,6 @@ private void stubOpprettTags() { } private void stubTokenRequest() { - when(tokenExchange.exchange(ArgumentMatchers.any(PdlProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenExchange.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } } diff --git a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumerTest.java b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumerTest.java index 9a4e4be88aa..0469281914c 100644 --- a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumerTest.java +++ b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PensjonTestdataFacadeConsumerTest.java @@ -1,9 +1,9 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.PensjonTestdataFacadeProxyProperties; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.pensjon.PensjonTestdataInntekt; import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.request.pensjon.PensjonTestdataPerson; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -49,7 +49,7 @@ class PensjonTestdataFacadeConsumerTest { @BeforeEach public void setup() { - when(tokenExchange.exchange(ArgumentMatchers.any(PensjonTestdataFacadeProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenExchange.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } diff --git a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumerTest.java b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumerTest.java index 8feb86ce2bb..6c751b0220b 100644 --- a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumerTest.java +++ b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/PersonSearchConsumerTest.java @@ -1,9 +1,9 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.PersonSearchProperties; import no.nav.testnav.libs.dto.personsearchservice.v1.search.AlderSearch; import no.nav.testnav.libs.dto.personsearchservice.v1.search.PersonSearch; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -56,7 +56,7 @@ class PersonSearchConsumerTest { @BeforeEach public void setup() { - when(tokenExchange.exchange(ArgumentMatchers.any(PersonSearchProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenExchange.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } diff --git a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumerTest.java b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumerTest.java index e61e5bdbe0f..fe0a771cac3 100644 --- a/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumerTest.java +++ b/apps/synt-vedtakshistorikk-service/src/test/java/no/nav/testnav/apps/syntvedtakshistorikkservice/consumer/SyntVedtakshistorikkConsumerTest.java @@ -1,7 +1,7 @@ package no.nav.testnav.apps.syntvedtakshistorikkservice.consumer; -import no.nav.testnav.apps.syntvedtakshistorikkservice.consumer.credential.SyntVedtakshistorikkProperties; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -40,7 +40,7 @@ class SyntVedtakshistorikkConsumerTest { @BeforeEach public void setup() { - when(tokenExchange.exchange(ArgumentMatchers.any(SyntVedtakshistorikkProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenExchange.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test diff --git a/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/config/Consumers.java b/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/config/Consumers.java new file mode 100644 index 00000000000..d98864b2ccc --- /dev/null +++ b/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.identpool.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties tpsMessagingService; + +} diff --git a/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/config/credentials/TpsMessagingServiceProperties.java b/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/config/credentials/TpsMessagingServiceProperties.java deleted file mode 100644 index 33e85ef4ec5..00000000000 --- a/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/config/credentials/TpsMessagingServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.identpool.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.tps.messaging.service") -public class TpsMessagingServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/consumers/TpsMessagingConsumer.java b/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/consumers/TpsMessagingConsumer.java index 6b7c2323e84..e03bdb2d486 100644 --- a/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/consumers/TpsMessagingConsumer.java +++ b/apps/testnav-ident-pool/src/main/java/no/nav/testnav/identpool/consumers/TpsMessagingConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.identpool.consumers; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.identpool.config.credentials.TpsMessagingServiceProperties; +import no.nav.testnav.identpool.config.Consumers; import no.nav.testnav.identpool.consumers.command.TpsMessagingGetCommand; import no.nav.testnav.identpool.consumers.command.TpsValidation; import no.nav.testnav.identpool.dto.TpsStatusDTO; @@ -24,16 +24,17 @@ public class TpsMessagingConsumer { private static final int PAGESIZE = 80; private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public TpsMessagingConsumer( - TpsMessagingServiceProperties serviceProperties, - TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + Consumers consumers, + TokenExchange tokenExchange + ) { + serverProperties = consumers.getTpsMessagingService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -52,7 +53,7 @@ private List getIdenterStatus(List identer, Set mi var startTid = System.currentTimeMillis(); - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMapMany(token -> Flux.range(0, identer.size() / PAGESIZE + 1) .flatMap(page -> new TpsMessagingGetCommand(webClient, token.getTokenValue(), identer.subList(page * PAGESIZE, Math.min(identer.size(), (page + 1) * PAGESIZE)), diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java new file mode 100644 index 00000000000..e7fe0e1b255 --- /dev/null +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java @@ -0,0 +1,38 @@ +package no.nav.registre.sdforvalter.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavAaregProxy; + private ServerProperties genererNavnService; + private ServerProperties testnorgeHodejegeren; + private ServerProperties kodeverk; + private ServerProperties testnavOrganisasjonFasteDataService; + private ServerProperties testnavOrganisasjonService; + private ServerProperties testnavPersonFasteDataService; + private ServerProperties person; + private ServerProperties testnorgeTp; + private ServerProperties tpsForvalterenProxy; + +} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/AaregProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/AaregProperties.java deleted file mode 100644 index 70a98aaa803..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/AaregProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-aareg-proxy") -public class AaregProperties extends ServerProperties{ -} \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/GenererNavnServiceProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/GenererNavnServiceProperties.java deleted file mode 100644 index 37e498d53da..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/GenererNavnServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.generer-navn-service") -public class GenererNavnServiceProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/KodeverkProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/KodeverkProperties.java deleted file mode 100644 index a42e74eca20..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/KodeverkProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Configuration -@ConfigurationProperties(prefix = "consumers.kodeverk") -public class KodeverkProperties extends ServerProperties{ -} - diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/OrganisasjonFasteDataServiceProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/OrganisasjonFasteDataServiceProperties.java deleted file mode 100644 index fb19f4d219b..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/OrganisasjonFasteDataServiceProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Setter -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-faste-data-service") -public class OrganisasjonFasteDataServiceProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/OrganisasjonServiceProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/OrganisasjonServiceProperties.java deleted file mode 100644 index 1b58d35ebfe..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/OrganisasjonServiceProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Setter -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service") -public class OrganisasjonServiceProperties extends ServerProperties { - private Integer threads; -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/PersonFasteDataServiceProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/PersonFasteDataServiceProperties.java deleted file mode 100644 index 33d80b30f30..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/PersonFasteDataServiceProperties.java +++ /dev/null @@ -1,16 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - -@Setter -@Getter -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-person-faste-data-service") -public class PersonFasteDataServiceProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/PersonServiceProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/PersonServiceProperties.java deleted file mode 100644 index d02ffb95707..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/PersonServiceProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.person") -public class PersonServiceProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/TpsfProxyProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/TpsfProxyProperties.java deleted file mode 100644 index 7f84201113d..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/credentials/TpsfProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.sdforvalter.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.tps-forvalteren-proxy") -public class TpsfProxyProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/aareg/AaregConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/aareg/AaregConsumer.java index 1d61e0d03ce..b28f5abb52d 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/aareg/AaregConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/aareg/AaregConsumer.java @@ -1,11 +1,12 @@ package no.nav.registre.sdforvalter.consumer.rs.aareg; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.credentials.AaregProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.aareg.command.GetArbeidsforholdCommand; import no.nav.registre.sdforvalter.consumer.rs.aareg.command.PostArbeidsforholdCommand; import no.nav.registre.sdforvalter.consumer.rs.aareg.response.ArbeidsforholdRespons; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.ExchangeStrategies; @@ -16,13 +17,13 @@ public class AaregConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final AaregProperties properties; + private final ServerProperties serverProperties; public AaregConsumer( - AaregProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange ) { - this.properties = serverProperties; + serverProperties = consumers.getTestnavAaregProxy(); this.tokenExchange = tokenExchange; this.webClient = WebClient.builder() .exchangeStrategies(ExchangeStrategies.builder() @@ -35,14 +36,14 @@ public AaregConsumer( } public ArbeidsforholdRespons opprettArbeidsforhold(Arbeidsforhold arbeidsforhold, String miljoe) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new PostArbeidsforholdCommand( webClient, miljoe, arbeidsforhold, accessToken.getTokenValue()).call()) .block(); } public ArbeidsforholdRespons hentArbeidsforhold(String ident, String miljoe) { - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetArbeidsforholdCommand( webClient, miljoe, ident, accessToken.getTokenValue()).call()) .block(); diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/credential/HodejegerenProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/credential/HodejegerenProperties.java deleted file mode 100644 index 11483468ab7..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/credential/HodejegerenProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-hodejegeren") -public class HodejegerenProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/credential/TestnorgeTpProperties.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/credential/TestnorgeTpProperties.java deleted file mode 100644 index 17330942b89..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/credential/TestnorgeTpProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnorge-tp") -public class TestnorgeTpProperties extends ServerProperties { -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java index 3fbaa80c4e0..d37b86bcca5 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.sdforvalter.consumer.rs.hodejegeren; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.consumer.rs.credential.HodejegerenProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.hodejegeren.command.GetAlleIdenterCommand; import no.nav.registre.sdforvalter.consumer.rs.hodejegeren.command.GetLevendeIdenterCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; @@ -17,17 +17,17 @@ public class HodejegerenConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public HodejegerenConsumer( - HodejegerenProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange ) { - this.serviceProperties = serviceProperties; + serverProperties = consumers.getTestnorgeHodejegeren(); this.tokenExchange = tokenExchange; - - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } @@ -36,13 +36,13 @@ public HodejegerenConsumer( * @return En liste med fnr som eksisterer i gruppen */ public List getPlaygroupFnrs(Long playgroupId) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetAlleIdenterCommand(playgroupId, webClient, accessToken.getTokenValue()).call()) .block(); } public List getLivingFnrs(Long playgroupId, String environment) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetLevendeIdenterCommand(playgroupId, environment, webClient, accessToken.getTokenValue()).call()) .block(); } diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/kodeverk/KodeverkConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/kodeverk/KodeverkConsumer.java index 7b706fcbef4..5ff4997c148 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/kodeverk/KodeverkConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/kodeverk/KodeverkConsumer.java @@ -1,6 +1,6 @@ package no.nav.registre.sdforvalter.consumer.rs.kodeverk; -import no.nav.registre.sdforvalter.config.credentials.KodeverkProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.kodeverk.command.GetYrkerKodeverkCommand; import no.nav.registre.sdforvalter.consumer.rs.kodeverk.response.KodeverkResponse; import org.springframework.stereotype.Component; @@ -12,15 +12,19 @@ public class KodeverkConsumer { private final WebClient webClient; public KodeverkConsumer( - KodeverkProperties serverProperties + Consumers consumers ) { - this.webClient = WebClient.builder() - .exchangeStrategies(ExchangeStrategies.builder() + this.webClient = WebClient + .builder() + .exchangeStrategies(ExchangeStrategies + .builder() .codecs(configurer -> configurer .defaultCodecs() .maxInMemorySize(16 * 1024 * 1024)) .build()) - .baseUrl(serverProperties.getUrl()) + .baseUrl(consumers + .getKodeverk() + .getUrl()) .build(); } diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/navn/GenererNavnConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/navn/GenererNavnConsumer.java index d3e643e9371..a5b1777416e 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/navn/GenererNavnConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/navn/GenererNavnConsumer.java @@ -1,8 +1,9 @@ package no.nav.registre.sdforvalter.consumer.rs.navn; -import no.nav.registre.sdforvalter.config.credentials.GenererNavnServiceProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.testnav.libs.commands.generernavnservice.v1.GenererNavnCommand; import no.nav.testnav.libs.dto.generernavnservice.v1.NavnDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -11,15 +12,16 @@ public class GenererNavnConsumer { private final WebClient webClient; - private final GenererNavnServiceProperties properties; + private final ServerProperties properties; private final TokenExchange tokenExchange; - public GenererNavnConsumer(GenererNavnServiceProperties properties, - TokenExchange tokenExchange) { - + public GenererNavnConsumer( + Consumers consumers, + TokenExchange tokenExchange) { this.tokenExchange = tokenExchange; - this.properties = properties; - this.webClient = WebClient.builder() + properties = consumers.getGenererNavnService(); + this.webClient = WebClient + .builder() .baseUrl(properties.getUrl()) .build(); } diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonConsumer.java index 41c92d4344f..4f4e19f2b6f 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonConsumer.java @@ -1,9 +1,10 @@ package no.nav.registre.sdforvalter.consumer.rs.organisasjon; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.credentials.OrganisasjonServiceProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.domain.status.ereg.Organisasjon; import no.nav.testnav.libs.commands.organisasjonservice.v1.GetOrganisasjonCommand; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -18,15 +19,14 @@ @Component public class OrganisasjonConsumer { private final WebClient webClient; - private final OrganisasjonServiceProperties serverProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; private final Executor executor; public OrganisasjonConsumer( - OrganisasjonServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serverProperties = serverProperties; + serverProperties = consumers.getTestnavOrganisasjonService(); this.tokenExchange = tokenExchange; this.executor = Executors.newFixedThreadPool(serverProperties.getThreads()); this.webClient = WebClient diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonFasteDataConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonFasteDataConsumer.java index 20d19157066..0ac80b476b4 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonFasteDataConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/organisasjon/OrganisasjonFasteDataConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.sdforvalter.consumer.rs.organisasjon; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.credentials.OrganisasjonFasteDataServiceProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.navn.GenererNavnConsumer; import no.nav.registre.sdforvalter.consumer.rs.organisasjon.command.SaveOrganisasjonFasteDataCommand; import no.nav.registre.sdforvalter.consumer.rs.organisasjon.domain.OrgTree; @@ -9,6 +9,7 @@ import no.nav.registre.sdforvalter.domain.EregListe; import no.nav.testnav.libs.dto.generernavnservice.v1.NavnDTO; import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -19,16 +20,16 @@ @Component public class OrganisasjonFasteDataConsumer { private final WebClient webClient; - private final OrganisasjonFasteDataServiceProperties serverProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; private final GenererNavnConsumer genererNavnConsumer; public OrganisasjonFasteDataConsumer( - OrganisasjonFasteDataServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange, GenererNavnConsumer genererNavnConsumer) { - this.serverProperties = serverProperties; + serverProperties = consumers.getTestnavOrganisasjonFasteDataService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java index e7239759ffd..33a3cc9dff6 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.credentials.PersonServiceProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.domain.TpsIdent; import no.nav.registre.sdforvalter.domain.TpsIdentListe; import no.nav.registre.sdforvalter.domain.person.Person; @@ -13,12 +13,10 @@ import no.nav.testnav.libs.securitycore.domain.AccessToken; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.http.codec.json.Jackson2JsonEncoder; import org.springframework.stereotype.Component; - import org.springframework.web.reactive.function.client.ExchangeStrategies; import org.springframework.web.reactive.function.client.WebClient; @@ -37,32 +35,33 @@ public class PersonConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final Executor executor; public PersonConsumer( - ObjectMapper objectMapper, @Value("${consumers.person.threads}") Integer threads, - PersonServiceProperties personServiceProperties, + ObjectMapper objectMapper, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = personServiceProperties; + serverProperties = consumers.getPerson(); this.tokenExchange = tokenExchange; - - ExchangeStrategies jacksonStrategy = ExchangeStrategies.builder() - .codecs(config -> { - config.defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config.defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }).build(); - + ExchangeStrategies jacksonStrategy = ExchangeStrategies + .builder() + .codecs( + config -> { + config + .defaultCodecs() + .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); + config + .defaultCodecs() + .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); + }) + .build(); this.webClient = WebClient .builder() .exchangeStrategies(jacksonStrategy) - .baseUrl(personServiceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); - - this.executor = Executors.newFixedThreadPool(threads); + this.executor = Executors.newFixedThreadPool(serverProperties.getThreads()); } private CompletableFuture hentPerson(String ident, AccessToken accessToken) { @@ -74,7 +73,7 @@ private CompletableFuture hentPerson(String ident, AccessToken accessTok } public List hentPersoner(Set identer) { - AccessToken accessToken = tokenExchange.exchange(serviceProperties).block(); + AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); List personer = new ArrayList<>(); var futures = identer.stream().map(ident -> hentPerson(ident, accessToken)).toList(); for (CompletableFuture future : futures) { @@ -90,7 +89,7 @@ public List hentPersoner(Set identer) { } public void opprettPersoner(TpsIdentListe identer) { - AccessToken accessToken = tokenExchange.exchange(serviceProperties).block(); + AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); List> futures = identer.stream().map(ident -> CompletableFuture.supplyAsync(() -> { try { new CreatePersonCommand(webClient, ident.toDTO(), accessToken.getTokenValue(), ident.getOpprinnelse()).call().block(); diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java index cb41c578550..8a901395312 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java @@ -1,12 +1,13 @@ package no.nav.registre.sdforvalter.consumer.rs.person; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.credentials.PersonFasteDataServiceProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.person.command.SavePersonFasteDataCommand; import no.nav.registre.sdforvalter.domain.TpsIdent; import no.nav.registre.sdforvalter.domain.TpsIdentListe; import no.nav.testnav.libs.dto.personservice.v1.Gruppe; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -18,14 +19,13 @@ @Component public class PersonFasteDataConsumer { private final WebClient webClient; - private final PersonFasteDataServiceProperties serverProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public PersonFasteDataConsumer( - PersonFasteDataServiceProperties serverProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serverProperties = serverProperties; + serverProperties = consumers.getTestnavPersonFasteDataService(); this.tokenExchange = tokenExchange; this.webClient = WebClient .builder() diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java index ba3853f299c..3748743c1a6 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java @@ -1,7 +1,7 @@ package no.nav.registre.sdforvalter.consumer.rs.tp; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.consumer.rs.credential.TestnorgeTpProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.tp.command.OpprettPersonerTpCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; @@ -18,17 +18,16 @@ public class TpConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; public TpConsumer( TokenExchange tokenExchange, - TestnorgeTpProperties serviceProperties) { - this.serviceProperties = serviceProperties; + Consumers consumers) { + serverProperties = consumers.getTestnorgeTp(); this.tokenExchange = tokenExchange; - this.webClient = WebClient .builder() - .baseUrl(serviceProperties.getUrl()) + .baseUrl(serverProperties.getUrl()) .build(); } @@ -38,7 +37,7 @@ public TpConsumer( * @return true hvis den ble lagret i tp, false hvis de ikke ble lagret */ public boolean send(List data, String environment) { - var response = tokenExchange.exchange(serviceProperties) + var response = tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new OpprettPersonerTpCommand(webClient, data, environment, accessToken.getTokenValue()).call()) .block(); diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java index d120dd300ee..649fd3ad0f0 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java @@ -1,11 +1,12 @@ package no.nav.registre.sdforvalter.consumer.rs.tpsf; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.credentials.TpsfProxyProperties; +import no.nav.registre.sdforvalter.config.Consumers; import no.nav.registre.sdforvalter.consumer.rs.tpsf.command.GetMeldingsIdsCommand; import no.nav.registre.sdforvalter.consumer.rs.tpsf.command.PostSendSkdMeldingerTpsCommand; import no.nav.registre.sdforvalter.consumer.rs.tpsf.request.SendToTpsRequest; import no.nav.registre.sdforvalter.consumer.rs.tpsf.response.SkdMeldingerTilTpsRespons; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; @@ -18,15 +19,15 @@ public class TpsfConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final TpsfProxyProperties serviceProperties; + private final ServerProperties serverProperties; public TpsfConsumer( - TpsfProxyProperties serviceProperties, + Consumers consumers, TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + serverProperties = consumers.getTpsForvalterenProxy(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } @@ -36,12 +37,12 @@ private Mono sendSkdmeldingerToTps( SendToTpsRequest sendToTpsRequest) { log.info("Sender skd-meldinger med avspillergruppe {} til tps", gruppeId); - return tokenExchange.exchange(serviceProperties).flatMap(accessToken -> + return tokenExchange.exchange(serverProperties).flatMap(accessToken -> new PostSendSkdMeldingerTpsCommand(gruppeId, sendToTpsRequest, webClient, accessToken.getTokenValue()).call()); } private Mono> getMeldingIdsFromAvspillergruppe(Long gruppeId) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetMeldingsIdsCommand(gruppeId, webClient, accessToken.getTokenValue()).call()); } diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java index 6cffe12e070..3b197209171 100644 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java +++ b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java @@ -1,7 +1,7 @@ package no.nav.registre.sdforvalter.consumer.rs.tpsf; -import no.nav.registre.sdforvalter.config.credentials.TpsfProxyProperties; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.junit.Before; import org.junit.Test; @@ -52,7 +52,7 @@ public class TpsfConsumerTest { @Before public void before() { - when(tokenService.exchange(ArgumentMatchers.any(TpsfProxyProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); + when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); } @Test diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/Consumers.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/Consumers.java new file mode 100644 index 00000000000..dbf7fe25e30 --- /dev/null +++ b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.tp.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties hodejegeren; + +} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java index 7783ba65760..6a2a334ff3a 100644 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java +++ b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java @@ -1,8 +1,8 @@ package no.nav.registre.tp.consumer; import lombok.extern.slf4j.Slf4j; +import no.nav.registre.tp.config.Consumers; import no.nav.registre.tp.consumer.command.GetLevendeIdenterCommand; -import no.nav.registre.tp.consumer.credential.HodejegerenProperties; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; @@ -17,23 +17,24 @@ public class HodejegerenConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; - public HodejegerenConsumer(HodejegerenProperties serviceProperties, - TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; + public HodejegerenConsumer( + Consumers consumers, + TokenExchange tokenExchange + ) { + serverProperties = consumers.getHodejegeren(); this.tokenExchange = tokenExchange; - - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public List getLevende( Long avspillergruppeId ) { - return tokenExchange.exchange(serviceProperties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> new GetLevendeIdenterCommand(avspillergruppeId, accessToken.getTokenValue(), webClient).call()) .block(); } diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/credential/HodejegerenProperties.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/credential/HodejegerenProperties.java deleted file mode 100644 index 69b3b3ad104..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/credential/HodejegerenProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.registre.tp.consumer.credential; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.hodejegeren") -public class HodejegerenProperties extends ServerProperties { -} diff --git a/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/config/Consumers.java b/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/config/Consumers.java new file mode 100644 index 00000000000..82615c4fc9b --- /dev/null +++ b/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.registre.testnorge.tilbakemeldingapi.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties profilApi; + +} diff --git a/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/config/credentials/ProfilServiceProperties.java b/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/config/credentials/ProfilServiceProperties.java deleted file mode 100644 index 614efdfbfa8..00000000000 --- a/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/config/credentials/ProfilServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.testnorge.tilbakemeldingapi.config.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.profil-api") -public class ProfilServiceProperties extends ServerProperties { -} diff --git a/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/consumer/ProfilApiConsumer.java b/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/consumer/ProfilApiConsumer.java index abcb5c14aa2..96c77de3c7b 100644 --- a/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/consumer/ProfilApiConsumer.java +++ b/apps/tilbakemelding-api/src/main/java/no/nav/registre/testnorge/tilbakemeldingapi/consumer/ProfilApiConsumer.java @@ -1,9 +1,10 @@ package no.nav.registre.testnorge.tilbakemeldingapi.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.tilbakemeldingapi.config.credentials.ProfilServiceProperties; +import no.nav.registre.testnorge.tilbakemeldingapi.config.Consumers; import no.nav.registre.testnorge.tilbakemeldingapi.util.WebClientFilter; import no.nav.testnav.libs.dto.profil.v1.ProfilDTO; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; @@ -19,22 +20,23 @@ public class ProfilApiConsumer { private final WebClient webClient; private final TokenExchange tokenExchange; - private final ProfilServiceProperties properties; + private final ServerProperties serverProperties; public ProfilApiConsumer( - ProfilServiceProperties properties, - TokenExchange tokenExchange) { - - this.properties = properties; + Consumers consumers, + TokenExchange tokenExchange + ) { + serverProperties = consumers.getProfilApi(); this.tokenExchange = tokenExchange; - this.webClient = WebClient.builder() - .baseUrl(properties.getUrl()) + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); } public ProfilDTO getBruker() { log.info("Henter bruker fra Azure."); - return tokenExchange.exchange(properties) + return tokenExchange.exchange(serverProperties) .flatMap(accessToken -> webClient.get() .uri("/api/v1/profil") .header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken.getTokenValue()) diff --git a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/config/Consumers.java b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/config/Consumers.java new file mode 100644 index 00000000000..cf0fa57e134 --- /dev/null +++ b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.apps.tpsmessagingservice.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testmiljoerService; + +} diff --git a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/config/credentials/TestmiljoerServiceProperties.java b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/config/credentials/TestmiljoerServiceProperties.java deleted file mode 100644 index d55c16e1e93..00000000000 --- a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/config/credentials/TestmiljoerServiceProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.tpsmessagingservice.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testmiljoer.service") -public class TestmiljoerServiceProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/consumer/TestmiljoerServiceConsumer.java b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/consumer/TestmiljoerServiceConsumer.java index 5239416e99a..c4b6fa2bea8 100644 --- a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/consumer/TestmiljoerServiceConsumer.java +++ b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/consumer/TestmiljoerServiceConsumer.java @@ -1,7 +1,7 @@ package no.nav.testnav.apps.tpsmessagingservice.consumer; import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.tpsmessagingservice.config.credentials.TestmiljoerServiceProperties; +import no.nav.testnav.apps.tpsmessagingservice.config.Consumers; import no.nav.testnav.apps.tpsmessagingservice.consumer.command.TestmiljoerServiceCommand; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; @@ -16,23 +16,24 @@ public class TestmiljoerServiceConsumer { private final WebClient webClient; - private final ServerProperties serviceProperties; + private final ServerProperties serverProperties; private final TokenExchange tokenExchange; public TestmiljoerServiceConsumer( - TestmiljoerServiceProperties serviceProperties, - TokenExchange tokenExchange) { - - this.serviceProperties = serviceProperties; - this.webClient = WebClient.builder() - .baseUrl(serviceProperties.getUrl()) + Consumers consumers, + TokenExchange tokenExchange + ) { + serverProperties = consumers.getTestmiljoerService(); + this.webClient = WebClient + .builder() + .baseUrl(serverProperties.getUrl()) .build(); this.tokenExchange = tokenExchange; } public List getMiljoer() { - return Arrays.asList(tokenExchange.exchange(serviceProperties) + return Arrays.asList(tokenExchange.exchange(serverProperties) .flatMap(token -> new TestmiljoerServiceCommand(webClient, token.getTokenValue()).call()) .block()); } diff --git a/apps/tps-messaging-service/src/main/resources/application-local.yaml b/apps/tps-messaging-service/src/main/resources/application-local.yaml index 7885f49169e..cdcdcf65c9f 100644 --- a/apps/tps-messaging-service/src/main/resources/application-local.yaml +++ b/apps/tps-messaging-service/src/main/resources/application-local.yaml @@ -18,6 +18,5 @@ config: queue: DEV.QUEUE.1 consumers: - testmiljoer: - service: + testmiljoerService: url: https://testnav-miljoer-service.intern.dev.nav.no \ No newline at end of file diff --git a/apps/tps-messaging-service/src/main/resources/application.yaml b/apps/tps-messaging-service/src/main/resources/application.yaml index 6117a58503d..4e145094f38 100644 --- a/apps/tps-messaging-service/src/main/resources/application.yaml +++ b/apps/tps-messaging-service/src/main/resources/application.yaml @@ -39,8 +39,7 @@ config: password: ${mq.dev.password:#{null}} consumers: - testmiljoer: - service: + testmiljoerService: url: http://testnav-miljoer-service.dolly.svc.cluster.local cluster: dev-gcp namespace: dolly diff --git a/apps/tps-messaging-service/src/test/Resources/application-test.yaml b/apps/tps-messaging-service/src/test/Resources/application-test.yaml index 268489065f8..c26aab17ea7 100644 --- a/apps/tps-messaging-service/src/test/Resources/application-test.yaml +++ b/apps/tps-messaging-service/src/test/Resources/application-test.yaml @@ -5,4 +5,11 @@ config: password: 'test_password' preprod: user: 'preprod_user' - password: 'preprod_password' \ No newline at end of file + password: 'preprod_password' + +consumers: + testmiljoerService: + url: http://not.actually.used + cluster: dev-gcp + namespace: dolly + name: testnav-miljoer-service \ No newline at end of file diff --git a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ServerProperties.java b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ServerProperties.java index 02495e5fcc3..fc615572328 100644 --- a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ServerProperties.java +++ b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/domain/ServerProperties.java @@ -4,16 +4,15 @@ import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.URL; -import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.lang.Nullable; import org.springframework.validation.annotation.Validated; @EnableConfigurationProperties -@ConfigurationProperties(prefix = "server") @Validated @NoArgsConstructor @Data -public abstract class ServerProperties { +public class ServerProperties { /** * NAIS ingress URL for target service. @@ -29,7 +28,7 @@ public abstract class ServerProperties { private String cluster = "dev-gcp"; /** - * NAIS defined name for target service. + * NAIS defined name for target service. Sometimes used as segment for routing. */ @NotBlank private String name; @@ -40,6 +39,11 @@ public abstract class ServerProperties { @NotBlank private String namespace = "dolly"; + /** + * Requested number of threads used to run requests to this target service. Not used by all clients. + */ + private int threads = 1; + public String toTokenXScope() { return "%s:%s:%s".formatted(cluster, namespace, name); } @@ -55,4 +59,22 @@ public String getScope(ResourceServerType scope) { }; } + /** + * Convenience constructor. + * + * @param cluster See {@link #getCluster()}, defaults to {@code dev-gcp} if {@code null}. + * @param namespace See {@link #getNamespace()}, defaults to {@code dolly} if {@code null}. + * @param name See {@link #getName()}. + * @param url See {@link #getUrl()}. + * @return New instance. + */ + public static ServerProperties of(@Nullable String cluster, @Nullable String namespace, String name, String url) { + var properties = new ServerProperties(); + properties.setCluster(cluster == null ? "dev-gcp" : cluster); + properties.setNamespace(namespace == null ? "dolly" : namespace); + properties.setName(name); + properties.setUrl(url); + return properties; + } + } \ No newline at end of file diff --git a/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/AaregProperties.java b/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/AaregProperties.java deleted file mode 100644 index 0ddba57f7ee..00000000000 --- a/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/AaregProperties.java +++ /dev/null @@ -1,35 +0,0 @@ -package no.nav.testnav.proxies.aareg; - -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "app.aareg") -@Setter -public class AaregProperties { - AaregServerProperties services; - AaregServerProperties vedlikehold; - - static class AaregServerProperties extends ServerProperties { - - private static AaregServerProperties copyOf(AaregServerProperties original) { - var copy = new AaregServerProperties(); - copy.setCluster(original.getCluster()); - copy.setName(original.getName()); - copy.setNamespace(original.getNamespace()); - copy.setUrl(original.getUrl()); - return copy; - } - - AaregServerProperties forEnvironment(String env) { - var replacement = "q2".equals(env) ? "" : '-' + env; - var copy = copyOf(this); - copy.setUrl(copy.getUrl().replace("-{env}", replacement)); - copy.setName(copy.getName().replace("-{env}", replacement)); - return copy; - } - - } -} diff --git a/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/Consumers.java b/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/Consumers.java new file mode 100644 index 00000000000..186e765c01a --- /dev/null +++ b/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/Consumers.java @@ -0,0 +1,30 @@ +package no.nav.testnav.proxies.aareg; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + ServerProperties aaregServices; + ServerProperties aaregVedlikehold; + +} diff --git a/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/RouteLocatorConfig.java b/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/RouteLocatorConfig.java index 2b6ff3a249d..ecf4395c3a7 100644 --- a/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/RouteLocatorConfig.java +++ b/proxies/aareg-proxy/src/main/java/no/nav/testnav/proxies/aareg/RouteLocatorConfig.java @@ -33,15 +33,15 @@ public class RouteLocatorConfig { public RouteLocator customRouteLocator( RouteLocatorBuilder builder, TrygdeetatenAzureAdTokenService tokenService, - AaregProperties aaregProperties) { + Consumers consumers) { var routes = builder.routes(); Arrays.stream(MILJOER) .forEach(env -> { var readableAuthentication = - getAuthenticationFilter(tokenService, aaregProperties.services.forEnvironment(env)); + getAuthenticationFilter(tokenService, forEnvironment(consumers.getAaregServices(), env)); var writeableAuthentication = - getAuthenticationFilter(tokenService, aaregProperties.vedlikehold.forEnvironment(env)); + getAuthenticationFilter(tokenService, forEnvironment(consumers.getAaregVedlikehold(), env)); routes .route(createReadableRouteToNewEndpoint(env, readableAuthentication)) @@ -57,6 +57,16 @@ private GatewayFilter getAuthenticationFilter(TrygdeetatenAzureAdTokenService to .map(AccessToken::getTokenValue)); } + private static ServerProperties forEnvironment(ServerProperties original, String environment) { + var replacement = "q2".equals(environment) ? "" : '-' + environment; + return ServerProperties.of( + original.getCluster(), + original.getNamespace(), + original.getName().replace("-{env}", replacement), + original.getUrl().replace("-{env}", replacement) + ); + } + private Function> createReadableRouteToNewEndpoint(String miljoe, GatewayFilter authentication) { return predicateSpec -> predicateSpec diff --git a/proxies/aareg-proxy/src/main/resources/application.yaml b/proxies/aareg-proxy/src/main/resources/application.yaml index b98b6102175..155fc2463c4 100644 --- a/proxies/aareg-proxy/src/main/resources/application.yaml +++ b/proxies/aareg-proxy/src/main/resources/application.yaml @@ -28,14 +28,13 @@ springdoc: disable-swagger-default-url: true url: /v3/api-docs -app: - aareg: - services: +consumers: + aareg-services: name: aareg-services-nais-{env} namespace: arbeidsforhold url: http://aareg-services-{env}.arbeidsforhold.svc.nais.local cluster: dev-fss - vedlikehold: + aareg-vedlikehold: name: aareg-vedlikehold-{env} namespace: arbeidsforhold url: https://aareg-vedlikehold-{env}.dev.intern.nav.no diff --git a/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/ArbeidsplassenCVProxyApplicationStarter.java b/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/ArbeidsplassenCVProxyApplicationStarter.java index bb30f389f18..f9bfbb412dd 100644 --- a/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/ArbeidsplassenCVProxyApplicationStarter.java +++ b/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/ArbeidsplassenCVProxyApplicationStarter.java @@ -4,7 +4,7 @@ import no.nav.testnav.libs.reactiveproxy.config.DevConfig; import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; import no.nav.testnav.libs.reactivesecurity.exchange.tokenx.TokenXService; -import no.nav.testnav.proxies.arbeidsplassencvproxy.config.ArbeidsplassenCVProperties; +import no.nav.testnav.proxies.arbeidsplassencvproxy.config.Consumers; import no.nav.testnav.proxies.arbeidsplassencvproxy.consumer.FakedingsConsumer; import no.nav.testnav.proxies.arbeidsplassencvproxy.filter.AddAuthenticationRequestGatewayFilterFactory; import org.springframework.boot.SpringApplication; @@ -33,25 +33,29 @@ public static void main(String[] args) { @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder, - ArbeidsplassenCVProperties arbeidsplassenCVProperties, + Consumers consumers, FakedingsConsumer fakedingsConsumer, TokenXService tokenXService) { - - return builder.routes() - .route(createRoute(arbeidsplassenCVProperties.getUrl(), + return builder + .routes() + .route(createRoute( + consumers + .getArbeidsplassenCv() + .getUrl(), AddAuthenticationRequestGatewayFilterFactory - .bearerIdportenHeaderFilter(fakedingsConsumer, tokenXService, - arbeidsplassenCVProperties))) + .bearerIdportenHeaderFilter(fakedingsConsumer, tokenXService, consumers.getArbeidsplassenCv()))) .build(); } private Function> createRoute(String url, GatewayFilter filter) { return spec -> spec .path("/**") - .filters(filterSpec -> filterSpec - .rewritePath("/(?.*)", "/pam-cv-api/${segment}") - .setResponseHeader("Content-Type", "application/json; charset=UTF-8") - .filter(filter) - ).uri(url); + .filters( + filterSpec -> filterSpec + .rewritePath("/(?.*)", "/pam-cv-api/${segment}") + .setResponseHeader("Content-Type", "application/json; charset=UTF-8") + .filter(filter)) + .uri(url); } + } \ No newline at end of file diff --git a/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/config/ArbeidsplassenCVProperties.java b/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/config/ArbeidsplassenCVProperties.java deleted file mode 100644 index 48db6bdbce4..00000000000 --- a/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/config/ArbeidsplassenCVProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.proxies.arbeidsplassencvproxy.config; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumer.arbeidsplassencv") -public class ArbeidsplassenCVProperties extends ServerProperties { -} \ No newline at end of file diff --git a/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/config/Consumers.java b/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/config/Consumers.java new file mode 100644 index 00000000000..204b0daf4d8 --- /dev/null +++ b/proxies/arbeidsplassencv-proxy/src/main/java/no/nav/testnav/proxies/arbeidsplassencvproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.arbeidsplassencvproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties arbeidsplassenCv; + +} diff --git a/proxies/arbeidsplassencv-proxy/src/main/resources/application.yml b/proxies/arbeidsplassencv-proxy/src/main/resources/application.yml index 4630d31282d..9cbd27b3953 100644 --- a/proxies/arbeidsplassencv-proxy/src/main/resources/application.yml +++ b/proxies/arbeidsplassencv-proxy/src/main/resources/application.yml @@ -22,14 +22,9 @@ spring: vault: enabled: false -consumer: +consumers: arbeidsplassencv: name: pam-cv-api namespace: teampam url: http://pam-cv-api.teampam.svc.nais.local cluster: dev-fss - fakedings-token-provider: - name: fakedings - namespace: plattformsikkerhet - url: https://fakedings.intern.dev.nav.no - cluster: dev-fss diff --git a/proxies/arbeidsplassencv-proxy/src/test/resources/application-test.yml b/proxies/arbeidsplassencv-proxy/src/test/resources/application-test.yml index 45a7f438eb7..c84ad4a48ba 100644 --- a/proxies/arbeidsplassencv-proxy/src/test/resources/application-test.yml +++ b/proxies/arbeidsplassencv-proxy/src/test/resources/application-test.yml @@ -1 +1,8 @@ -azure.app.client.id: dummy \ No newline at end of file +azure.app.client.id: dummy + +consumers: + arbeidsplassencv: + name: placeholder + namespace: placeholder + url: http://not.actually.used + cluster: placeholder \ No newline at end of file diff --git a/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaForvalterenProxyApplicationStarter.java b/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaForvalterenProxyApplicationStarter.java index 801da53eb8e..437a159ebb9 100644 --- a/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaForvalterenProxyApplicationStarter.java +++ b/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaForvalterenProxyApplicationStarter.java @@ -3,6 +3,7 @@ import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactiveproxy.config.DevConfig; import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.Route; @@ -31,15 +32,19 @@ public static void main(String[] args) { } @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, ArenaServerProperties serverProperties) { - - var routes = builder.routes() - .route(spec -> spec.path("/api/**").uri("http://arena-forvalteren.teamarenanais.svc.nais.local/")); - - Arrays.stream(ARENA_MILJOER) - .forEach(env -> - routes.route(createRoute(env, serverProperties.forEnvironment(env).getUrl()))); - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + Consumers consumers + ) { + var routes = builder + .routes() + .route( + spec -> spec + .path("/api/**") + .uri("http://arena-forvalteren.teamarenanais.svc.nais.local/")); + Arrays + .stream(ARENA_MILJOER) + .forEach(env -> routes.route(createRoute(env, forEnvironment(consumers.getArenaServices(), env).getUrl()))); return routes.build(); } @@ -50,4 +55,14 @@ private Function> createRoute(String segment, St .rewritePath("/" + segment + "/(?.*)", "/${segment}") ).uri(host); } + + private static ServerProperties forEnvironment(ServerProperties original, String env) { + return ServerProperties.of( + original.getCluster(), + original.getNamespace(), + original.getName().replace("MILJOE", env), + original.getUrl().replace("MILJOE", env) + ); + } + } diff --git a/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaServerProperties.java b/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaServerProperties.java deleted file mode 100644 index ba9ba1bfc5d..00000000000 --- a/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/ArenaServerProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -package no.nav.testnav.proxies.arenaforvalterenproxy; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "app.arena.services") -public class ArenaServerProperties extends ServerProperties { - - private static ArenaServerProperties copyOf(ArenaServerProperties original) { - - var copy = new ArenaServerProperties(); - copy.setCluster(original.getCluster()); - copy.setName(original.getName()); - copy.setNamespace(original.getNamespace()); - copy.setUrl(original.getUrl()); - return copy; - } - - ArenaServerProperties forEnvironment(String env) { - - var copy = copyOf(this); - copy.setUrl(copy.getUrl().replace("MILJOE", env)); - copy.setName(copy.getName().replace("MILJOE", env)); - return copy; - } -} \ No newline at end of file diff --git a/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/Consumers.java b/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/Consumers.java new file mode 100644 index 00000000000..9d31b965538 --- /dev/null +++ b/proxies/arena-forvalteren-proxy/src/main/java/no/nav/testnav/proxies/arenaforvalterenproxy/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.arenaforvalterenproxy; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties arenaServices; + +} diff --git a/proxies/arena-forvalteren-proxy/src/main/resources/application.yml b/proxies/arena-forvalteren-proxy/src/main/resources/application.yml index 46bf39d43e1..d1eee5e812a 100644 --- a/proxies/arena-forvalteren-proxy/src/main/resources/application.yml +++ b/proxies/arena-forvalteren-proxy/src/main/resources/application.yml @@ -22,10 +22,9 @@ spring: vault: enabled: false -app: - arena: - services: - name: arena-services-MILJOE - namespace: teamarenanais - url: http://arena-ords-MILJOE.teamarenanais.svc.nais.local - cluster: dev-fss \ No newline at end of file +consumers: + arena-services: + name: arena-services-MILJOE + namespace: teamarenanais + url: http://arena-ords-MILJOE.teamarenanais.svc.nais.local + cluster: dev-fss \ No newline at end of file diff --git a/proxies/dokarkiv-proxy/build.gradle b/proxies/dokarkiv-proxy/build.gradle index 8e4e2549bf3..a9c6c440ee9 100644 --- a/proxies/dokarkiv-proxy/build.gradle +++ b/proxies/dokarkiv-proxy/build.gradle @@ -62,6 +62,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/DokarkivProxyApplicationStarter.java b/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/DokarkivProxyApplicationStarter.java index c624b0c7245..31a5d46e124 100644 --- a/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/DokarkivProxyApplicationStarter.java +++ b/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/DokarkivProxyApplicationStarter.java @@ -6,7 +6,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.dokarkivproxy.config.credentials.DokarkivProperties; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.proxies.dokarkivproxy.config.Consumers; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.filter.GatewayFilter; @@ -32,17 +33,20 @@ public class DokarkivProxyApplicationStarter { private static final String[] miljoer = new String[]{"q1", "q2", "q4", "q5", "t3"}; @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, - TrygdeetatenAzureAdTokenService tokenService, - DokarkivProperties dokarkivProperties) { - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + TrygdeetatenAzureAdTokenService tokenService, + Consumers consumers) { var routes = builder.routes(); - Arrays.asList(miljoer) - .forEach(miljoe -> routes.route(createRoute(miljoe, dokarkivProperties.forEnvironment(miljoe).getUrl(), - AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(dokarkivProperties.forEnvironment(miljoe)) - .map(AccessToken::getTokenValue))))); - + Arrays + .asList(miljoer) + .forEach( + miljoe -> routes.route(createRoute(miljoe, forEnvironment(consumers.getDokarkiv(), miljoe).getUrl(), + AddAuthenticationRequestGatewayFilterFactory + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(forEnvironment(consumers.getDokarkiv(), miljoe)) + .map(AccessToken::getTokenValue))))); return routes.build(); } @@ -59,4 +63,15 @@ private Function> createRoute(String miljo, Stri .filter(filter) ).uri(url); } + + private static ServerProperties forEnvironment(ServerProperties original, String env) { + var replacement = "q2".equals(env) ? "" : '-' + env; + return ServerProperties.of( + original.getCluster(), + original.getNamespace(), + original.getName().replace("-MILJOE", replacement), + original.getUrl().replace("-MILJOE", replacement) + ); + } + } \ No newline at end of file diff --git a/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/config/Consumers.java b/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/config/Consumers.java new file mode 100644 index 00000000000..ad11140a9a2 --- /dev/null +++ b/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.dokarkivproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties dokarkiv; + +} diff --git a/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/config/credentials/DokarkivProperties.java b/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/config/credentials/DokarkivProperties.java deleted file mode 100644 index 2d7b4f5acd4..00000000000 --- a/proxies/dokarkiv-proxy/src/main/java/no/nav/testnav/proxies/dokarkivproxy/config/credentials/DokarkivProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -package no.nav.testnav.proxies.dokarkivproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.dokarkiv") -public class DokarkivProperties extends ServerProperties { - - private static DokarkivProperties copyOf(DokarkivProperties original) { - var copy = new DokarkivProperties(); - copy.setCluster(original.getCluster()); - copy.setName(original.getName()); - copy.setNamespace(original.getNamespace()); - copy.setUrl(original.getUrl()); - return copy; - } - - public DokarkivProperties forEnvironment(String env) { - var replacement = "q2".equals(env) ? "" : '-' + env; - var copy = DokarkivProperties.copyOf(this); - copy.setUrl(copy.getUrl().replace("-MILJOE", replacement)); - copy.setName(copy.getName().replace("-MILJOE", replacement)); - return copy; - } - -} \ No newline at end of file diff --git a/proxies/hodejegeren-proxy/build.gradle b/proxies/hodejegeren-proxy/build.gradle index d75e596c6b7..3057829a68d 100644 --- a/proxies/hodejegeren-proxy/build.gradle +++ b/proxies/hodejegeren-proxy/build.gradle @@ -66,6 +66,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/Consumers.java b/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/Consumers.java new file mode 100644 index 00000000000..c40eb42303a --- /dev/null +++ b/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.hodejegerenproxy; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties hodejegeren; + +} diff --git a/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/HodejegerenProxyApplicationStarter.java b/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/HodejegerenProxyApplicationStarter.java index fe1b221acd2..f31c5937b44 100644 --- a/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/HodejegerenProxyApplicationStarter.java +++ b/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/HodejegerenProxyApplicationStarter.java @@ -1,20 +1,18 @@ package no.nav.testnav.proxies.hodejegerenproxy; +import no.nav.testnav.libs.reactivecore.config.CoreConfig; +import no.nav.testnav.libs.reactiveproxy.config.DevConfig; +import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; import no.nav.testnav.libs.reactiveproxy.filter.AddAuthenticationRequestGatewayFilterFactory; +import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.NavAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.hodejegerenproxy.config.credentials.HodejegerenProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; -import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; - -import no.nav.testnav.libs.reactivecore.config.CoreConfig; -import no.nav.testnav.libs.reactiveproxy.config.DevConfig; -import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; @Import({ @@ -25,18 +23,29 @@ }) @SpringBootApplication public class HodejegerenProxyApplicationStarter { + public static void main(String[] args) { SpringApplication.run(HodejegerenProxyApplicationStarter.class, args); } + @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, NavAzureAdTokenService tokenService, HodejegerenProperties properties) { + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + NavAzureAdTokenService tokenService, + Consumers consumers + ) { var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties).map(AccessToken::getTokenValue)); - - return builder.routes() - .route(spec -> spec.path("/api/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) - .uri(properties.getUrl())) + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(consumers.getHodejegeren()) + .map(AccessToken::getTokenValue)); + return builder + .routes() + .route( + spec -> spec + .path("/api/**") + .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) + .uri(consumers.getHodejegeren().getUrl())) .build(); } } \ No newline at end of file diff --git a/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/config/credentials/HodejegerenProperties.java b/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/config/credentials/HodejegerenProperties.java deleted file mode 100644 index 84d2b283aab..00000000000 --- a/proxies/hodejegeren-proxy/src/main/java/no/nav/testnav/proxies/hodejegerenproxy/config/credentials/HodejegerenProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.proxies.hodejegerenproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.hodejegeren") -public class HodejegerenProperties extends ServerProperties { -} diff --git a/proxies/kontoregister-person-proxy/build.gradle b/proxies/kontoregister-person-proxy/build.gradle index ae109ad3f9b..aed9ead16aa 100644 --- a/proxies/kontoregister-person-proxy/build.gradle +++ b/proxies/kontoregister-person-proxy/build.gradle @@ -67,6 +67,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/KontoregisterProxyApplicationStarter.java b/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/KontoregisterProxyApplicationStarter.java index 5c74ba885f2..2c06bde3093 100644 --- a/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/KontoregisterProxyApplicationStarter.java +++ b/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/KontoregisterProxyApplicationStarter.java @@ -6,8 +6,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.proxies.kontoregisterperson.config.Consumers; import no.nav.testnav.proxies.kontoregisterperson.config.LocalVaultConfig; -import no.nav.testnav.proxies.kontoregisterperson.config.credentials.KontoregisterProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; @@ -29,16 +29,23 @@ public static void main(String[] args) { } @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, TrygdeetatenAzureAdTokenService tokenService, KontoregisterProperties properties) { - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + TrygdeetatenAzureAdTokenService tokenService, + Consumers consumers + ) { var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties).map(AccessToken::getTokenValue)); - - return builder.routes() - .route(spec -> spec.path("/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) - .uri(properties.getUrl())) + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(consumers.getKontoregister()) + .map(AccessToken::getTokenValue)); + return builder + .routes() + .route( + spec -> spec + .path("/**") + .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) + .uri(consumers.getKontoregister().getUrl())) .build(); - } } \ No newline at end of file diff --git a/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/config/Consumers.java b/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/config/Consumers.java new file mode 100644 index 00000000000..a5b0d63f3cd --- /dev/null +++ b/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.kontoregisterperson.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties kontoregister; + +} diff --git a/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/config/credentials/KontoregisterProperties.java b/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/config/credentials/KontoregisterProperties.java deleted file mode 100644 index 6b4607c8dd6..00000000000 --- a/proxies/kontoregister-person-proxy/src/main/java/no/nav/testnav/proxies/kontoregisterperson/config/credentials/KontoregisterProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.proxies.kontoregisterperson.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.kontoregister") -public class KontoregisterProperties extends ServerProperties { -} diff --git a/proxies/krrstub-proxy/build.gradle b/proxies/krrstub-proxy/build.gradle index 49b0120b22d..0e9d73bd9e2 100644 --- a/proxies/krrstub-proxy/build.gradle +++ b/proxies/krrstub-proxy/build.gradle @@ -66,6 +66,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/KrrstubProxyApplicationStarter.java b/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/KrrstubProxyApplicationStarter.java index 5a24605760f..eeb404fbaf4 100644 --- a/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/KrrstubProxyApplicationStarter.java +++ b/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/KrrstubProxyApplicationStarter.java @@ -6,8 +6,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.proxies.krrstubproxy.config.Consumers; import no.nav.testnav.proxies.krrstubproxy.config.LocalVaultConfig; -import no.nav.testnav.proxies.krrstubproxy.config.credentials.KrrStubProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; @@ -29,15 +29,22 @@ public static void main(String[] args) { } @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, TrygdeetatenAzureAdTokenService tokenService, KrrStubProperties properties) { - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + TrygdeetatenAzureAdTokenService tokenService, + Consumers consumers + ) { var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties).map(AccessToken::getTokenValue)); - - return builder.routes() - .route(spec -> spec.path("/api/v2/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) - .uri(properties.getUrl())) + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(consumers.getKrrstub()) + .map(AccessToken::getTokenValue)); + return builder + .routes() + .route( + spec -> spec.path("/api/v2/**") + .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) + .uri(consumers.getKrrstub().getUrl())) .build(); } } diff --git a/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/config/Consumers.java b/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/config/Consumers.java new file mode 100644 index 00000000000..47051ba2ffb --- /dev/null +++ b/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.krrstubproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties krrstub; + +} diff --git a/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/config/credentials/KrrStubProperties.java b/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/config/credentials/KrrStubProperties.java deleted file mode 100644 index 898b2d417fe..00000000000 --- a/proxies/krrstub-proxy/src/main/java/no/nav/testnav/proxies/krrstubproxy/config/credentials/KrrStubProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.proxies.krrstubproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.krrstub") -public class KrrStubProperties extends ServerProperties { -} \ No newline at end of file diff --git a/proxies/medl-proxy/build.gradle b/proxies/medl-proxy/build.gradle index 3f2830e4e64..726d6f91832 100644 --- a/proxies/medl-proxy/build.gradle +++ b/proxies/medl-proxy/build.gradle @@ -66,6 +66,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/MedlProxyApplicationStarter.java b/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/MedlProxyApplicationStarter.java index 45abaaf55f6..fdcc8f93b25 100644 --- a/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/MedlProxyApplicationStarter.java +++ b/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/MedlProxyApplicationStarter.java @@ -6,8 +6,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.proxies.medlproxy.config.Consumers; import no.nav.testnav.proxies.medlproxy.config.LocalVaultConfig; -import no.nav.testnav.proxies.medlproxy.config.credentials.MedlStubProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; @@ -29,15 +29,22 @@ public static void main(String[] args) { } @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, TrygdeetatenAzureAdTokenService tokenService, MedlStubProperties properties) { - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + TrygdeetatenAzureAdTokenService tokenService, + Consumers consumers + ) { var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties).map(AccessToken::getTokenValue)); - - return builder.routes() - .route(spec -> spec.path("/rest/v1/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) - .uri(properties.getUrl())) + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(consumers.getMedlstub()) + .map(AccessToken::getTokenValue)); + return builder + .routes() + .route( + spec -> spec.path("/rest/v1/**") + .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) + .uri(consumers.getMedlstub().getUrl())) .build(); } } \ No newline at end of file diff --git a/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/config/Consumers.java b/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/config/Consumers.java new file mode 100644 index 00000000000..bdde698ba03 --- /dev/null +++ b/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.medlproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties medlstub; + +} diff --git a/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/config/credentials/MedlStubProperties.java b/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/config/credentials/MedlStubProperties.java deleted file mode 100644 index 09c285683a0..00000000000 --- a/proxies/medl-proxy/src/main/java/no/nav/testnav/proxies/medlproxy/config/credentials/MedlStubProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.proxies.medlproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.medlstub") -public class MedlStubProperties extends ServerProperties { -} \ No newline at end of file diff --git a/proxies/pdl-proxy/build.gradle b/proxies/pdl-proxy/build.gradle index a6f748658c8..a54d1392209 100644 --- a/proxies/pdl-proxy/build.gradle +++ b/proxies/pdl-proxy/build.gradle @@ -67,6 +67,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + implementation 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/PdlProxyApplicationStarter.java b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/PdlProxyApplicationStarter.java index bdf9e0b038c..2c005c92a5d 100644 --- a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/PdlProxyApplicationStarter.java +++ b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/PdlProxyApplicationStarter.java @@ -7,9 +7,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.pdlproxy.config.credentials.PdlApiProperties; -import no.nav.testnav.proxies.pdlproxy.config.credentials.PdlQ1ApiProperties; -import no.nav.testnav.proxies.pdlproxy.config.credentials.PdlTestdataProperties; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.proxies.pdlproxy.config.Consumers; import no.nav.testnav.proxies.pdlproxy.dto.CredentialsHolder; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -52,20 +51,7 @@ public CredentialsHolder credentialsHolder( public RouteLocator customRouteLocator(RouteLocatorBuilder builder, CredentialsHolder credentialsHolder, TrygdeetatenAzureAdTokenService tokenService, - PdlTestdataProperties pdlTestdataProperties, - PdlApiProperties pdlApiProperties, - PdlQ1ApiProperties pdlQ1ApiProperties) { - - var addPdlApiAuthenticationHeaderFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(pdlApiProperties) - .map(AccessToken::getTokenValue)); - var addPdlQ1ApiAuthenticationHeaderFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(pdlQ1ApiProperties) - .map(AccessToken::getTokenValue)); - var addPdlTestdataAuthenticationHeaderFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(pdlTestdataProperties) - .map(AccessToken::getTokenValue)); - + Consumers consumers) { var addHendelselagerApiKeyAuthenticationHeader = AddAuthenticationRequestGatewayFilterFactory .apiKeyAuthenticationHeaderFilter(credentialsHolder.hendelselagerApiKey()); var addAktoerAdminApiKeyAuthenticationHeader = AddAuthenticationRequestGatewayFilterFactory @@ -75,9 +61,9 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder, return builder .routes() - .route(createRoute("pdl-api", pdlApiProperties.getUrl(), addPdlApiAuthenticationHeaderFilter)) - .route(createRoute("pdl-api-q1", pdlQ1ApiProperties.getUrl(), addPdlQ1ApiAuthenticationHeaderFilter)) - .route(createRoute("pdl-testdata", pdlTestdataProperties.getUrl(), addPdlTestdataAuthenticationHeaderFilter)) + .route(createRoute(consumers.getPdlApi(), tokenService)) + .route(createRoute(consumers.getPdlApiQ1(), tokenService)) + .route(createRoute(consumers.getPdlTestdata(), tokenService)) .route(createRoute("pdl-identhendelse", "http://pdl-identhendelse-lager.pdl.svc.nais.local", addHendelselagerApiKeyAuthenticationHeader)) .route(createRoute("pdl-npid", "http://pdl-aktor.pdl.svc.nais.local", addAktoerAdminApiKeyAuthenticationHeader)) .route(createRoute("pdl-elastic", "https://pdl-es-q.adeo.no", addElasticSearchBasicAuthenticationHeader)) @@ -92,4 +78,16 @@ private Function> createRoute(String segment, St .filter(filter) ).uri(host); } + + private Function> createRoute(ServerProperties serverProperties, TrygdeetatenAzureAdTokenService tokenService) { + var segment = serverProperties.getName(); + var host = serverProperties.getUrl(); + var filter = AddAuthenticationRequestGatewayFilterFactory + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(serverProperties) + .map(AccessToken::getTokenValue)); + return createRoute(segment, host, filter); + } + } \ No newline at end of file diff --git a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/Consumers.java b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/Consumers.java new file mode 100644 index 00000000000..599572c12c2 --- /dev/null +++ b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/Consumers.java @@ -0,0 +1,31 @@ +package no.nav.testnav.proxies.pdlproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties pdlApi; + private ServerProperties pdlApiQ1; + private ServerProperties pdlTestdata; + +} diff --git a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlApiProperties.java b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlApiProperties.java deleted file mode 100644 index 74ed34b0df9..00000000000 --- a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlApiProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.proxies.pdlproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-api") -public class PdlApiProperties extends ServerProperties { -} \ No newline at end of file diff --git a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlQ1ApiProperties.java b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlQ1ApiProperties.java deleted file mode 100644 index fe0e77b2506..00000000000 --- a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlQ1ApiProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.proxies.pdlproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-api-q1") -public class PdlQ1ApiProperties extends ServerProperties { -} \ No newline at end of file diff --git a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlTestdataProperties.java b/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlTestdataProperties.java deleted file mode 100644 index 4e99105f4d8..00000000000 --- a/proxies/pdl-proxy/src/main/java/no/nav/testnav/proxies/pdlproxy/config/credentials/PdlTestdataProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.testnav.proxies.pdlproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.pdl-testdata") -public class PdlTestdataProperties extends ServerProperties { -} \ No newline at end of file diff --git a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/PensjonTestdataFacadeProxyApplicationStarter.java b/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/PensjonTestdataFacadeProxyApplicationStarter.java index 4a18d5568a5..729787956e5 100644 --- a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/PensjonTestdataFacadeProxyApplicationStarter.java +++ b/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/PensjonTestdataFacadeProxyApplicationStarter.java @@ -7,8 +7,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.pensjontestdatafacadeproxy.config.credentials.PoppTestdataProperties; -import no.nav.testnav.proxies.pensjontestdatafacadeproxy.config.credentials.SamboerTestdataProperties; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.proxies.pensjontestdatafacadeproxy.config.Consumers; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.filter.GatewayFilter; @@ -34,49 +34,52 @@ public class PensjonTestdataFacadeProxyApplicationStarter { @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder, TrygdeetatenAzureAdTokenService tokenService, - PoppTestdataProperties poppProperties, - SamboerTestdataProperties samboerProperties) { - - var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(poppProperties).map(AccessToken::getTokenValue)); - + Consumers consumers) { var routes = builder.routes(); - -// routes.route(spec -> spec -// .path("/api/v1/inntekt") -// .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter) -// .setRequestHeader("Nav-Call-Id", "Dolly " + UUID.randomUUID()) -// .setRequestHeader("Nav-Consumer-Id", "Dolly")) -// .uri(poppProperties.getUrl())); - - Arrays.stream(MILJOER) - .forEach(miljoe -> - routes.route(spec -> spec - .path("/" + miljoe + "/api/samboer/**") - .filters(filterSPec -> filterSPec.filter(getAuthenticationFilter(tokenService, samboerProperties, miljoe)) - .rewritePath("/" + miljoe + "/(?.*)", "/${segment}")) - .uri(samboerProperties.forEnvironment(miljoe).getUrl()))); - - routes.route(spec -> spec - .path("/api/**") - .filters(gatewayFilterSpec -> gatewayFilterSpec - .addRequestHeader(HttpHeaders.AUTHORIZATION, "dolly") - ) //Auth header er required men sjekkes ikke utover det - .uri("http://pensjon-testdata-facade.pensjontestdata.svc.nais.local/")) + Arrays + .stream(MILJOER) + .forEach( + miljoe -> + routes.route( + spec -> spec + .path("/" + miljoe + "/api/samboer/**") + .filters(filterSPec -> filterSPec.filter(getAuthenticationFilter(tokenService, consumers.getSamboerTestdata(), miljoe)) + .rewritePath("/" + miljoe + "/(?.*)", "/${segment}")) + .uri(forEnvironment(consumers.getSamboerTestdata(), miljoe).getUrl()))); + routes + .route( + spec -> spec + .path("/api/**") + .filters(gatewayFilterSpec -> gatewayFilterSpec + .addRequestHeader(HttpHeaders.AUTHORIZATION, "dolly") + ) //Auth header er required men sjekkes ikke utover det + .uri("http://pensjon-testdata-facade.pensjontestdata.svc.nais.local/")) .build(); return routes.build(); } + private GatewayFilter getAuthenticationFilter(TrygdeetatenAzureAdTokenService tokenService, - SamboerTestdataProperties serverProperties, + ServerProperties serverProperties, String miljoe) { - return AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService - .exchange(serverProperties.forEnvironment(miljoe)) - .map(AccessToken::getTokenValue)); + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(forEnvironment(serverProperties, miljoe)) + .map(AccessToken::getTokenValue)); + } + + private static ServerProperties forEnvironment(ServerProperties original, String env) { + return ServerProperties.of( + original.getCluster(), + original.getNamespace(), + original.getName().replace("MILJOE", env), + original.getUrl().replace("MILJOE", env + ("q1".equals(env) ? ".very" : "")) + ); } + public static void main(String[] args) { SpringApplication.run(PensjonTestdataFacadeProxyApplicationStarter.class, args); } + } \ No newline at end of file diff --git a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/Consumers.java b/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/Consumers.java new file mode 100644 index 00000000000..814a4d8b2c6 --- /dev/null +++ b/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.pensjontestdatafacadeproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties samboerTestdata; + +} diff --git a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/credentials/PoppTestdataProperties.java b/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/credentials/PoppTestdataProperties.java deleted file mode 100644 index 38c505d39b1..00000000000 --- a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/credentials/PoppTestdataProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.proxies.pensjontestdatafacadeproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.popp-testdata") -public class PoppTestdataProperties extends ServerProperties { -} diff --git a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/credentials/SamboerTestdataProperties.java b/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/credentials/SamboerTestdataProperties.java deleted file mode 100644 index bb19cd87b1e..00000000000 --- a/proxies/pensjon-testdata-facade-proxy/src/main/java/no/nav/testnav/proxies/pensjontestdatafacadeproxy/config/credentials/SamboerTestdataProperties.java +++ /dev/null @@ -1,27 +0,0 @@ -package no.nav.testnav.proxies.pensjontestdatafacadeproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.samboer-testdata") -public class SamboerTestdataProperties extends ServerProperties { - - private static SamboerTestdataProperties copyOf(SamboerTestdataProperties original) { - var copy = new SamboerTestdataProperties(); - copy.setCluster(original.getCluster()); - copy.setName(original.getName()); - copy.setNamespace(original.getNamespace()); - copy.setUrl(original.getUrl()); - return copy; - } - - public SamboerTestdataProperties forEnvironment(String env) { - - var copy = copyOf(this); - copy.setUrl(copy.getUrl().replace("MILJOE", env + ("q1".equals(env) ? ".very" : ""))); - copy.setName(copy.getName().replace("MILJOE", env)); - return copy; - } -} diff --git a/proxies/pensjon-testdata-facade-proxy/src/main/resources/application.yml b/proxies/pensjon-testdata-facade-proxy/src/main/resources/application.yml index c22bfb5f11e..b81dba22e28 100644 --- a/proxies/pensjon-testdata-facade-proxy/src/main/resources/application.yml +++ b/proxies/pensjon-testdata-facade-proxy/src/main/resources/application.yml @@ -23,11 +23,6 @@ spring: enabled: false consumers: - popp-testdata: - name: popp-testdata - namespace: pensjonopptjening - url: https://popp-testdata.intern.dev.nav.no - cluster: dev-gcp samboer-testdata: name: pensjon-samboerforhold-backend-MILJOE namespace: pensjon-person diff --git a/proxies/pensjon-testdata-facade-proxy/src/test/resources/application-test.yml b/proxies/pensjon-testdata-facade-proxy/src/test/resources/application-test.yml index adff1d7e5c1..f693ce3567f 100644 --- a/proxies/pensjon-testdata-facade-proxy/src/test/resources/application-test.yml +++ b/proxies/pensjon-testdata-facade-proxy/src/test/resources/application-test.yml @@ -1,10 +1,6 @@ azure.app.client.id: dummy consumers: - popp-testdata: - name: popp-dummy - namespace: dummy - url: https://popp-dummy.dummy.no samboer-testdata: name: pensjon-dummy namespace: dummy diff --git a/proxies/saf-proxy/build.gradle b/proxies/saf-proxy/build.gradle index 8710643120b..54cac54afda 100644 --- a/proxies/saf-proxy/build.gradle +++ b/proxies/saf-proxy/build.gradle @@ -67,6 +67,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/Consumers.java b/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/Consumers.java new file mode 100644 index 00000000000..db24af454cd --- /dev/null +++ b/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.safproxy; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties saf; + +} diff --git a/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/SafProxyApplicationStarter.java b/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/SafProxyApplicationStarter.java index 2d05f94cd08..e807b32d944 100644 --- a/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/SafProxyApplicationStarter.java +++ b/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/SafProxyApplicationStarter.java @@ -6,7 +6,7 @@ import no.nav.testnav.libs.reactiveproxy.filter.AddAuthenticationRequestGatewayFilterFactory; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.TrygdeetatenAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.safproxy.config.credentials.SafProperties; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.filter.GatewayFilter; @@ -29,23 +29,26 @@ @SpringBootApplication public class SafProxyApplicationStarter { - private static final String[] miljoer = new String[]{ "q1", "q2", "q4", "q5", "t3" }; + private static final String[] miljoer = new String[]{"q1", "q2", "q4", "q5", "t3"}; @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, - TrygdeetatenAzureAdTokenService tokenService, - SafProperties safProperties) { - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + TrygdeetatenAzureAdTokenService tokenService, + Consumers consumers + ) { var routes = builder.routes(); - Arrays.asList(miljoer) - .forEach(miljoe -> { - var properties = safProperties.forEnvironment(miljoe); - routes.route(createRoute(miljoe, properties.getUrl(), - AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties) - .map(AccessToken::getTokenValue)))); - }); - + Arrays + .asList(miljoer) + .forEach( + miljoe -> { + var properties = forEnvironment(consumers.getSaf(), miljoe); + routes + .route(createRoute(miljoe, properties.getUrl(), + AddAuthenticationRequestGatewayFilterFactory + .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties) + .map(AccessToken::getTokenValue)))); + }); return routes.build(); } @@ -61,4 +64,15 @@ private Function> createRoute(String miljo, Stri .filter(filter) ).uri(url); } + + private static ServerProperties forEnvironment(ServerProperties original, String env) { + var replacement = "q2".equals(env) ? "" : '-' + env; + return ServerProperties.of( + original.getCluster(), + original.getNamespace(), + original.getName().replace("-MILJOE", replacement), + original.getUrl().replace("-MILJOE", replacement) + ); + } + } diff --git a/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/config/credentials/SafProperties.java b/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/config/credentials/SafProperties.java deleted file mode 100644 index deeae335fb9..00000000000 --- a/proxies/saf-proxy/src/main/java/no/nav/testnav/proxies/safproxy/config/credentials/SafProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -package no.nav.testnav.proxies.safproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.saf") -public class SafProperties extends ServerProperties { - - private static SafProperties copyOf(SafProperties original) { - var copy = new SafProperties(); - copy.setCluster(original.getCluster()); - copy.setName(original.getName()); - copy.setNamespace(original.getNamespace()); - copy.setUrl(original.getUrl()); - return copy; - } - - public ServerProperties forEnvironment(String env) { - var replacement = "q2".equals(env) ? "" : '-' + env; - var copy = SafProperties.copyOf(this); - copy.setUrl(copy.getUrl().replace("-MILJOE", replacement)); - copy.setName(copy.getName().replace("-MILJOE", replacement)); - return copy; - } - -} \ No newline at end of file diff --git a/proxies/statisk-data-forvalter-proxy/build.gradle b/proxies/statisk-data-forvalter-proxy/build.gradle index aed1fd224a4..9b560f4f315 100644 --- a/proxies/statisk-data-forvalter-proxy/build.gradle +++ b/proxies/statisk-data-forvalter-proxy/build.gradle @@ -68,6 +68,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/Consumers.java b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/Consumers.java new file mode 100644 index 00000000000..04809bcf12a --- /dev/null +++ b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.statiskdataforvalterproxy; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties statiskdataforvalter; + +} diff --git a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java index 000b9c63e1e..634d061bcee 100644 --- a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java +++ b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java @@ -7,7 +7,6 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.NavAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.statiskdataforvalterproxy.config.credentials.StatiskdataforvalterProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; @@ -23,21 +22,29 @@ }) @SpringBootApplication public class StatiskDataForvalterProxyApplicationStarter { + public static void main(String[] args) { SpringApplication.run(StatiskDataForvalterProxyApplicationStarter.class, args); } @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, NavAzureAdTokenService tokenService, StatiskdataforvalterProperties properties) { + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + NavAzureAdTokenService tokenService, + Consumers consumers + ) { var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties).map(AccessToken::getTokenValue)); - - return builder.routes() - .route(spec -> spec - .path("/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) - .uri(properties.getUrl()) - ) + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(consumers.getStatiskdataforvalter()) + .map(AccessToken::getTokenValue)); + return builder + .routes() + .route( + spec -> spec + .path("/**") + .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) + .uri(consumers.getStatiskdataforvalter().getUrl())) .build(); } diff --git a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/config/credentials/StatiskdataforvalterProperties.java b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/config/credentials/StatiskdataforvalterProperties.java deleted file mode 100644 index 67cd768aec8..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/config/credentials/StatiskdataforvalterProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.proxies.statiskdataforvalterproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.statiskdataforvalter") -public class StatiskdataforvalterProperties extends ServerProperties { -} diff --git a/proxies/synthdata-meldekort-proxy/build.gradle b/proxies/synthdata-meldekort-proxy/build.gradle index 6e6c5603b08..adf546b2ceb 100644 --- a/proxies/synthdata-meldekort-proxy/build.gradle +++ b/proxies/synthdata-meldekort-proxy/build.gradle @@ -72,6 +72,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/StatusController.java b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/StatusController.java index d95f8c267ec..e6de3a1f5f5 100644 --- a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/StatusController.java +++ b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/StatusController.java @@ -1,7 +1,7 @@ package no.nav.testnav.proxies.synthdatameldekortproxy; import no.nav.testnav.libs.dto.status.v1.TestnavStatusResponse; -import no.nav.testnav.proxies.synthdatameldekortproxy.config.credentials.SyntMeldekortProperties; +import no.nav.testnav.proxies.synthdatameldekortproxy.config.Consumers; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -16,8 +16,8 @@ public class StatusController { private final String url; - public StatusController(SyntMeldekortProperties properties) { - url = properties.getUrl(); + public StatusController(Consumers consumers) { + url = consumers.getSyntMeldekort().getUrl(); } @GetMapping(value = "/internal/status", produces = MediaType.APPLICATION_JSON_VALUE) diff --git a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/SynthdataMeldekortProxyApplicationStarter.java b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/SynthdataMeldekortProxyApplicationStarter.java index 4010c801920..d80cee2b33f 100644 --- a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/SynthdataMeldekortProxyApplicationStarter.java +++ b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/SynthdataMeldekortProxyApplicationStarter.java @@ -6,8 +6,8 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.azuread.NavAzureAdTokenService; import no.nav.testnav.libs.securitycore.domain.AccessToken; +import no.nav.testnav.proxies.synthdatameldekortproxy.config.Consumers; import no.nav.testnav.proxies.synthdatameldekortproxy.config.VaultConfig; -import no.nav.testnav.proxies.synthdatameldekortproxy.config.credentials.SyntMeldekortProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; @@ -29,15 +29,23 @@ public static void main(String[] args) { } @Bean - public RouteLocator customRouteLocator(RouteLocatorBuilder builder, NavAzureAdTokenService tokenService, SyntMeldekortProperties properties) { - + public RouteLocator customRouteLocator( + RouteLocatorBuilder builder, + NavAzureAdTokenService tokenService, + Consumers consumers + ) { var addAuthenticationHeaderFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenService.exchange(properties).map(AccessToken::getTokenValue)); - - return builder.routes() - .route(spec -> spec.path("/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderFilter)) - .uri(properties.getUrl())) + .bearerAuthenticationHeaderFilter( + () -> tokenService + .exchange(consumers.getSyntMeldekort()) + .map(AccessToken::getTokenValue)); + return builder + .routes() + .route( + spec -> spec.path("/**") + .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderFilter)) + .uri(consumers.getSyntMeldekort().getUrl())) .build(); } + } \ No newline at end of file diff --git a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/config/Consumers.java b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/config/Consumers.java new file mode 100644 index 00000000000..455bab0b80e --- /dev/null +++ b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.synthdatameldekortproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties syntMeldekort; + +} diff --git a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/config/credentials/SyntMeldekortProperties.java b/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/config/credentials/SyntMeldekortProperties.java deleted file mode 100644 index 91efb1a988c..00000000000 --- a/proxies/synthdata-meldekort-proxy/src/main/java/no/nav/testnav/proxies/synthdatameldekortproxy/config/credentials/SyntMeldekortProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.proxies.synthdatameldekortproxy.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.synt-meldekort") -public class SyntMeldekortProperties extends ServerProperties { -} diff --git a/proxies/udistub-proxy/build.gradle b/proxies/udistub-proxy/build.gradle index 941365c9eac..a882ec7bada 100644 --- a/proxies/udistub-proxy/build.gradle +++ b/proxies/udistub-proxy/build.gradle @@ -68,6 +68,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' + + annotationProcessor 'org.projectlombok:lombok' + implementation 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' } java { toolchain { diff --git a/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/Consumers.java b/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/Consumers.java new file mode 100644 index 00000000000..042217e510e --- /dev/null +++ b/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.udistubproxy; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties testnavUdistub; + +} diff --git a/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/UdistubProxyApplicationStarter.java b/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/UdistubProxyApplicationStarter.java index 0ea9037d984..8f3fe516a11 100644 --- a/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/UdistubProxyApplicationStarter.java +++ b/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/UdistubProxyApplicationStarter.java @@ -1,5 +1,6 @@ package no.nav.testnav.proxies.udistubproxy; +import lombok.RequiredArgsConstructor; import no.nav.testnav.libs.reactivecore.config.CoreConfig; import no.nav.testnav.libs.reactiveproxy.config.DevConfig; import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; @@ -7,7 +8,6 @@ import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.proxies.udistubproxy.credentials.UdistubServiceProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.gateway.route.RouteLocator; @@ -24,32 +24,33 @@ SecureOAuth2ServerToServerConfiguration.class }) @SpringBootApplication +@RequiredArgsConstructor public class UdistubProxyApplicationStarter { - private final TokenExchange tokenExchange; - private final UdistubServiceProperties udistubServiceProperties; - public UdistubProxyApplicationStarter(TokenExchange tokenExchange, UdistubServiceProperties udistubServiceProperties) { - this.tokenExchange = tokenExchange; - this.udistubServiceProperties = udistubServiceProperties; - } + private final TokenExchange tokenExchange; + private final Consumers consumers; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { var addAuthenticationHeaderFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter(() -> tokenExchange.exchange(udistubServiceProperties).map(AccessToken::getTokenValue)); - + .bearerAuthenticationHeaderFilter( + () -> tokenExchange + .exchange(consumers.getTestnavUdistub()) + .map(AccessToken::getTokenValue)); return builder .routes() .route(spec -> spec.path("/**") - .filters(filterspec -> filterspec - .setResponseHeader(CONTENT_TYPE, "application/json; charset=UTF-8") - .filter(addAuthenticationHeaderFilter)) - .uri(udistubServiceProperties.getUrl())) + .filters( + filterspec -> filterspec + .setResponseHeader(CONTENT_TYPE, "application/json; charset=UTF-8") + .filter(addAuthenticationHeaderFilter)) + .uri(consumers.getTestnavUdistub().getUrl())) .build(); } public static void main(String[] args) { SpringApplication.run(UdistubProxyApplicationStarter.class, args); } + } diff --git a/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/credentials/UdistubServiceProperties.java b/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/credentials/UdistubServiceProperties.java deleted file mode 100644 index 861b1688c1d..00000000000 --- a/proxies/udistub-proxy/src/main/java/no/nav/testnav/proxies/udistubproxy/credentials/UdistubServiceProperties.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.proxies.udistubproxy.credentials; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; - - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-udistub") -public class UdistubServiceProperties extends ServerProperties { -} \ No newline at end of file