Skip to content

Commit

Permalink
use latest token
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuancelin committed Nov 6, 2024
1 parent c02de9e commit 243c71f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions otoroshi/app/models/apikey.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1821,8 +1821,6 @@ object ApiKeyHelper {
case ApikeyTuple(_, None, _, _, Some(otoBearer)) if !apikey.checkBearer(otoBearer) => apikey.some.left
case ApikeyTuple(_, None, Some(jwt), _, _) => {
val possibleKeyPairId = apikey.metadata.get("jwt-sign-keypair")
val aud = jwt.getAudience.asScala.headOption.filter(v => v.startsWith("http://") || v.startsWith("https://"))
println(s"audience is: ${aud}")
val kid = Option(jwt.getKeyId)
.orElse(possibleKeyPairId)
.filter(_ => constraints.jwtAuth.keyPairSigned)
Expand Down Expand Up @@ -1893,6 +1891,7 @@ object ApiKeyHelper {
.build
Try(verifier.verify(jwt))
.filter { token =>
val aud = token.getAudience.asScala.headOption.filter(v => v.startsWith("http://") || v.startsWith("https://"))
if (aud.isDefined) {
val currentUrl = req.theUrl
val audience = aud.get
Expand Down

0 comments on commit 243c71f

Please sign in to comment.