Skip to content

Commit

Permalink
Merge branch 'master' into java_versjon_oppgradering
Browse files Browse the repository at this point in the history
  • Loading branch information
StianSDouzette authored Jun 24, 2024
2 parents 5e05e89 + 17a60df commit 4495e69
Show file tree
Hide file tree
Showing 25 changed files with 205 additions and 552 deletions.
13 changes: 9 additions & 4 deletions deploy/preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,34 @@ spec:
- host: udi-proxy.dev-fss-pub.nais.io
- host: aareg-services-q1.dev-fss-pub.nais.io
- host: ereg-services.dev.intern.nav.no
- host: medlemskap-medl-proxy.dev-fss-pub.nais.io
- host: medlemskap-medl-api.dev-fss-pub.nais.io
- host: oppgave.dev-fss-pub.nais.io
env:
- name: SECURITY_TOKEN_SERVICE_URL
value: https://api-gw-q1.oera.no/sts/SecurityTokenServiceProvider/
- name: SECURITY_TOKEN_SERVICE_REST_URL
value: https://api-gw-q1.oera.no/security-token-service
- name: MEDL2_BASE_URL
value: https://medlemskap-medl-proxy.dev-fss-pub.nais.io
value: https://medlemskap-medl-api.dev-fss-pub.nais.io
- name: AAREG_BASE_URL
value: https://aareg-services-q1.dev-fss-pub.nais.io/api
- name: SAF_BASE_URL
value: https://saf.dev-fss-pub.nais.io/graphql
- name: OPPGAVE_BASE_URL
value: https://api-gw-q1.oera.no/oppgave
value: https://oppgave.dev-fss-pub.nais.io
- name: PDL_BASE_URL
value: https://pdl-api.dev-fss-pub.nais.io/graphql
- name: EREG_BASE_URL
value: https://api-gw-q1.oera.no/ereg-services/api
- name: UDI_BASE_URL
value: https://udi-proxy.dev-fss-pub.nais.io
- name: AZURE_SCOPE_OPPGAVE
value: api://dev-fss.oppgavehandtering.oppgave/.default
- name: AZURE_SCOPE_UDI
value: api://dev-fss.medlemskap.udi-proxy/.default
- name: AZURE_SCOPE_MEDL
value: api://dev-fss.team-rocket.medlemskap-medl-api/.default
- name: AZURE_SCOPE_PDL
value: api://dev-fss.pdl.pdl-api/.default
value: api://dev-fss.pdl.pdl-api/.default
- name: AZURE_SCOPE_AAREG
value: api://dev-fss.arbeidsforhold.aareg-services-nais/.default
13 changes: 9 additions & 4 deletions deploy/prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ spec:
- host: udi-proxy.prod-fss-pub.nais.io
- host: aareg-services.prod-fss-pub.nais.io
- host: ereg-services.dev.intern.nav.no
- host: medlemskap-medl-proxy.prod-fss-pub.nais.io
- host: medlemskap-medl-api.prod-fss-pub.nais.io
- host: oppgave.prod-fss-pub.nais.io
kafka:
pool: nav-prod

Expand All @@ -75,22 +76,26 @@ spec:
- name: SECURITY_TOKEN_SERVICE_REST_URL
value: https://api-gw.oera.no/security-token-service
- name: MEDL2_BASE_URL
value: https://medlemskap-medl-proxy.prod-fss-pub.nais.io
value: https://medlemskap-medl-api.prod-fss-pub.nais.io
- name: AAREG_BASE_URL
value: https://aareg-services.prod-fss-pub.nais.io/api
- name: SAF_BASE_URL
value: https://saf.prod-fss-pub.nais.io/graphql
- name: OPPGAVE_BASE_URL
value: https://api-gw.oera.no/oppgave
value: https://oppgave.prod-fss-pub.nais.io
- name: PDL_BASE_URL
value: https://pdl-api.prod-fss-pub.nais.io/graphql
- name: EREG_BASE_URL
value: https://api-gw.oera.no/ereg-services/api
- name: UDI_BASE_URL
value: https://udi-proxy.prod-fss-pub.nais.io
- name: AZURE_SCOPE_OPPGAVE
value: api://prod-fss.oppgavehandtering.oppgave/.default
- name: AZURE_SCOPE_UDI
value: api://prod-fss.medlemskap.udi-proxy/.default
- name: AZURE_SCOPE_MEDL
value: api://prod-fss.team-rocket.medlemskap-medl-api/.default
- name: AZURE_SCOPE_PDL
value: api://prod-fss.pdl.pdl-api/.default
value: api://prod-fss.pdl.pdl-api/.default
- name: AZURE_SCOPE_AAREG
value: api://prod-fss.arbeidsforhold.aareg-services-nais/.default
27 changes: 26 additions & 1 deletion pdl-client/src/main/resources/pdl/hentPerson.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ query($ident: ID!, $bostedHistorikk: Boolean!, $statsborgerskapHistorikk: Boolea
historisk
}
},
opphold(historikk: true){
type
oppholdFra
oppholdTil
metadata{
historisk
master
endringer{
type,
kilde,
registrert,
registrertAv,
systemkilde
}
}
folkeregistermetadata {
aarsak,
ajourholdstidspunkt,
gyldighetstidspunkt,
opphoerstidspunkt,
kilde
}
},
doedsfall{
doedsdato
},
Expand Down Expand Up @@ -71,9 +94,11 @@ query($ident: ID!, $bostedHistorikk: Boolean!, $statsborgerskapHistorikk: Boolea
historisk
},
folkeregistermetadata {
aarsak
ajourholdstidspunkt,
gyldighetstidspunkt,
opphoerstidspunkt
opphoerstidspunkt,
kilde
}
},
utflyttingFraNorge{
Expand Down
7 changes: 3 additions & 4 deletions src/main/kotlin/no/nav/medlemskap/HttpServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import io.ktor.server.plugins.callid.*
import io.ktor.server.plugins.callloging.*
import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.plugins.statuspages.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics
import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics
Expand All @@ -35,7 +33,6 @@ import no.nav.medlemskap.config.getAadConfig
import no.nav.medlemskap.domene.Datagrunnlag
import no.nav.medlemskap.domene.Request
import no.nav.medlemskap.routes.*
import org.slf4j.event.*
import org.slf4j.event.Level
import java.util.*

Expand Down Expand Up @@ -102,7 +99,9 @@ createHttpServer(
val requestContextService = RequestContextService()
if (useAuthentication) {
routing {
naisRoutes(readinessCheck = { applicationState.initialized }, livenessCheck = { applicationState.running }, collectorRegistry = CollectorRegistry.defaultRegistry)
naisRoutes(
readinessCheck = { applicationState.initialized }, livenessCheck = { applicationState.running }, collectorRegistry = CollectorRegistry.defaultRegistry
)
if (services.configuration.cluster == "dev-gcp") setupSwaggerDocApi()
evalueringRoute(services, configuration, requestContextService, createDatagrunnlag)
reglerRoute()
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/no/nav/medlemskap/clients/RestClients.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class RestClients(

private val httpClient = cioHttpClient

fun aaReg(endpointUrl: String) = AaRegClient(endpointUrl, configuration.sts.username, stsClientRest, httpClient, configuration.register.aaRegApiKey, aaRegRetry)
fun aaReg(endpointUrl: String) = AaRegClient(endpointUrl, azureAdClient, httpClient, configuration, configuration.register.aaRegApiKey, aaRegRetry)
fun medl2(endpointBaseUrl: String) = MedlClient(endpointBaseUrl, azureAdClient, configuration, httpClient, medlRetry)
fun saf(endpointBaseUrl: String) = SafClient(endpointBaseUrl, stsClientRest, configuration.sts.username, httpClient, configuration.register.safApiKey, safRetry)
fun oppgaver(endpointBaseUrl: String) = OppgaveClient(endpointBaseUrl, stsClientRest, httpClient, configuration.register.oppgaveApiKey, oppgaveRetry)
fun oppgaver(endpointBaseUrl: String) = OppgaveClient(endpointBaseUrl, azureAdClient, configuration, httpClient, oppgaveRetry)
fun pdl(endpointBaseURl: String) = PdlClient(endpointBaseURl, azureAdClient, configuration, configuration.sts.username, httpClient, pdlRetry, configuration.register.pdlApiKey)
fun ereg(endpointBaseUrl: String) = EregClient(endpointBaseUrl, httpClient, configuration, configuration.register.eregApiKey, eregRetry)
fun udi(endpointBaseUrl: String) = UdiClient(endpointBaseUrl, azureAdClient, httpClient, udiRetry)
Expand Down
17 changes: 8 additions & 9 deletions src/main/kotlin/no/nav/medlemskap/clients/aareg/AaRegClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import io.ktor.client.plugins.*
import io.ktor.client.request.*
import io.ktor.http.*
import mu.KotlinLogging
import no.nav.medlemskap.clients.azuread.AzureAdClient
import no.nav.medlemskap.clients.runWithRetryAndMetrics
import no.nav.medlemskap.clients.sts.StsRestClient
import no.nav.medlemskap.config.Configuration
import java.time.LocalDate
import java.time.format.DateTimeFormatter

class AaRegClient(
private val baseUrl: String,
private val username: String,
private val stsClient: StsRestClient,
private val azureAdClient: AzureAdClient,
private val httpClient: HttpClient,
private val configuration: Configuration,
private val aaRegApiKey: String,
private val retry: Retry? = null
) {
Expand All @@ -27,16 +28,15 @@ class AaRegClient(
}

suspend fun hentArbeidsforhold(fnr: String, callId: String, fraOgMed: LocalDate? = null, tilOgMed: LocalDate? = null): List<AaRegArbeidsforhold> {
val oidcToken = stsClient.oidcToken()
val token = azureAdClient.hentToken(configuration.register.aaregScope)
return runCatching {
runWithRetryAndMetrics("AaReg", "ArbeidsforholdV1", retry) {
httpClient.get() {
url("$baseUrl/v1/arbeidstaker/arbeidsforhold")
header(HttpHeaders.Authorization, "Bearer $oidcToken")
header(HttpHeaders.Authorization, "Bearer ${token.token}")
header(HttpHeaders.Accept, ContentType.Application.Json)
header("Nav-Call-Id", callId)
header("Nav-Personident", fnr)
header("Nav-Consumer-Token", "Bearer $oidcToken")
header("x-nav-apiKey", aaRegApiKey)
fraOgMed?.let { parameter("ansettelsesperiodeFom", fraOgMed.tilIsoFormat()) }
tilOgMed?.let { parameter("ansettelsesperiodeTom", tilOgMed.tilIsoFormat()) }
Expand All @@ -63,16 +63,15 @@ class AaRegClient(
}

suspend fun hentArbeidsforholdV2(fnr: String, callId: String, fraOgMed: LocalDate? = null, tilOgMed: LocalDate? = null): List<no.nav.medlemskap.clients.aareg.Arbeidsforhold> {
val oidcToken = stsClient.oidcToken()
val token = azureAdClient.hentToken(configuration.register.aaregScope)
return runCatching {
runWithRetryAndMetrics("AaReg", "ArbeidsforholdV2", retry) {
httpClient.get() {
url("$baseUrl/v2/arbeidstaker/arbeidsforhold")
header(HttpHeaders.Authorization, "Bearer $oidcToken")
header(HttpHeaders.Authorization, "Bearer ${token.token}")
header(HttpHeaders.Accept, ContentType.Application.Json)
header("Nav-Call-Id", callId)
header("Nav-Personident", fnr)
header("Nav-Consumer-Token", "Bearer $oidcToken")
header("x-nav-apiKey", aaRegApiKey)
parameter("historikk", "true")
parameter("arbeidsforholdstatus", "AKTIV,AVSLUTTET,FREMTIDIG")
Expand Down
82 changes: 0 additions & 82 deletions src/main/kotlin/no/nav/medlemskap/clients/inntekt/InntektClient.kt

This file was deleted.

Loading

0 comments on commit 4495e69

Please sign in to comment.