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

Oppgraderer til java 21, pakker og plugins. #461

Merged
merged 2 commits into from
Apr 12, 2024
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
with:
readertoken: true
buildcommand: './gradlew check'
javaversion: 21

codeql:
uses: navikt/sif-gha-workflows/.github/workflows/gradle-codeql.yml@main
Expand All @@ -33,6 +34,7 @@ jobs:
readertoken: true
package-command: './gradlew clean build -x test'
branch: master
javaversion: 21

build:
uses: navikt/sif-gha-workflows/.github/workflows/gradle-build.yml@main
Expand All @@ -45,6 +47,7 @@ jobs:
team: dusseldorf
readertoken: true
buildcommand: '--configuration-cache build -x test'
javaversion: 21

trivy:
needs: [ build ]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM amazoncorretto:17-alpine3.15
FROM amazoncorretto:21-alpine3.15

COPY build/libs/*.jar app.jar

Expand Down
36 changes: 18 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@ import com.expediagroup.graphql.plugin.gradle.tasks.GraphQLGenerateClientTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.22"
kotlin("plugin.spring") version "1.9.22"
kotlin("plugin.jpa") version "1.9.22"
id("org.springframework.boot") version "3.2.2"
kotlin("jvm") version "1.9.23"
kotlin("plugin.spring") version "1.9.23"
kotlin("plugin.jpa") version "1.9.23"
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
id("com.expediagroup.graphql") version "7.0.2"
id("org.sonarqube") version "4.4.1.3373"
id("org.sonarqube") version "5.0.0.4638"
jacoco
}

group = "no.nav"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_17
java.sourceCompatibility = JavaVersion.VERSION_21

configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}

val confluentVersion = "7.5.3"
val springCloudVersion = "4.1.1"
val confluentVersion = "7.6.1"
val springCloudVersion = "4.1.2"
val logstashLogbackEncoderVersion = "7.4"
val tokenSupportVersion = "3.2.0"
val tokenSupportVersion = "4.1.4"
val retryVersion = "2.0.5"
val zalandoVersion = "0.27.0"
val openhtmltopdfVersion = "1.0.10"
val handlebarsVersion = "4.3.1"
val postgresqlVersion = "42.7.1"
val awailitilityKotlinVersion = "4.2.0"
val handlebarsVersion = "4.4.0"
val postgresqlVersion = "42.7.3"
val awailitilityKotlinVersion = "4.2.1"
val assertkJvmVersion = "0.28.0"
val springMockkVersion = "4.0.2"
val mockkVersion = "1.13.9"
val guavaVersion = "33.0.0-jre"
val orgJsonVersion = "20231013"
val mockkVersion = "1.13.10"
val guavaVersion = "33.1.0-jre"
val orgJsonVersion = "20240303"
val graphQLKotlinVersion = "7.0.2"
val k9FormatVersion = "8.3.4"
val teamDokumenthåndteringAvroSchemaVersion = "357738b9"
val testContainersVersion = "1.19.4"
val springdocVersion = "2.3.0"
val testContainersVersion = "1.19.7"
val springdocVersion = "2.5.0"

repositories {
mavenCentral()
Expand Down Expand Up @@ -161,7 +161,7 @@ tasks.withType<Test> {
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
jvmTarget = "21"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LoggerInterceptor(private val tokenValidationContextHolder: TokenValidatio
private val logger = LoggerFactory.getLogger(LoggerInterceptor::class.java)
}
override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean {
val jwtToken = tokenValidationContextHolder.tokenValidationContext.firstValidToken.orElse(null)
val jwtToken = tokenValidationContextHolder.getTokenValidationContext().firstValidToken
if (jwtToken !== null) {
logger.info("Issuer [${jwtToken.issuer}]")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class K9SakInnsynApiClientConfig(
private fun bearerTokenInterceptor(): ClientHttpRequestInterceptor {
return ClientHttpRequestInterceptor { request: HttpRequest, body: ByteArray, execution: ClientHttpRequestExecution ->
val response = oAuth2AccessTokenService.getAccessToken(tokenxK9SakInnsynApiClientProperties)
request.headers.setBearerAuth(response.accessToken)
request.headers.setBearerAuth(response.accessToken!!)
execution.execute(request, body)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class OppslagsKlientKonfig(
else -> {
val response = oAuth2AccessTokenService.getAccessToken(tokenxK9SelvbetjeningOppslagClientProperties)
val expiresIn = response.expiresIn
logger.debug("Utveklset token utgår kl. {}, ({} min)", ZonedDateTime.now(UTC).plusSeconds(expiresIn.toLong()), expiresIn/60)
request.headers.setBearerAuth(response.accessToken)
logger.debug("Utveklset token utgår kl. {}, ({} min)", ZonedDateTime.now(UTC).plusSeconds(expiresIn!!.toLong()), expiresIn/60)
request.headers.setBearerAuth(response.accessToken!!)
}
}
execution.execute(request, body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ class SafClientConfig(
)

private fun accessToken(clientProperties: ClientProperties): String {
return oAuth2AccessTokenService.getAccessToken(clientProperties).accessToken
return oAuth2AccessTokenService.getAccessToken(clientProperties).accessToken!!
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class SafSelvbetjeningClientsConfig(
): ClientHttpRequestInterceptor {
return ClientHttpRequestInterceptor { request: HttpRequest, body: ByteArray, execution: ClientHttpRequestExecution ->
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
request.headers.setBearerAuth(response.accessToken)
request.headers.setBearerAuth(response.accessToken!!)
execution.execute(request, body)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/no/nav/sifinnsynapi/util/TokenUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ object TokenClaims {
}

fun SpringTokenValidationContextHolder.personIdent(): String {
val jwtToken = tokenValidationContext.firstValidToken
.orElseThrow { IllegalStateException("Ingen gyldige tokens i Authorization headeren") }
val jwtToken = getTokenValidationContext().firstValidToken
?: throw IllegalStateException("Ingen gyldige tokens i Authorization headeren")

val pid = jwtToken.jwtTokenClaims.getStringClaim(TokenClaims.CLAIM_PID)
val sub = jwtToken.jwtTokenClaims.getStringClaim(TokenClaims.CLAIM_SUB)
Expand Down
Loading