Skip to content

JwtHeader.fromJsonString fails on scala 2.12.12 #41

@seriar

Description

@seriar

Trying to parse the JWT with scala 2.12.12 fails

The following snippet will return false on validation:

val jwt = JsonWebToken(JwtHeader("HS256"), JwtClaimsSet(Map.empty[String, String]), "test")
JsonWebToken.validate(jwt, "test")

There appears to be a problem to parse the header properly and the following header parsing throws an exception by itself:

JwtHeader.fromJsonString(JwtHeader("HS256").asJsonString)
Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.immutable.List.$anonfun$flatMap$1$adapted(Lscala/runtime/BooleanRef;Lscala/runtime/ObjectRef;Lscala/runtime/ObjectRef;Ljava/lang/Object;)Ljava/lang/Object;
	at java.base/java.lang.invoke.MethodHandleNatives.resolve(Native Method)
	at java.base/java.lang.invoke.MemberName$Factory.resolve(MemberName.java:1041)
	at java.base/java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1066)
	at java.base/java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:2040)
	at java.base/java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:2453)
	at java.base/java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:501)
	at org.json4s.MonadicJValue.findDirectByName(MonadicJValue.scala:25)
	at org.json4s.MonadicJValue.$bslash(MonadicJValue.scala:18)
	at authentikat.jwt.JwtHeader$.fromJsonString(JwtHeader.scala:42)
	at com.playground$.main(App.scala:17)
	at com.playground.App.main(App.scala)

The issue possibly comes from json4s and scala 2.12.12 problem with older json4s versions (e.g. scala/bug#12100), and if so possibly the json4s should be updated here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions