From e48b85bd5b639aea363b941a562699cbeb674bb5 Mon Sep 17 00:00:00 2001 From: haakonph Date: Mon, 21 Aug 2023 15:29:25 +0200 Subject: [PATCH 1/2] bare returnere true for har nivaaa 4 kallet --- .../client/difi/DifiAccessTokenProvider.java | 5 -- .../difi/DifiAccessTokenProviderImpl.java | 55 -------------- .../veilarbperson/client/difi/DifiClient.java | 8 --- .../client/difi/DifiClientImpl.java | 68 ------------------ .../client/difi/HarLoggetInnRespons.java | 3 +- .../client/difi/SbsServiceUser.java | 11 --- .../veilarbperson/config/ClientConfig.java | 25 +------ .../controller/PersonController.java | 11 ++- .../service/PersonV2Service.java | 20 +----- .../client/DifiClientImplTest.java | 72 ------------------- .../config/ClientTestConfig.java | 13 +--- .../service/PersonV2ServiceTest.java | 18 ++--- 12 files changed, 23 insertions(+), 286 deletions(-) delete mode 100644 src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProvider.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProviderImpl.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/difi/DifiClient.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/difi/DifiClientImpl.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/difi/SbsServiceUser.java delete mode 100644 src/test/java/no/nav/veilarbperson/client/DifiClientImplTest.java diff --git a/src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProvider.java b/src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProvider.java deleted file mode 100644 index 7b86d813..00000000 --- a/src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProvider.java +++ /dev/null @@ -1,5 +0,0 @@ -package no.nav.veilarbperson.client.difi; - -public interface DifiAccessTokenProvider { - String getAccessToken(); -} diff --git a/src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProviderImpl.java b/src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProviderImpl.java deleted file mode 100644 index 3eb89673..00000000 --- a/src/main/java/no/nav/veilarbperson/client/difi/DifiAccessTokenProviderImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package no.nav.veilarbperson.client.difi; - -import com.nimbusds.jwt.JWTParser; -import lombok.SneakyThrows; -import no.nav.common.auth.utils.TokenUtils; -import no.nav.common.rest.client.RestClient; -import no.nav.common.rest.client.RestUtils; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -public class DifiAccessTokenProviderImpl implements DifiAccessTokenProvider { - private volatile String token; - private final SbsServiceUser sbsServiceUser; - private final OkHttpClient client; - private final String url; - - public DifiAccessTokenProviderImpl(SbsServiceUser sbsServiceUser, String url) { - this.url = url; - this.sbsServiceUser = sbsServiceUser; - this.client = RestClient.baseClient(); - } - - @SneakyThrows - public synchronized String getAccessToken() { - if (token == null || TokenUtils.expiresWithin(JWTParser.parse(token), 30*1000)) { - token = fetchNewToken(); - } - return token; - } - - @SneakyThrows - private String fetchNewToken() { - Request request = new Request - .Builder() - .url(url) - .header(AUTHORIZATION, okhttp3.Credentials.basic(sbsServiceUser.username, sbsServiceUser.password)) - .post(RequestBody.create(new byte[0])) - .build(); - - try (Response response = client.newCall(request).execute()) { - RestUtils.throwIfNotSuccessful(response); - Token tokenResponse = RestUtils.parseJsonResponseOrThrow(response, Token.class); - return tokenResponse.access_token; - } - } - - private static class Token { - String access_token; - } - -} diff --git a/src/main/java/no/nav/veilarbperson/client/difi/DifiClient.java b/src/main/java/no/nav/veilarbperson/client/difi/DifiClient.java deleted file mode 100644 index ca52ba2f..00000000 --- a/src/main/java/no/nav/veilarbperson/client/difi/DifiClient.java +++ /dev/null @@ -1,8 +0,0 @@ -package no.nav.veilarbperson.client.difi; - - -import no.nav.common.types.identer.Fnr; - -public interface DifiClient { - HarLoggetInnRespons harLoggetInnSiste18mnd(Fnr fnr); -} diff --git a/src/main/java/no/nav/veilarbperson/client/difi/DifiClientImpl.java b/src/main/java/no/nav/veilarbperson/client/difi/DifiClientImpl.java deleted file mode 100644 index 4c6873f4..00000000 --- a/src/main/java/no/nav/veilarbperson/client/difi/DifiClientImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package no.nav.veilarbperson.client.difi; - -import lombok.AllArgsConstructor; -import lombok.SneakyThrows; -import no.nav.common.rest.client.RestClient; -import no.nav.common.rest.client.RestUtils; -import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.config.CacheConfig; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import org.springframework.cache.annotation.Cacheable; - -import static org.springframework.http.HttpHeaders.ACCEPT; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - -public class DifiClientImpl implements DifiClient { - - private final DifiAccessTokenProvider difiAccessTokenProvider; - private final OkHttpClient client; - private final String difiUrl; - private final String xNavApikey; - - - public DifiClientImpl(DifiAccessTokenProvider difiAccessTokenProvider, String xNavApikey, String difiUrl) { - this.difiAccessTokenProvider = difiAccessTokenProvider; - this.difiUrl = difiUrl; - this.xNavApikey = xNavApikey; - this.client = RestClient.baseClient(); - } - - @Cacheable(CacheConfig.DIFI_HAR_NIVA_4_CACHE_NAME) - @SneakyThrows - @Override - public HarLoggetInnRespons harLoggetInnSiste18mnd(Fnr fnr) { - String token = difiAccessTokenProvider.getAccessToken(); - Request request = new Request.Builder() - .url(difiUrl) - .header(ACCEPT, APPLICATION_JSON_VALUE) - .header(AUTHORIZATION, "Bearer " + token) - .header("x-nav-apiKey", xNavApikey) - .post(RestUtils.toJsonRequestBody(new Personidentifikator(fnr))) - .build(); - try (Response response = client.newCall(request).execute()) { - if(response.code() == 404) { - //brukere som ikke er registret som idporten brukere returnerer 404 - return new HarLoggetInnRespons() - .setHarbruktnivaa4(false) - .setErRegistrertIdPorten(false) - .setPersonidentifikator(fnr); - } - - RestUtils.throwIfNotSuccessful(response); - HarLoggetInnRespons harLoggetInnRespons = RestUtils.parseJsonResponseOrThrow(response, HarLoggetInnRespons.class); - - harLoggetInnRespons.setErRegistrertIdPorten(true); - - return harLoggetInnRespons; - } - } - - @AllArgsConstructor - private static class Personidentifikator { - Fnr personidentifikator; - } - -} diff --git a/src/main/java/no/nav/veilarbperson/client/difi/HarLoggetInnRespons.java b/src/main/java/no/nav/veilarbperson/client/difi/HarLoggetInnRespons.java index bd62e66c..de3657a0 100644 --- a/src/main/java/no/nav/veilarbperson/client/difi/HarLoggetInnRespons.java +++ b/src/main/java/no/nav/veilarbperson/client/difi/HarLoggetInnRespons.java @@ -1,10 +1,11 @@ package no.nav.veilarbperson.client.difi; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import no.nav.common.types.identer.Fnr; + +// TODO: 21/08/2023 denne skal slettes etter vi har ryddet opp i kode i de andre appene da dkif slutter å tilby tjenesten @Data @Accessors(chain = true) public class HarLoggetInnRespons { diff --git a/src/main/java/no/nav/veilarbperson/client/difi/SbsServiceUser.java b/src/main/java/no/nav/veilarbperson/client/difi/SbsServiceUser.java deleted file mode 100644 index 182df599..00000000 --- a/src/main/java/no/nav/veilarbperson/client/difi/SbsServiceUser.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.veilarbperson.client.difi; - -public class SbsServiceUser { - public final String username; - public final String password; - - public SbsServiceUser(String username, String password) { - this.username = username; - this.password = password; - } -} diff --git a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java index 4de9b239..f59abf0a 100644 --- a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java +++ b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java @@ -14,24 +14,19 @@ import no.nav.common.token_client.client.AzureAdMachineToMachineTokenClient; import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient; import no.nav.common.token_client.client.MachineToMachineTokenClient; -import no.nav.common.utils.Credentials; import no.nav.common.utils.NaisUtils; -import no.nav.veilarbperson.client.difi.DifiAccessTokenProviderImpl; -import no.nav.veilarbperson.client.difi.DifiClient; -import no.nav.veilarbperson.client.difi.DifiClientImpl; -import no.nav.veilarbperson.client.difi.SbsServiceUser; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirClientImpl; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; import no.nav.veilarbperson.client.kodeverk.KodeverkClientImpl; +import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; +import no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.nom.SkjermetClientImpl; import no.nav.veilarbperson.client.pam.PamClient; import no.nav.veilarbperson.client.pam.PamClientImpl; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.PdlClientImpl; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClientImpl; import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClient; @@ -40,7 +35,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static no.nav.common.utils.NaisUtils.getCredentials; @Slf4j @Configuration @@ -100,15 +94,6 @@ public PdlClient pdlClient(EnvironmentProperties properties, AuthService authSer () -> tokenClient.createMachineToMachineToken(properties.getPdlApiScope())); } - @Bean - public DifiAccessTokenProviderImpl accessTokenRepository(EnvironmentProperties properties, SbsServiceUser sbsServiceUser) { - return new DifiAccessTokenProviderImpl(sbsServiceUser, properties.getDifiTokenUrl()); - } - - @Bean - public DifiClient difiClient(EnvironmentProperties properties, String xNavApikey, DifiAccessTokenProviderImpl difiAccessTokenProvider) { - return new DifiClientImpl(difiAccessTokenProvider, xNavApikey, properties.getDifiAuthlevelUrl()); - } @Bean public VeilarbregistreringClient veilarbregistreringClient(EnvironmentProperties properties, AzureAdMachineToMachineTokenClient aadMachineToMachineTokenClient) { @@ -122,12 +107,6 @@ public String xNavApikey() { return NaisUtils.getFileContent("/var/run/secrets/nais.io/authlevel/x-nav-apiKey"); } - @Bean - public SbsServiceUser sbsServiceUser() { - Credentials service_user_sbs = getCredentials("service_user_sbs"); - return new SbsServiceUser(service_user_sbs.username, service_user_sbs.password); - } - @Bean public AzureAdMachineToMachineTokenClient azureAdMachineToMachineTokenClient() { return AzureAdTokenClientBuilder.builder().withNaisDefaults().buildMachineToMachineTokenClient(); diff --git a/src/main/java/no/nav/veilarbperson/controller/PersonController.java b/src/main/java/no/nav/veilarbperson/controller/PersonController.java index d08a747e..9e451886 100644 --- a/src/main/java/no/nav/veilarbperson/controller/PersonController.java +++ b/src/main/java/no/nav/veilarbperson/controller/PersonController.java @@ -4,7 +4,10 @@ import lombok.AllArgsConstructor; import no.nav.common.types.identer.Fnr; import no.nav.veilarbperson.client.difi.HarLoggetInnRespons; -import no.nav.veilarbperson.domain.*; +import no.nav.veilarbperson.domain.AktoerId; +import no.nav.veilarbperson.domain.GeografiskTilknytning; +import no.nav.veilarbperson.domain.Malform; +import no.nav.veilarbperson.domain.PersonNavn; import no.nav.veilarbperson.service.AuthService; import no.nav.veilarbperson.service.CvJobbprofilService; import no.nav.veilarbperson.service.PersonV2Service; @@ -52,11 +55,15 @@ public boolean tilgangTilBruker(@PathVariable("fodselsnummer") Fnr fodselsnummer return authService.harLesetilgang(fodselsnummer); } + // TODO: 21/08/2023 denne skal slettes etter vi har ryddet opp i kode i de andre appene da dkif slutter å tilby tjenesten @GetMapping("/{fodselsnummer}/harNivaa4") public HarLoggetInnRespons harNivaa4(@PathVariable("fodselsnummer") Fnr fodselsnummer) { authService.stoppHvisEksternBruker(); authService.sjekkLesetilgang(fodselsnummer); - return personV2Service.hentHarNivaa4(fodselsnummer); + return new HarLoggetInnRespons() + .setErRegistrertIdPorten(true) + .setHarbruktnivaa4(true) + .setPersonidentifikator(fodselsnummer); } @GetMapping("/geografisktilknytning") diff --git a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java index 3d652153..e7a194b7 100644 --- a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java +++ b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java @@ -3,17 +3,15 @@ import lombok.extern.slf4j.Slf4j; import no.nav.common.client.norg2.Norg2Client; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.difi.DifiClient; -import no.nav.veilarbperson.client.difi.HarLoggetInnRespons; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; import no.nav.veilarbperson.client.kontoregister.HentKontoRequestDTO; import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; +import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.domain.*; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.domain.*; import no.nav.veilarbperson.utils.PersonV2DataMapper; import no.nav.veilarbperson.utils.VergeOgFullmaktDataMapper; @@ -30,9 +28,7 @@ import static java.util.Optional.ofNullable; import static no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl.Mappers.fraNorg2Enhet; -import static no.nav.veilarbperson.utils.PersonV2DataMapper.getFirstElement; -import static no.nav.veilarbperson.utils.PersonV2DataMapper.parseZonedDateToDateString; -import static no.nav.veilarbperson.utils.PersonV2DataMapper.sivilstandMapper; +import static no.nav.veilarbperson.utils.PersonV2DataMapper.*; import static no.nav.veilarbperson.utils.VergeOgFullmaktDataMapper.toVergeOgFullmaktData; @Slf4j @@ -44,14 +40,12 @@ public class PersonV2Service { private final Norg2Client norg2Client; private final SkjermetClient skjermetClient; private final KodeverkService kodeverkService; - private final DifiClient difiClient; private final UnleashService unleashService; private final KontoregisterClient kontoregisterClient; @Autowired public PersonV2Service(PdlClient pdlClient, - DifiClient difiClient, AuthService authService, DigdirClient digdirClient, Norg2Client norg2Client, @@ -65,7 +59,6 @@ public PersonV2Service(PdlClient pdlClient, this.norg2Client = norg2Client; this.skjermetClient = skjermetClient; this.kodeverkService = kodeverkService; - this.difiClient = difiClient; this.unleashService = unleashService; this.kontoregisterClient = kontoregisterClient; } @@ -378,13 +371,4 @@ public PersonNavnV2 hentNavn(Fnr fnr) { return PersonV2DataMapper.navnMapper(personNavn.getNavn()); } - public HarLoggetInnRespons hentHarNivaa4(Fnr fodselsnummer) { - if (unleashService.sjekkNivaa4()) { - return new HarLoggetInnRespons() - .setErRegistrertIdPorten(true) - .setHarbruktnivaa4(true) - .setPersonidentifikator(fodselsnummer); - } - return difiClient.harLoggetInnSiste18mnd(fodselsnummer); - } } diff --git a/src/test/java/no/nav/veilarbperson/client/DifiClientImplTest.java b/src/test/java/no/nav/veilarbperson/client/DifiClientImplTest.java deleted file mode 100644 index f7207b2d..00000000 --- a/src/test/java/no/nav/veilarbperson/client/DifiClientImplTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package no.nav.veilarbperson.client; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import com.github.tomakehurst.wiremock.matching.EqualToJsonPattern; -import com.nimbusds.jwt.JWTClaimsSet; -import com.nimbusds.jwt.PlainJWT; -import no.nav.common.json.JsonUtils; -import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.difi.*; -import org.junit.Rule; -import org.junit.Test; - -import java.util.Date; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertTrue; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -public class DifiClientImplTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(0); - - @Test - public void skal_hente_har_niva4() { - String baseUrl = "http://localhost:" + wireMockRule.port(); - String nivaa4Url = baseUrl + "/nivaa4"; - String tokenUrl = baseUrl + "/token"; - SbsServiceUser credentials = new SbsServiceUser("username", "password"); - Fnr fnr = Fnr.of("12345678900"); - - JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() - .subject("subject") - .audience("TEST_AUDIENCE") - .expirationTime(new Date( new Date().getTime() +60000)) - .issuer("TEST_ISSUER") - .build(); - - PlainJWT plainJWT = new PlainJWT(claimsSet); - String parsedString = plainJWT.serialize(); - - String jsonBody = JsonUtils.toJson( - new HarLoggetInnRespons() - .setHarbruktnivaa4(true) - .setPersonidentifikator(fnr) - ); - - givenThat(post(urlMatching("/token")) - .withBasicAuth("username", "password") - .willReturn(aResponse().withStatus(200).withBody("{\"access_token\":\""+ parsedString + "\"}"))); - - - givenThat(post(urlMatching("/nivaa4")) - .withRequestBody(new EqualToJsonPattern("{ \"personidentifikator\": \"12345678900\"}", true, false)) - .withHeader(AUTHORIZATION, equalTo("Bearer " + parsedString)) - .withHeader("x-nav-apiKey", equalTo("apigw-key")) - .willReturn(aResponse() - .withStatus(200) - .withBody(jsonBody)) - ); - - - DifiAccessTokenProvider difiAccessTokenProvider = new DifiAccessTokenProviderImpl(credentials, tokenUrl); - DifiClientImpl difiClient = new DifiClientImpl(difiAccessTokenProvider, "apigw-key", nivaa4Url); - HarLoggetInnRespons harLoggetInnRespons = difiClient.harLoggetInnSiste18mnd(fnr); - difiClient.harLoggetInnSiste18mnd(fnr); - - assertTrue(harLoggetInnRespons.isHarbruktnivaa4()); - verify(1, postRequestedFor(urlEqualTo("/token"))); - verify(2, postRequestedFor(urlEqualTo("/nivaa4"))); - } -} diff --git a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java index 1d9fafa5..daffd833 100644 --- a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java +++ b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java @@ -13,18 +13,16 @@ import no.nav.common.types.identer.AktorId; import no.nav.common.types.identer.EksternBrukerId; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.difi.DifiClient; -import no.nav.veilarbperson.client.difi.HarLoggetInnRespons; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; import no.nav.veilarbperson.client.kontoregister.HentKontoRequestDTO; import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; +import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.pam.PamClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.veilarboppfolging.UnderOppfolging; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClient; @@ -145,15 +143,6 @@ public HealthCheckResult checkHealth() { }; } - @Bean - public DifiClient difiClient() { - return fnr -> { - HarLoggetInnRespons harLoggetInnRespons = new HarLoggetInnRespons(); - harLoggetInnRespons.setHarbruktnivaa4(true); -// harLoggetInnRespons.setPersonidentifikator(fnr); - return harLoggetInnRespons; - }; - } @Bean public SkjermetClient skjermetClient() { diff --git a/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java b/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java index 740864a4..e8eda3ab 100644 --- a/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java +++ b/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java @@ -4,16 +4,14 @@ import no.nav.common.client.norg2.Enhet; import no.nav.common.client.norg2.Norg2Client; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.difi.DifiClient; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; +import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.domain.*; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; -import no.nav.veilarbperson.client.pdl.domain.RelasjonsBosted; import no.nav.veilarbperson.config.PdlClientTestConfig; import no.nav.veilarbperson.domain.PersonNavnV2; import no.nav.veilarbperson.domain.PersonV2Data; @@ -28,12 +26,12 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.givenThat; -import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME; import static java.util.Optional.ofNullable; import static no.nav.veilarbperson.client.pdl.domain.RelasjonsBosted.UKJENT_BOSTED; @@ -42,8 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -74,7 +71,6 @@ public void setup() { personV2Service = new PersonV2Service( pdlClient, - mock(DifiClient.class), authService, digdirClient, norg2Client, From 36ff21db49d559a4a19e12735104eb6059f5f66d Mon Sep 17 00:00:00 2001 From: haakonph Date: Mon, 21 Aug 2023 16:08:59 +0200 Subject: [PATCH 2/2] bare returnere true for har nivaaa 4 kallet --- nais-dev.yaml | 6 ------ nais-prod.yaml | 6 ------ src/main/java/no/nav/veilarbperson/config/CacheConfig.java | 5 ----- .../no/nav/veilarbperson/config/EnvironmentProperties.java | 2 -- .../java/no/nav/veilarbperson/service/UnleashService.java | 5 ----- src/main/resources/application.properties | 2 -- 6 files changed, 26 deletions(-) diff --git a/nais-dev.yaml b/nais-dev.yaml index b418da27..9c12688f 100644 --- a/nais-dev.yaml +++ b/nais-dev.yaml @@ -46,8 +46,6 @@ spec: mountPath: /var/run/secrets/nais.io/service_user_sbs - kvPath: /kv/preprod/fss/veilarbperson/q1 mountPath: /var/run/secrets/nais.io/vault - - kvPath: /apikey/apigw/dev/eksternapp.difi.idporten.authlevel/veilarbperson_q1 - mountPath: /var/run/secrets/nais.io/authlevel azure: application: enabled: true @@ -76,10 +74,6 @@ spec: cluster: dev-gcp env: - - name: DIFI_IDPORTEN_AUTHLEVEL_URL - value: https://api-gw-q1.adeo.no/ekstern/difi/authlevel/rest/v1/sikkerhetsnivaa/ - - name: DIFI_IDPORTEN_TOKEN_URL - value: https://api-gw-q1.adeo.no/ekstern/difi/idporten-oidc-provider/token - name: KODEVERK_URL value: http://kodeverk.default.svc.nais.local - name: KONTAKT_OG_RESERVASJONSREGISTERET_API_URL diff --git a/nais-prod.yaml b/nais-prod.yaml index 143b2d00..c15d145c 100644 --- a/nais-prod.yaml +++ b/nais-prod.yaml @@ -43,8 +43,6 @@ spec: mountPath: /var/run/secrets/nais.io/service_user_sbs - kvPath: /kv/prod/fss/veilarbperson/default mountPath: /var/run/secrets/nais.io/vault - - kvPath: /apikey/apigw/prod/eksternapp.difi.idporten.authlevel/veilarbperson - mountPath: /var/run/secrets/nais.io/authlevel azure: application: enabled: true @@ -73,10 +71,6 @@ spec: cluster: prod-gcp env: - - name: DIFI_IDPORTEN_AUTHLEVEL_URL - value: https://api-gw.adeo.no/ekstern/difi/authlevel/rest/v1/sikkerhetsnivaa/ - - name: DIFI_IDPORTEN_TOKEN_URL - value: https://api-gw.adeo.no/ekstern/difi/idporten-oidc-provider/token - name: KODEVERK_URL value: http://kodeverk.default.svc.nais.local - name: KONTAKT_OG_RESERVASJONSREGISTERET_API_URL diff --git a/src/main/java/no/nav/veilarbperson/config/CacheConfig.java b/src/main/java/no/nav/veilarbperson/config/CacheConfig.java index 6df5a2dd..425e5aed 100644 --- a/src/main/java/no/nav/veilarbperson/config/CacheConfig.java +++ b/src/main/java/no/nav/veilarbperson/config/CacheConfig.java @@ -17,7 +17,6 @@ public class CacheConfig { public static final String NOM_SKJERMEDE_PERSONER_CACHE_NAME = "nom_skjermede_personer_cache"; public static final String SIKKERHETSTILTAK_CACHE_NAME = "sikkerhetstiltak_cache"; public static final String DIGDIR_KONTAKTINFO_CACHE_NAME = "digdir_kontaktinfo_cache"; - public static final String DIFI_HAR_NIVA_4_CACHE_NAME = "difi_har_niva_4_cache"; public static final String KODEVERK_BETYDNING_CACHE_NAME = "kodeverk_betydning_cache"; public static final String KONTOREGISTER_CACHE_NAME = "kontoregister_person_cache"; @@ -46,10 +45,6 @@ public Cache digdirKontaktinfoCache() { return litenCache(DIGDIR_KONTAKTINFO_CACHE_NAME); } - @Bean - public Cache difiHarNiva4Cache() { - return litenCache(DIFI_HAR_NIVA_4_CACHE_NAME); - } @Bean public Cache kodeverkBetydningCache() { diff --git a/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java b/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java index 8a00ae86..cf76a7e4 100644 --- a/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java +++ b/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java @@ -9,8 +9,6 @@ @ConfigurationProperties(prefix = "app.env") public class EnvironmentProperties { private String abacUrl; - private String difiAuthlevelUrl; - private String difiTokenUrl; private String kodeverkUrl; private String krrScope; private String krrUrl; diff --git a/src/main/java/no/nav/veilarbperson/service/UnleashService.java b/src/main/java/no/nav/veilarbperson/service/UnleashService.java index de5de38f..0bfd0069 100644 --- a/src/main/java/no/nav/veilarbperson/service/UnleashService.java +++ b/src/main/java/no/nav/veilarbperson/service/UnleashService.java @@ -7,7 +7,6 @@ @Service @RequiredArgsConstructor public class UnleashService { - private static final String UNLEASH_NIVAA4_DISABLED = "veilarbperson.nivaa4.disabled"; private static final String UNLEASH_POAO_TILGANG_ENABLED = "veilarbperson.poao-tilgang-enabled"; private final UnleashClient unleashClient; @@ -15,8 +14,4 @@ public boolean skalBrukePoaoTilgang() { return unleashClient.isEnabled(UNLEASH_POAO_TILGANG_ENABLED); } - public boolean sjekkNivaa4() { - return unleashClient.isEnabled(UNLEASH_NIVAA4_DISABLED); - } - } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 4c962539..0208b5e8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -18,8 +18,6 @@ app.env.poaoTilgangUrl=${POAO_TILGANG_URL:#{null}} app.env.poaoTilgangScope=${POAO_TILGANG_SCOPE:#{null}} # From nais-{dev|prod}.yaml -app.env.difiAuthlevelUrl=${DIFI_IDPORTEN_AUTHLEVEL_URL} -app.env.difiTokenUrl=${DIFI_IDPORTEN_TOKEN_URL} app.env.kodeverkUrl=${KODEVERK_URL} app.env.krrScope=${KONTAKT_OG_RESERVASJONSREGISTERET_SCOPE} app.env.krrUrl=${KONTAKT_OG_RESERVASJONSREGISTERET_API_URL}