Skip to content

Commit c90e302

Browse files
committed
Merge branch 'master' into change/common_testing_internal
2 parents 85eb271 + c1268d6 commit c90e302

File tree

125 files changed

+2116
-923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2116
-923
lines changed

.github/workflows/app.dolly-search-service.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
with:
2020
working-directory: "apps/dolly-search-service"
2121
deploy-tag: "#deploy-dolly-search-service"
22+
deploy-tag-test: "#deploy-test-dolly-search-service"
2223
permissions:
2324
contents: read
2425
id-token: write
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: brregstub-reverse--proxy
2+
3+
on:
4+
push:
5+
paths:
6+
- "plugins/**"
7+
- "libs/reactive-core/**"
8+
- "libs/reactive-proxy/**"
9+
- "proxies/brregstub-reverse-proxy/**"
10+
- ".github/workflows/proxy.brregstub-reverse-proxy.yml"
11+
12+
jobs:
13+
workflow:
14+
uses: ./.github/workflows/common.workflow.backend.yml
15+
with:
16+
cluster: "dev-fss"
17+
working-directory: "proxies/brregstub-reverse-proxy"
18+
deploy-tag: "#deploy-proxy-brregstub-reverse"
19+
permissions:
20+
contents: read
21+
id-token: write
22+
secrets: inherit

apps/brreg-stub/src/main/java/no/nav/brregstub/config/AppConfig.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
77

88
import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
9-
import no.nav.testnav.libs.database.config.FlywayConfiguration;
10-
import no.nav.testnav.libs.database.config.VaultHikariConfiguration;
119

1210
@Configuration
1311
@EnableJpaAuditing
1412
@EnableJpaRepositories(basePackages = "no.nav.brregstub.database.repository")
1513
@Import({
16-
ApplicationCoreConfig.class,
17-
VaultHikariConfiguration.class,
18-
FlywayConfiguration.class,
14+
ApplicationCoreConfig.class
1915
})
2016
public class AppConfig {
2117
}

apps/brreg-stub/src/main/resources/application-prod.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
21
spring:
2+
config:
3+
import: "vault://"
34
flyway:
45
locations: classpath:db/migration/postgresql
56
datasource:
@@ -30,5 +31,3 @@ spring:
3031
role: testnav-brregstub-admin
3132
backend: postgresql/preprod-fss
3233
fail-fast: true
33-
config:
34-
import: vault://

apps/bruker-service/config.test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
accessPolicy:
2121
inbound:
2222
rules:
23+
- application: dolly-backend-dev
2324
- application: dolly-frontend-dev
2425
- application: dolly-frontend-dev-unstable
2526
- application: team-dolly-lokal-app

