diff --git a/.husky/pre-commit b/.husky/pre-commit index d1da744c787..e52d87e4d6d 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -6,7 +6,7 @@ changedKotlinFiles=$(git diff --name-only --cached | grep '\.kt[s"]\?$' || true) if [ -n "${changedKotlinFiles-unset}" ]; then kotlinversion=$(ktlint -v) - expectedVersion="ktlint version 1.4.1" + expectedVersion="ktlint version 1.5.0" if [ "$kotlinversion" != "$expectedVersion" ]; then echo "\033[1;31mERROR:\033[0m\tRunning version $kotlinversion needs to be $expectedVersion" exit 1 diff --git a/apps/etterlatte-api/src/main/kotlin/no/nav/etterlatte/samordning/vedtak/SelvbetjeningAuthorizationPlugin.kt b/apps/etterlatte-api/src/main/kotlin/no/nav/etterlatte/samordning/vedtak/SelvbetjeningAuthorizationPlugin.kt index 76efce73199..62829d7231c 100644 --- a/apps/etterlatte-api/src/main/kotlin/no/nav/etterlatte/samordning/vedtak/SelvbetjeningAuthorizationPlugin.kt +++ b/apps/etterlatte-api/src/main/kotlin/no/nav/etterlatte/samordning/vedtak/SelvbetjeningAuthorizationPlugin.kt @@ -1,12 +1,10 @@ package no.nav.etterlatte.samordning.vedtak -import io.ktor.server.application.ApplicationCall import io.ktor.server.application.createRouteScopedPlugin import io.ktor.server.application.log import io.ktor.server.auth.AuthenticationChecked import io.ktor.server.auth.principal import io.ktor.server.request.receive -import io.ktor.server.request.receiveNullable import no.nav.etterlatte.libs.common.appName import no.nav.etterlatte.libs.common.feilhaandtering.IkkeTillattException import no.nav.etterlatte.libs.common.logging.getCorrelationId @@ -31,17 +29,18 @@ val SelvbetjeningAuthorizationPlugin = if (principal.context.issuers.contains(issuer)) { val subject = principal.context.getClaims(pluginConfig.issuer).subject - val fnr = when(appName()?.lowercase()) { - "etterlatte-samordning-vedtak" -> call.fnr - "etterlatte-api" -> { - try { - call.receive().foedselsnummer - } catch (e: Exception) { - throw ManglerFoedselsnummerException() + val fnr = + when (appName()?.lowercase()) { + "etterlatte-samordning-vedtak" -> call.fnr + "etterlatte-api" -> { + try { + call.receive().foedselsnummer + } catch (e: Exception) { + throw ManglerFoedselsnummerException() + } } + else -> throw ManglerFoedselsnummerException() } - else -> throw ManglerFoedselsnummerException() - } if (!validator.invoke(Folkeregisteridentifikator.of(fnr), Folkeregisteridentifikator.of(subject))) { application.log.info("Request avslått pga mismatch mellom subject og etterspurt fnr") diff --git a/apps/etterlatte-behandling/src/test/kotlin/behandling/omregning/OmregningServiceTest.kt b/apps/etterlatte-behandling/src/test/kotlin/behandling/omregning/OmregningServiceTest.kt index dfc91d346b6..4387ed89075 100644 --- a/apps/etterlatte-behandling/src/test/kotlin/behandling/omregning/OmregningServiceTest.kt +++ b/apps/etterlatte-behandling/src/test/kotlin/behandling/omregning/OmregningServiceTest.kt @@ -226,5 +226,3 @@ class OmregningServiceTest( private fun systembruker(brukernavn: String): Systembruker = systembruker(mapOf(Claims.azp_name to brukernavn)) } - -