Skip to content

Commit

Permalink
Fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kaja-nav committed Feb 28, 2024
1 parent 45e780c commit c3cb3a1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
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
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 c3cb3a1

Please sign in to comment.