Skip to content

Commit

Permalink
Merge pull request #416 from navikt/access-token-til-kodeverk
Browse files Browse the repository at this point in the history
Access token til kodeverk
  • Loading branch information
henrikkol authored Aug 20, 2024
2 parents ad3c484 + 27af81b commit 25fdd90
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions nais/dev-fss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ spec:
- application: pdl-api
namespace: pdl
cluster: dev-fss
- application: kodeverk-api
namespace: team-rocket
cluster: dev-fss
3 changes: 3 additions & 0 deletions nais/prod-fss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ spec:
cluster: prod-gcp
- application: pdl-api
namespace: pdl
cluster: prod-fss
- application: kodeverk-api
namespace: team-rocket
cluster: prod-fss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.tag.innsynAareg.client.yrkeskoder

import no.nav.tag.innsynAareg.client.azure.AzureClient
import no.nav.tag.innsynAareg.client.yrkeskoder.YrkeskodeverkCacheConfig.Companion.YRKESKODE_CACHE
import no.nav.tag.innsynAareg.client.yrkeskoder.dto.Yrkeskoderespons
import no.nav.tag.innsynAareg.models.Yrkeskoder
Expand All @@ -15,7 +16,9 @@ import java.util.*
@Service
class YrkeskodeverkClient @Autowired constructor(
private val restTemplate: RestTemplate,
@Value("\${yrkeskodeverk.yrkeskodeUrl}") val yrkeskodeUrl: String
@Value("\${yrkeskodeverk.yrkeskodeUrl}") val yrkeskodeUrl: String,
private val azureClient: AzureClient,
@Value("\${yrkeskodeverk.yrkeskodeScope}") private val yrkeskodeScope: String
) {
private val logger = LoggerFactory.getLogger(YrkeskodeverkClient::class.java)!!

Expand All @@ -32,6 +35,7 @@ class YrkeskodeverkClient @Autowired constructor(
headers.contentType = MediaType.APPLICATION_FORM_URLENCODED
headers["Nav-Call-Id"] = UUID.randomUUID().toString()
headers["Nav-Consumer-Id"] = "srvAG-Arbforhold"
headers.setBearerAuth(azureClient.getToken(yrkeskodeScope))
restTemplate.exchange(
yrkeskodeUrl,
HttpMethod.GET,
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ aareg:

yrkeskodeverk:
yrkeskodeUrl: "http://localhost:${mock.port}/kodeverk/api/"
yrkeskodeScope: "scope"

pdl:
pdlUrl: "http://localhost:${mock.port}/graphql"
Expand Down Expand Up @@ -103,6 +104,7 @@ aareg:

yrkeskodeverk:
yrkeskodeUrl: "http://localhost:${mock.port}/kodeverk/api/"
yrkeskodeScope: "scope"

pdl:
pdlUrl: "http://localhost:${mock.port}/graphql"
Expand Down Expand Up @@ -136,6 +138,7 @@ no.nav.security.jwt.issuer.tokenx:

yrkeskodeverk:
yrkeskodeUrl: "https://kodeverk-api.nav.no/api/v1/kodeverk/Yrker/koder/betydninger?spraak=nb"
yrkeskodeScope: "api://dev-gcp.team-rocket.kodeverk-api/.default"

sts:
stsPass: ${STS_PASS}
Expand Down Expand Up @@ -185,6 +188,7 @@ azure:

yrkeskodeverk:
yrkeskodeUrl: "https://kodeverk-api.nav.no/api/v1/kodeverk/Yrker/koder/betydninger?spraak=nb&spraak=nn"
yrkeskodeScope: "api://prod-gcp.team-rocket.kodeverk-api/.default"

pdl:
pdlUrl: "https://pdl-api.intern.nav.no/graphql"
Expand Down

0 comments on commit 25fdd90

Please sign in to comment.