Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed accessToken variable #374

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask

plugins {
id("org.springframework.boot") version "3.3.2"
id("org.springframework.boot") version "3.4.0"
id("io.spring.dependency-management") version "1.1.6"
kotlin("jvm") version "2.0.10"
kotlin("plugin.spring") version "2.0.10"
kotlin("jvm") version "2.0.21"
kotlin("plugin.spring") version "2.0.21"
id("com.netflix.dgs.codegen") version "5.12.4"
id("com.github.johnrengelman.shadow") version "8.1.1"
}
Expand All @@ -20,37 +20,37 @@ repositories {
}
}

val postgresVersion = "42.7.3"
val snakeYamlVersion = "2.2"
val diagnosekoderVersion = "1.2024.0"
val tokenSupportVersion = "5.0.1"
val testContainersVersion = "1.20.1"
val postgresVersion = "42.7.4"
val snakeYamlVersion = "2.3"
val diagnosekoderVersion = "1.2024.1"
val tokenSupportVersion = "5.0.11"
val testContainersVersion = "1.20.4"
val logstashLogbackEncoderVersion = "8.0"
val javaJwtVersion = "4.4.0"
val springBootResourceVersion = "3.3.2"
val springBootResourceVersion = "3.4.0"
val graphqlVersion = "20.2"
val kafkaClientsVersion = "3.8.0"
val kafkaClientsVersion = "3.9.0"
val syfoXmlCodegen = "2.0.1"
val springSecurityWebVersion = "6.3.1"
val springSecurityWebVersion = "6.4.1"
val okhttp3version = "4.12.0"
val jaxbApiVersion = "2.3.1"
val jaxbVersion = "2.4.0-b180830.0438"
val javaxActivationVersion = "1.1.1"
val javaTimeAdapterVersion = "1.1.3"
val graphqlDgsPlatformDependenciesVersion = "7.3.6"
val logbacksyslog4jVersion = "1.0.0"
val commonsCompressVersion = "1.27.0"
val commonsLang3Version = "3.16.0"
val httpClient5version = "5.2"
val commonsCompressVersion = "1.27.1"
val commonsLang3Version = "3.17.0"
val httpClient5version = "5.4.1"
val flywayVersion = "9.22.3"
val opentelemetryVersion = "2.3.0"
val opentelemetryVersion = "2.10.0"
val prometheusVersion = "0.16.0"
val mockkVersion = "1.13.10"
val mockkVersion = "1.13.13"
val kluentVersion = "1.73"
val coroutinesVersion = "1.8.1"
val coroutinesVersion = "1.9.0"
val coroutineReactorVersion = "1.9.0"
val hibernateVersion = "6.2.6.Final"
val jacksonDatatypeJsr310Version = "2.18.0"
val hibernateVersion = "6.6.3.Final"
val jacksonDatatypeJsr310Version = "2.18.1"
val mockitoKotlinVersion = "5.4.0"
dependencies {
implementation(platform("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:$graphqlDgsPlatformDependenciesVersion"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class AadRestTemplateConfiguration {
): ClientHttpRequestInterceptor {
return ClientHttpRequestInterceptor { request: HttpRequest, body: ByteArray, execution: ClientHttpRequestExecution ->
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
request.headers.setBearerAuth(response.accessToken!!)
request.headers.setBearerAuth(response.access_token!!)
execution.execute(request, body)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/no/nav/sykdig/config/M2MTokenService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ class M2MTokenService(
?: throw RuntimeException("Client properties for $type not found")

val accessTokenResponse = oAuth2AccessTokenService.getAccessToken(clientProperties)
return accessTokenResponse.accessToken ?: throw RuntimeException("Failed to retrieve M2M access token")
return accessTokenResponse.access_token ?: throw RuntimeException("Failed to retrieve M2M access token")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ import no.nav.sykdig.digitalisering.saf.graphql.TEMA_SYKMELDING
import no.nav.sykdig.objectMapper
import no.nav.sykdig.securelog
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.*
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.retry.annotation.Retryable
import org.springframework.stereotype.Component
import org.springframework.web.client.HttpClientErrorException
import org.springframework.web.client.HttpServerErrorException
import org.springframework.web.client.RestTemplate
import java.time.LocalDate
import java.util.UUID
import java.util.*

private const val OPPGAVETYPE = "JFR"

Expand Down Expand Up @@ -145,7 +149,7 @@ class OppgaveClient(
} catch (e: HttpClientErrorException) {
if (e.statusCode.value() == 401 || e.statusCode.value() == 403) {
log.warn("Veileder har ikke tilgang til oppgaveId $oppgaveId: ${e.message}")
throw IkkeTilgangException("Veileder har ikke tilgang til oppgave")
throw IkkeTilgangException("Veileder har ikke tilgang til oppgave med id $oppgaveId")
} else {
log.error(
"HttpClientErrorException med responskode ${e.statusCode.value()} fra Oppgave: ${e.message}",
Expand Down Expand Up @@ -182,7 +186,7 @@ class OppgaveClient(
} catch (e: HttpClientErrorException) {
if (e.statusCode.value() == 401 || e.statusCode.value() == 403) {
log.warn("Veileder har ikke tilgang til oppgaveId $oppgaveId: ${e.message}")
throw IkkeTilgangException("Veileder har ikke tilgang til oppgave")
throw IkkeTilgangException("Veileder har ikke tilgang til oppgave med id: $oppgaveId")
} else {
log.error(
"HttpClientErrorException med responskode ${e.statusCode.value()} fra Oppgave: ${e.message}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package no.nav.sykdig.digitalisering.papirsykmelding.api
import io.opentelemetry.instrumentation.annotations.WithSpan
import no.nav.sykdig.applog
import no.nav.sykdig.digitalisering.helsenett.SykmelderService
import no.nav.sykdig.digitalisering.papirsykmelding.NasjonalCommonService
import no.nav.sykdig.digitalisering.papirsykmelding.NasjonalOppgaveService
import no.nav.sykdig.digitalisering.papirsykmelding.NasjonalSykmeldingService
import no.nav.sykdig.digitalisering.papirsykmelding.api.model.PapirManuellOppgave
Expand Down Expand Up @@ -35,7 +34,6 @@ class NasjonalOppgaveController(
private val sykmelderService: SykmelderService,
private val personService: PersonService,
private val nasjonalSykmeldingService: NasjonalSykmeldingService,
private val nasjonalCommonService: NasjonalCommonService,
) {
val log = applog()
val securelog = securelog()
Expand Down
Loading