Skip to content

Commit

Permalink
Logger token-feil
Browse files Browse the repository at this point in the history
Co-authored-by: Robin Tordly <[email protected]>
Co-authored-by: Vetle Hollund <[email protected]>
  • Loading branch information
3 people committed Dec 6, 2023
1 parent c05cb39 commit 1d5fcc5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import io.ktor.client.call.*
import io.ktor.client.engine.cio.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import io.ktor.serialization.jackson.*
import no.nav.aap.cache.Cache
import org.slf4j.LoggerFactory

private val secureLog = LoggerFactory.getLogger("secureLog")

class AzureAdTokenProvider(
private val config: AzureConfig,
Expand All @@ -36,6 +40,10 @@ class AzureAdTokenProvider(
accept(ContentType.Application.Json)
contentType(ContentType.Application.FormUrlEncoded)
setBody(body())
}.also {
if(!it.status.isSuccess()) {
secureLog.warn("Feilet token-kall {}: {}", it.status.value, it.bodyAsText())
}
}.body<Token>().also { fetchedToken ->
fetchedToken.addToCache(tokenCache, cacheKey)
}
Expand Down

0 comments on commit 1d5fcc5

Please sign in to comment.