Skip to content

Commit

Permalink
Bumpe ktlint til 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sebassonav committed Dec 9, 2024
1 parent a35ed0a commit f28e092
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<FoedselsnummerDTO>().foedselsnummer
} catch (e: Exception) {
throw ManglerFoedselsnummerException()
val fnr =
when (appName()?.lowercase()) {
"etterlatte-samordning-vedtak" -> call.fnr
"etterlatte-api" -> {
try {
call.receive<FoedselsnummerDTO>().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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,3 @@ class OmregningServiceTest(

private fun systembruker(brukernavn: String): Systembruker = systembruker(mapOf(Claims.azp_name to brukernavn))
}


0 comments on commit f28e092

Please sign in to comment.