Skip to content

Commit

Permalink
Bump tokenSupportVersion from 3.1.5 to 4.1.3 (#8)
Browse files Browse the repository at this point in the history
* Bump tokenSupportVersion from 3.1.5 to 4.1.3

Bumps `tokenSupportVersion` from 3.1.5 to 4.1.3.

Updates `no.nav.security:token-client-spring` from 3.1.5 to 4.1.3
- [Release notes](https://github.com/navikt/token-support/releases)
- [Commits](navikt/token-support@3.1.5...4.1.3)

Updates `no.nav.security:token-validation-spring` from 3.1.5 to 4.1.3
- [Release notes](https://github.com/navikt/token-support/releases)
- [Commits](navikt/token-support@3.1.5...4.1.3)

---
updated-dependencies:
- dependency-name: no.nav.security:token-client-spring
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: no.nav.security:token-validation-spring
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Remove cookiename which is deprecated

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kaja Kvinge Akselsen <[email protected]>
  • Loading branch information
dependabot[bot] and kaja-nav authored Feb 28, 2024
1 parent e23a923 commit 664cda5
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
}
}

val tokenSupportVersion = "3.1.5"
val tokenSupportVersion = "4.1.3"
val mockkVersion = "1.13.9"
val kotestVersion = "5.8.0"
val wiremockVersion = "3.4.2"
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/no/nav/syfo/auth/oidc/TokenUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ object TokenUtil {

@JvmStatic
fun getIssuerToken(contextHolder: TokenValidationContextHolder, issuer: String): String {
val context = contextHolder.tokenValidationContext
return context.getJwtToken(issuer)?.tokenAsString
val context = contextHolder.getTokenValidationContext()
return context.getJwtToken(issuer)?.encodedToken
?: throw TokenValidationException("Klarte ikke hente token fra issuer: $issuer")
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/no/nav/syfo/auth/tokenx/TokenXUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object TokenXUtil {
contextHolder: TokenValidationContextHolder,
vararg requestedClientId: String,
): JwtTokenClaims {
val context = contextHolder.tokenValidationContext
val context = contextHolder.getTokenValidationContext()
val claims = context.getClaims(TokenXIssuer.TOKENX)
val clientId = claims.getStringClaim("client_id")

Expand All @@ -27,7 +27,7 @@ object TokenXUtil {
}

fun fnrFromIdportenTokenX(contextHolder: TokenValidationContextHolder): Fodselsnummer {
val context = contextHolder.tokenValidationContext
val context = contextHolder.getTokenValidationContext()
val claims = context.getClaims(TokenXIssuer.TOKENX)
return Fodselsnummer(claims.getStringClaim("pid"))
}
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ no.nav.security.jwt:
internazureadv2:
discoveryurl: ${azure.app.well.known.url}
accepted_audience: ${azure.app.client.id}
cookiename: ID_token
tokenx:
discoveryurl: ${TOKEN_X_WELL_KNOWN_URL}
accepted_audience: ${TOKEN_X_CLIENT_ID}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BrukerTilgangControllerTest : FunSpec({
val invalidFnr = "123"

beforeTest {
every { contextHolder.tokenValidationContext } returns mockTokenValidationContext
every { contextHolder.getTokenValidationContext() } returns mockTokenValidationContext
every { mockTokenValidationContext.getClaims(TokenXUtil.TokenXIssuer.TOKENX) } returns mockJwtTokenClaims
every { mockJwtTokenClaims.getStringClaim("pid") } returns validFnr
every { mockJwtTokenClaims.getStringClaim("client_id") } returns "clientId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KontaktinfoControllerTest : FunSpec({
val invalidFnr = "123"

beforeTest {
every { contextHolder.tokenValidationContext } returns mockTokenValidationContext
every { contextHolder.getTokenValidationContext() } returns mockTokenValidationContext
every { mockTokenValidationContext.getClaims(TOKENX) } returns mockJwtTokenClaims
every { mockJwtTokenClaims.getStringClaim("pid") } returns validFnr
every { mockJwtTokenClaims.getStringClaim("client_id") } returns "clientId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class NarmesteLederClientTest : FunSpec({
listener(WireMockListener(isnarmestelederServer, ListenerMode.PER_TEST))

beforeTest {
every { contextHolder.tokenValidationContext } returns mockTokenValidationContext
every { contextHolder.getTokenValidationContext() } returns mockTokenValidationContext
every { mockTokenValidationContext.getClaims(TokenXUtil.TokenXIssuer.TOKENX) } returns mockJwtTokenClaims
every { mockJwtTokenClaims.getStringClaim("pid") } returns ansattFnr
every { mockJwtTokenClaims.getStringClaim("client_id") } returns "clientId"
every { tokenDingsConsumer.exchangeToken(any(), any()) } returns "123abc"
every { mockTokenValidationContext.getJwtToken(any()) } returns mockJwtToken
every { mockJwtToken.tokenAsString } returns "heihei"
every { mockJwtToken.encodedToken } returns "heihei"
}

test("Henter alle ledere uavhengig av status") {
Expand Down

0 comments on commit 664cda5

Please sign in to comment.