Skip to content

Commit

Permalink
fix(authorization): trust own tokens (also add public key when adding…
Browse files Browse the repository at this point in the history
… private key)
  • Loading branch information
slisson committed Nov 20, 2024
1 parent 633705c commit 63c02eb
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class RSATest {
val util = ModelixJWTUtil()
util.addJwksUrl(URI("http://localhost/.well-known/jwks.json").toURL())
util.useKtorClient(client)
util.setRSAPrivateKey(rsaPrivateKey)
val token = util.createAccessToken("[email protected]", listOf())
val token = ModelixJWTUtil().also { it.setRSAPrivateKey(rsaPrivateKey) }.createAccessToken("[email protected]", listOf())
util.verifyToken(token)
}

Expand All @@ -58,7 +57,7 @@ class RSATest {
util.addJwksUrl(URI("http://localhost/.well-known/jwks.json").toURL())
util.useKtorClient(client)
util.generateRSAPrivateKey()
val token = util.createAccessToken("[email protected]", listOf())
val token = ModelixJWTUtil().also { it.generateRSAPrivateKey() }.createAccessToken("[email protected]", listOf())
val ex = assertFailsWith(BadJOSEException::class) {
util.verifyToken(token)
}
Expand Down

0 comments on commit 63c02eb

Please sign in to comment.