Skip to content

Commit

Permalink
Merge pull request #532 from navikt/new_token_validation
Browse files Browse the repository at this point in the history
New token validation
  • Loading branch information
oyvind-wedoe authored Nov 7, 2024
2 parents d7d362c + ece708d commit 80dfa4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val exposedVersion = "0.45.0"
val h2Version = "2.3.232"
val pamGeographyVersion = "2.9"
val tokenValidationVersion = "1.3.0"
val tokenSupportVersion = "4.1.7"
val tokenSupportVersion = "5.0.10"
val oidcSupportVersion = "0.2.18"
val logstashVersion = "8.0"
val pdfboxVersion = "3.0.3"
Expand Down Expand Up @@ -34,7 +34,7 @@ repositories {
plugins {
val kotlinVersion = "2.0.21"
id("org.jetbrains.kotlin.jvm") version kotlinVersion
id("org.springframework.boot") version "3.2.5"
id("org.springframework.boot") version "3.3.5"
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
kotlin("plugin.jpa") version kotlinVersion
idea
Expand All @@ -59,6 +59,7 @@ dependencies {

implementation("org.flywaydb:flyway-core")
implementation("com.zaxxer:HikariCP")
implementation("org.flywaydb:flyway-database-postgresql")
implementation("org.postgresql:postgresql")

implementation("io.github.resilience4j:resilience4j-retry:$resilience4jVersion")
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/no/nav/klage/util/TokenUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,33 @@ class TokenUtil(
fun getOnBehalfOfTokenWithPdlScope(): String {
val clientProperties = clientConfigurationProperties.registration["pdl-onbehalfof"]!!
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
return response.accessToken!!
return response.access_token!!
}

fun getAppAccessTokenWithPdlScope(): String {
val clientProperties = clientConfigurationProperties.registration["pdl-maskintilmaskin"]!!
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
return response.accessToken!!
return response.access_token!!
}

fun getOnBehalfOfTokenWithSafselvbetjeningScope(): String {
val clientProperties = clientConfigurationProperties.registration["safselvbetjening-onbehalfof"]!!
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
return response.accessToken!!
return response.access_token!!
}

fun getAppAccessTokenWithKlageFileApiScope(): String {
val clientProperties = clientConfigurationProperties.registration["klage-file-api-maskintilmaskin"]!!
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
return response.accessToken!!
return response.access_token!!
}

fun getSelvbetjeningExpiry(): Long? = ctxHolder.getTokenValidationContext().getClaims(oldIssuer).expirationTime?.time

fun getAppAccessTokenWithKlageFSSProxyScope(): String {
val clientProperties = clientConfigurationProperties.registration["klage-fss-proxy-maskintilmaskin"]!!
val response = oAuth2AccessTokenService.getAccessToken(clientProperties)
return response.accessToken!!
return response.access_token!!
}

fun getExpiryFromIdPortenToken(token: String): Long {
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,4 @@
<logger name="org.hibernate.SQL_SLOW" level="debug"/>

<logger name="no.nav.klage" level="debug"/>

</configuration>

0 comments on commit 80dfa4a

Please sign in to comment.