Skip to content

Type cast error in sample code at JWT token section #1200

Closed
@jp3pe

Description

Test environment

java: zulu-17
Build: Gradle
Added dependencies: (io.jsonwebtoken:jjwt:0.9.1', javax.xml.bind:jaxb-api:2.3.1)

Location

JWT tokens section-7th problem-second sample code
/WebGoat/start.mvc#lesson/JWT.lesson/6

Issue

At the second sample code on the page, the code convert claims.get("admin") to (String).
I ran the code and it return the error class java.lang.Boolean cannot be cast to class java.lang.String

Solution

Change Boolean.valueOf((String) claims.get("admin")) to Boolean.valueOf(String.valueOf(claims.get("admin")))

PS

I'm not good at Java and Web security.
If the issue was occurred by a different JVM version or my misunderstanding, please ignore it.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions