Skip to content

Commit 09e985c

Browse files
committed
Refactor av dobbel validering ved kontonummerendring
1 parent cf7e8cc commit 09e985c

18 files changed

+387
-336
lines changed

Diff for: src/main/kotlin/no/nav/personopplysninger/config/ApplicationContext.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import no.nav.personopplysninger.consumer.norg2.Norg2Consumer
1414
import no.nav.personopplysninger.consumer.pdl.PdlConsumer
1515
import no.nav.personopplysninger.consumer.pdlmottak.PdlMottakConsumer
1616
import no.nav.personopplysninger.endreopplysninger.EndreOpplysningerService
17+
import no.nav.personopplysninger.endreopplysninger.idporten.IDPortenServiceImpl
1718
import no.nav.personopplysninger.endreopplysninger.kafka.HendelseProducer
1819
import no.nav.personopplysninger.institusjon.InstitusjonService
1920
import no.nav.personopplysninger.kontaktinformasjon.KontaktinformasjonService
@@ -37,8 +38,7 @@ class ApplicationContext {
3738
val tokendingsService = TokendingsServiceBuilder.buildTokendingsService()
3839
val azureService = AzureServiceBuilder.buildAzureService()
3940
val hendelseProducer = HendelseProducer(initializeKafkaProducer(env), env.varselHendelseTopic)
40-
41-
val idporten = setupIdporten(env)
41+
val idportenService = IDPortenServiceImpl(setupIdporten(env), httpClient)
4242

4343
val institusjonConsumer = InstitusjonConsumer(httpClient, env, tokendingsService)
4444
val kontaktinfoConsumer = KontaktinfoConsumer(httpClient, env, tokendingsService)
@@ -62,8 +62,8 @@ class ApplicationContext {
6262
val kontaktinformasjonService = KontaktinformasjonService(kontaktinfoConsumer, kodeverkConsumer)
6363
val personaliaService = PersonaliaService(kodeverkConsumer, norg2Consumer, kontoregisterConsumer, pdlConsumer)
6464

65-
private fun setupIdporten(env: Environment): IDPorten {
66-
return IDPorten(
65+
private fun setupIdporten(env: Environment): IDPortenConfig {
66+
return IDPortenConfig(
6767
redirectUri = env.redirectUri,
6868
frontendUri = URLBuilder().takeFrom(env.frontendUri).build(),
6969
wellKnownUrl = env.wellKnownUrl,

Diff for: src/main/kotlin/no/nav/personopplysninger/config/Bootstrap.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fun Application.mainModule(appContext: ApplicationContext = ApplicationContext()
8282
routing {
8383
health(appContext.appMicrometerRegistry)
8484
authenticate {
85-
endreOpplysninger(appContext.endreOpplysningerService, appContext.metricsCollector, appContext.idporten)
85+
endreOpplysninger(appContext.endreOpplysningerService, appContext.metricsCollector, appContext.idportenService)
8686
institusjon(appContext.institusjonService)
8787
medl(appContext.medlService)
8888
personalia(appContext.personaliaService)

Diff for: src/main/kotlin/no/nav/personopplysninger/config/IDPorten.kt

-200
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package no.nav.personopplysninger.config
2+
3+
import io.ktor.http.Url
4+
import javax.crypto.SecretKey
5+
6+
class IDPortenConfig(
7+
val redirectUri: String,
8+
val frontendUri: Url,
9+
val wellKnownUrl: String,
10+
val clientId: String,
11+
val clientJwk: String,
12+
val encryptionKey: SecretKey,
13+
val acr: String = "idporten-loa-high",
14+
val allowedAuthTimeSkewSeconds: Long = 5,
15+
val secureCookie: Boolean = true,
16+
)

0 commit comments

Comments
 (0)