Skip to content

Commit

Permalink
ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
mettok committed Dec 6, 2024
1 parent 727157e commit b891b61
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/main/kotlin/MaskinportenClientConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.nimbusds.jose.crypto.RSASSASigner
import com.nimbusds.jose.jwk.RSAKey
import com.nimbusds.jwt.JWTClaimsSet
import com.nimbusds.jwt.SignedJWT
import no.nav.helsearbeidsgiver.utils.log.logger
import java.security.KeyFactory
import java.security.PrivateKey
import java.security.spec.PKCS8EncodedKeySpec
Expand Down Expand Up @@ -43,7 +42,7 @@ class MaskinportenClientConfigPkey(
override val aud: String,
val consumerOrgNr: String,
override val scope: String,
override val endpoint: String ,
override val endpoint: String
) : MaskinportenClientConfig {

private fun loadPrivateKey(key: String): PrivateKey {
Expand Down Expand Up @@ -106,7 +105,7 @@ class MaskinportenSimpleAssertion(
override val issuer: String,
override val aud: String,
override val endpoint: String,
val clientJwk: String,
val clientJwk: String
) : MaskinportenClientConfig {

private val rsaKey: RSAKey by lazy {
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/TokenResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ data class TokenResponse(
return "TokenResponse(accessToken='${accessToken.take(3)}', tokenType='$tokenType', expiresInSeconds=$expiresInSeconds, scope='$scope')"
}
}

@Serializable
class TokenResponseWrapper(val tokenResponse: TokenResponse) {

Expand Down
5 changes: 0 additions & 5 deletions src/test/kotlin/MaskinportenClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import io.ktor.serialization.kotlinx.json.json
import io.mockk.every
import kotlinx.coroutines.runBlocking
import no.nav.helsearbeidsgiver.maskinporten.MaskinportenClient
import no.nav.helsearbeidsgiver.maskinporten.MaskinportenClientConfig
import no.nav.helsearbeidsgiver.maskinporten.MaskinportenClientConfigPkey
import no.nav.helsearbeidsgiver.maskinporten.MaskinportenSimpleAssertion
import no.nav.helsearbeidsgiver.maskinporten.createHttpClient
import no.nav.helsearbeidsgiver.utils.test.mock.mockStatic
import org.junit.jupiter.api.Test
import java.security.KeyPairGenerator
import java.security.PrivateKey
import java.util.Base64
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
Expand Down Expand Up @@ -99,10 +97,8 @@ class MaskinportenClientTest {
assertEquals("test:test1", tokenResponseWrapper.tokenResponse.scope)
assertEquals("Bearer", tokenResponseWrapper.tokenResponse.tokenType)
}

}


private fun getMaskinportenClientConfig() = MaskinportenSimpleAssertion(
scope = "test_scope",
issuer = "test_client_id",
Expand All @@ -126,6 +122,5 @@ class MaskinportenClientTest {

val pkey = Base64.getEncoder().encodeToString(keyPair.private.encoded)
return "-----BEGIN PRIVATE KEY-----\n$pkey\n-----END PRIVATE KEY-----"

}
}

0 comments on commit b891b61

Please sign in to comment.