apps/bruker-service/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
accessPolicy:
2121
inbound:
2222
rules:
23+
- application: dolly-backend
2324
- application: dolly-frontend
2425
- application: dolly-idporten
2526
- application: testnav-oversikt-frontend
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package no.nav.testnav.apps.brukerservice.controller;
2+
3+
import lombok.RequiredArgsConstructor;
4+
import no.nav.testnav.apps.brukerservice.dto.TilgangDTO;
5+
import no.nav.testnav.apps.brukerservice.service.TilgangService;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.RequestMapping;
8+
import org.springframework.web.bind.annotation.RestController;
9+
import reactor.core.publisher.Mono;
10+
11+
@RestController
12+
@RequestMapping("/api/v1/tilgang")
13+
@RequiredArgsConstructor
14+
public class TilgangController {
15+
16+
private final TilgangService tilgangService;
17+
18+
@GetMapping
19+
public Mono<TilgangDTO> getBrukereISammeOrganisasjon(String brukerId) {
20+
21+
return tilgangService.getBrukereISammeOrganisasjon(brukerId);
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package no.nav.testnav.apps.brukerservice.dto;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
import java.util.List;
9+
10+
@Data
11+
@Builder
12+
@NoArgsConstructor
13+
@AllArgsConstructor
14+
public class TilgangDTO {
15+
16+
private List<String> brukere;
17+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
package no.nav.testnav.apps.brukerservice.repository;
22

3+
import org.springframework.data.r2dbc.repository.Query;
4+
import org.springframework.data.repository.query.Param;
35
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
6+
import reactor.core.publisher.Flux;
47
import reactor.core.publisher.Mono;
58

69
public interface UserRepository extends ReactiveCrudRepository<UserEntity, String> {
10+
711
Mono<UserEntity> findByBrukernavn(String brukernavn);
812

913
Mono<Boolean> existsByBrukernavn(String brukernavn);
14+
15+
@Query("select * from user_entity as ue " +
16+
"join user_entity as u on u.organisasjonsnummer = ue.organisasjonsnummer " +
17+
"and u.id = :brukerId")
18+
Flux<UserEntity> findBrukereISammeOrganisasjoner(@Param("brukerId") String brukerId);
1019
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package no.nav.testnav.apps.brukerservice.service;
2+
3+
import lombok.RequiredArgsConstructor;
4+
import no.nav.testnav.apps.brukerservice.dto.TilgangDTO;
5+
import no.nav.testnav.apps.brukerservice.repository.UserEntity;
6+
import no.nav.testnav.apps.brukerservice.repository.UserRepository;
7+
import org.springframework.stereotype.Service;
8+
import reactor.core.publisher.Mono;
9+
10+
@Service
11+
@RequiredArgsConstructor
12+
public class TilgangService {
13+
14+
private final UserRepository userRepository;
15+
16+
public Mono<TilgangDTO> getBrukereISammeOrganisasjon(String brukerId) {
17+
18+
return userRepository.findBrukereISammeOrganisasjoner(brukerId)
19+
.mapNotNull(UserEntity::getId)
20+
.collectList()
21+
.map(TilgangDTO::new);
22+
}
23+
}

apps/dolly-backend/config.test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
- application: testnav-arbeidsforhold-service
3333
- application: testnav-arbeidsplassencv-proxy
3434
- application: testnav-arbeidssoekerregisteret-proxy
35-
- application: testnav-dolly-search-service
35+
- application: testnav-bruker-service-dev
3636
- application: testnav-inntektsmelding-service
3737
- application: testnav-kodeverk-service
3838
- application: testnav-miljoer-service

apps/dolly-backend/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
- application: testnav-arbeidsforhold-service
3535
- application: testnav-arbeidsplassencv-proxy
3636
- application: testnav-arbeidssoekerregisteret-proxy
37-
- application: testnav-dolly-search-service
37+
- application: testnav-bruker-service
3838
- application: testnav-inntektsmelding-service
3939
- application: testnav-kodeverk-service
4040
- application: testnav-miljoer-service

apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ public static void main(String[] args) {
1414
.initializers(new NaisEnvironmentApplicationContextInitializer())
1515
.run(args);
1616
}
17-
}
17+
}

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/KrrstubConsumer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public Mono<DigitalKontaktdataResponse> createDigitalKontaktdata(DigitalKontaktd
5151
.flatMap(token -> new KontaktdataPostCommand(webClient, digitalKontaktdata, token.getTokenValue()).call());
5252
}
5353

54-
@Timed(name = "providers", tags = { "operation", "krrstub_getKontaktdata" })
54+
@Timed(name = "providers", tags = { "operation", "krrstub_deleteKontaktdata" })
5555
public Flux<DigitalKontaktdataResponse> deleteKontaktdata(List<String> identer) {
5656

5757
return tokenService.exchange(serverProperties)

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/GetKontaktdataCommand.java

-51
This file was deleted.

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktadataDeleteCommand.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
import lombok.extern.slf4j.Slf4j;
55
import no.nav.dolly.bestilling.krrstub.dto.DigitalKontaktdataResponse;
66
import no.nav.dolly.metrics.Timed;
7-
import no.nav.dolly.util.RequestHeaderUtil;
87
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter;
98
import no.nav.testnav.libs.securitycore.config.UserConstant;
109
import org.springframework.http.HttpHeaders;
10+
import org.springframework.http.HttpMethod;
1111
import org.springframework.http.HttpStatus;
1212
import org.springframework.web.reactive.function.client.WebClient;
1313
import org.springframework.web.reactive.function.client.WebClientResponseException;
1414
import reactor.core.publisher.Mono;
1515
import reactor.util.retry.Retry;
1616

1717
import java.time.Duration;
18+
import java.util.HashMap;
19+
import java.util.Map;
1820
import java.util.concurrent.Callable;
1921

2022
import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER;
21-
import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID;
2223
import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID;
23-
import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_PERSON_IDENT;
2424
import static no.nav.dolly.util.TokenXUtil.getUserJwt;
2525

2626
@Slf4j
@@ -36,15 +36,18 @@ public class KontaktadataDeleteCommand implements Callable<Mono<DigitalKontaktda
3636
@Timed(name = "providers", tags = { "operation", "krrstub_deleteKontaktdata" })
3737
public Mono<DigitalKontaktdataResponse> call() {
3838

39-
return webClient.delete()
39+
40+
var body = new HashMap<>();
41+
body.put("personidentifikator", ident);
42+
43+
return webClient.method(HttpMethod.DELETE)
4044
.uri(uriBuilder -> uriBuilder
4145
.path(DIGITAL_KONTAKT_URL)
4246
.build())
43-
.header(HEADER_NAV_CALL_ID, RequestHeaderUtil.getNavCallId())
47+
.bodyValue(body)
4448
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
4549
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
4650
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
47-
.header(HEADER_NAV_PERSON_IDENT, ident)
4851
.retrieve()
4952
.toBodilessEntity()
5053
.map(response -> DigitalKontaktdataResponse.builder()

apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktdataPostCommand.java

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import lombok.RequiredArgsConstructor;
44
import no.nav.dolly.bestilling.krrstub.dto.DigitalKontaktdataResponse;
55
import no.nav.dolly.domain.resultset.krrstub.DigitalKontaktdata;
6-
import no.nav.dolly.util.RequestHeaderUtil;
76
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter;
87
import no.nav.testnav.libs.securitycore.config.UserConstant;
98
import org.springframework.http.HttpHeaders;
@@ -17,7 +16,6 @@
1716
import java.util.concurrent.Callable;
1817

1918
import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER;
20-
import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID;
2119
import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID;
2220
import static no.nav.dolly.util.TokenXUtil.getUserJwt;
2321

@@ -38,7 +36,6 @@ public Mono<DigitalKontaktdataResponse> call() {
3836
.path(DIGITAL_KONTAKT_URL)
3937
.build())
4038
.contentType(MediaType.APPLICATION_JSON)
41-
.header(HEADER_NAV_CALL_ID, RequestHeaderUtil.getNavCallId())
4239
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
4340
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
4441
.header(UserConstant.USER_HEADER_JWT, getUserJwt())

apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ public class Consumers {
4747
private ServerProperties testnavSkattekortService;
4848
private ServerProperties yrkesskadeProxy;
4949
private ServerProperties arbeidssoekerregisteretProxy;
50-
private ServerProperties dollySearchService;
50+
private ServerProperties brukerService;
5151
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
package no.nav.dolly.opensearch;
1+
package no.nav.dolly.consumer.brukerservice;
22

33
import lombok.extern.slf4j.Slf4j;
44
import no.nav.dolly.config.Consumers;
5-
import no.nav.dolly.opensearch.command.DollySearchServicePostCommand;
6-
import no.nav.testnav.libs.data.dollysearchservice.v1.SearchRequest;
7-
import no.nav.testnav.libs.data.dollysearchservice.v1.SearchResponse;
5+
import no.nav.dolly.consumer.brukerservice.command.BrukerServiceGetTilgangCommand;
6+
import no.nav.dolly.consumer.brukerservice.dto.TilgangDTO;
87
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
98
import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange;
109
import org.springframework.stereotype.Service;
@@ -13,27 +12,28 @@
1312

1413
@Service
1514
@Slf4j
16-
public class DollySearchServiceConsumer {
15+
public class BrukerServiceConsumer {
1716

1817
private final TokenExchange tokenService;
1918
private final WebClient webClient;
2019
private final ServerProperties serverProperties;
2120

22-
public DollySearchServiceConsumer(
21+
public BrukerServiceConsumer(
2322
TokenExchange tokenService,
2423
Consumers consumers,
2524
WebClient.Builder webClientBuilder) {
2625

2726
this.tokenService = tokenService;
28-
serverProperties = consumers.getDollySearchService();
27+
serverProperties = consumers.getBrukerService();
2928
this.webClient = webClientBuilder
3029
.baseUrl(serverProperties.getUrl())
3130
.build();
3231
}
3332

34-
public Mono<SearchResponse> doPersonSearch(SearchRequest request) {
33+
public Mono<TilgangDTO> getKollegaerIOrganisasjon(String brukerId) {
3534

3635
return tokenService.exchange(serverProperties)
37-
.flatMap(token -> new DollySearchServicePostCommand(webClient, request, token.getTokenValue()).call());
36+
.flatMap(token ->
37+
new BrukerServiceGetTilgangCommand(webClient, brukerId, token.getTokenValue()).call());
3838
}
3939
}

0 commit comments

Comments
 (0)