Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AudunSorheim committed Oct 25, 2023
1 parent 4e6c3b3 commit 0f2df94
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/kotlin/no/nav/syfo/api/AktivitetspliktApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import no.nav.syfo.exception.ResourceNotFoundException
import no.nav.syfo.logger
import no.nav.syfo.service.AktivitetskravService
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.ResponseBody
import org.springframework.web.server.ResponseStatusException

@Controller
@RequestMapping("/api/v1")
Expand All @@ -35,11 +37,12 @@ class AktivitetspliktApi(
@ResponseBody
@ProtectedWithClaims(issuer = "tokenx", combineWithOr = true, claimMap = ["acr=Level4", "acr=idporten-loa-high"])
fun getAktivitetsplikt(): Aktivitetsplikt? {
log.info("Debug: Called /aktivitetsplikt")
val claims = tokenValidator.validerTokenXClaims()
val fnr = tokenValidator.fnrFraIdportenTokenX(claims)

return aktivitetskravService.getAktivitetsplikt(fnr) ?: throw ResourceNotFoundException()
return aktivitetskravService.getAktivitetsplikt(fnr) ?: throw ResponseStatusException(
HttpStatus.NOT_FOUND, "Ingen aktivitetsplikt funnet"
);

}
}

0 comments on commit 0f2df94

Please sign in to comment.