Skip to content

Commit

Permalink
Autorisering
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjodn committed Jan 16, 2025
1 parent ed27b38 commit d5d46d3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@ package no.nav.etterlatte.vedtak
import com.typesafe.config.Config
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.call
import io.ktor.server.application.install
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.server.response.respondNullable
import io.ktor.server.routing.Route
import io.ktor.server.routing.post
import io.ktor.server.routing.route
import no.nav.etterlatte.AuthorizationPlugin
import no.nav.etterlatte.libs.common.vedtak.VedtakForPersonRequest
import no.nav.etterlatte.libs.ktor.token.Issuer

fun Route.vedtakRoute(
vedtaksvurderingKlient: VedtaksvurderingKlient,
config: Config,
) {
// Tiltenkt for eksternt for etterlatte men internt i Nav. Initelt gjelder dette EESSI.
route("api/vedtak/personident") {
install(AuthorizationPlugin) {
accessPolicyRolesEllerAdGrupper = setOf("vedtak-for-eksterne-i-nav")
issuers = setOf(Issuer.AZURE.issuerName)
}

post {
// TODO mer autentisering?
try {
val request = call.receive<VedtakForPersonRequest>()
val vedtak = vedtaksvurderingKlient.hentVedtak(request)
Expand Down

0 comments on commit d5d46d3

Please sign in to comment.