Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AudunSorheim committed Jun 27, 2024
1 parent 36794ae commit 11d35b2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/main/kotlin/no/nav/syfo/ereg/EregClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.springframework.web.client.RestClientResponseException
import org.springframework.web.client.RestTemplate

@Service
class EregClient (
class EregClient(
@Value("\${ereg.url}") private val baseUrl: String,
private val metric: Metrikk,
) {
Expand All @@ -37,11 +37,12 @@ class EregClient (
metric.tellHendelse(METRIC_CALL_EREG_FAIL)
val message =
"Call to get name Virksomhetsnummer from EREG failed with status:" +
" ${e.statusCode.value()} and message: ${e.responseBodyAsString}"
" ${e.statusCode.value()} and message: ${e.responseBodyAsString}"
LOG.error(message)
throw e
}
}

@Cacheable(
value = ["ereg_virksomhetsnavn"],
key = "#virksomhetsnummer",
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/no/nav/syfo/ereg/EregOrganisasjonResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties

@JsonIgnoreProperties(ignoreUnknown = true)
data class EregOrganisasjonResponse(
val navn: EregOrganisasjonNavn
val navn: EregOrganisasjonNavn
)

@JsonIgnoreProperties(ignoreUnknown = true)
data class EregOrganisasjonNavn(
val navnelinje1: String,
val sammensattnavn: String?
val navnelinje1: String,
val sammensattnavn: String?
)

fun EregOrganisasjonResponse.navn(): String {
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/no/nav/syfo/util/StringUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ fun fodselsnummerInvalid(fnr: String): Boolean = !fodselsnummerValid(fnr)
fun String.lowerCapitalize(): String {
return this.lowercase().replaceFirstChar { it.uppercase() }
}


Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package no.nav.syfo.virksomhet

import no.nav.security.token.support.core.api.ProtectedWithClaims
import no.nav.security.token.support.core.context.TokenValidationContextHolder
import no.nav.syfo.auth.tokenx.TokenXUtil
import no.nav.syfo.auth.tokenx.TokenXUtil.TokenXIssuer.TOKENX
import no.nav.syfo.ereg.EregClient
import no.nav.syfo.domain.Virksomhet
import no.nav.syfo.auth.tokenx.TokenXUtil
import no.nav.syfo.domain.Virksomhetsnummer
import no.nav.syfo.ereg.EregClient
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.HttpStatus
Expand All @@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController


@RestController
@ProtectedWithClaims(issuer = TOKENX, claimMap = ["acr=Level4", "acr=idporten-loa-high"], combineWithOr = true)
@RequestMapping(value = ["/api/v1/virksomhet/{virksomhetsnummer}"])
Expand Down Expand Up @@ -52,5 +51,4 @@ class VirksomhetController(
companion object {
private val LOG = LoggerFactory.getLogger(VirksomhetController::class.java)
}

}

0 comments on commit 11d35b2

Please sign in to comment.