Skip to content

Commit

Permalink
Error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
KnutArildSlaatsve committed May 2, 2024
1 parent 6ca3e5b commit 9967350
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.tag.innsynAareg.client.azure

import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.HttpEntity
Expand All @@ -20,6 +21,7 @@ class AzureClient @Autowired constructor(
@Value("\${AZURE_APP_CLIENT_SECRET}") private val clientSecret: String,
private val restTemplate: RestTemplate
) {
private val log = LoggerFactory.getLogger(AzureClient::class.java)!!
private val tokens: LinkedHashMap<String, AzureToken> = LinkedHashMap()

fun getToken(scope: String): String {
Expand All @@ -38,6 +40,7 @@ class AzureClient @Autowired constructor(
updateToken(scope)
} catch (e: RuntimeException) {
if (hasExpired(token.expires_in)) {
log.error("Feil ved henting av token fra Azure. $e", e)
throw RuntimeException("AG-ARBEIDSFORHOLD Klarte ikke hente token fra azure. $e", e)
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ sts:
stsUrl: https://security-token-service.nais.preprod.local/rest/v1/sts/token

azure:
tokenUrl: https://login.microsoftonline.com/966ac572-f5b7-4bbe-aa88-c76419c0f851/oauth2/v2.0/token
tokenUrl: "https://login.microsoftonline.com/966ac572-f5b7-4bbe-aa88-c76419c0f851/oauth2/v2.0/token"

pdl:
pdlUrl: "https://pdl-api.nais.preprod.local/graphql/"
pdlUrl: "https://pdl-api.intern.dev.nav.no/graphql/"
pdlScope: "api://dev-fss.pdl.pdl-api/.default"

ereg:
Expand Down Expand Up @@ -181,13 +181,13 @@ sts:
stsUrl: https://security-token-service.nais.adeo.no/rest/v1/sts/token

azure:
tokenUrl: https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b/oauth2/v2.0/token
tokenUrl: "https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b/oauth2/v2.0/token"

yrkeskodeverk:
yrkeskodeUrl: "https://kodeverk-api.nav.no/api/v1/kodeverk/Yrker/koder/betydninger?spraak=nb&spraak=nn"

pdl:
pdlUrl: "https://pdl-api.nais.adeo.no/graphql"
pdlUrl: "https://pdl-api.intern.nav.no/graphql"
pdlScope: "api://prod-fss.pdl.pdl-api/.default"

ereg:
Expand Down

0 comments on commit 9967350

Please sign in to comment.