I am getting a weird exception using jjwt when parsing my JWT(JWS).
Here is code of parsing:
JwtParser parser = Jwts.parserBuilder()
.setSigningKey(publicKey)
.build();
//exception thrown
Jws<String> parsedToken = parser.parsePlaintextJws(token);
//works
Jws<Claims> parsedToken1 = parser.parseClaimsJws(token);
Here is my code for creating a token:
token = Jwts.builder()
.setIssuedAt(Date.from(issuedTime.atZone(ZoneId.systemDefault()).toInstant()))
.setExpiration(Date.from(expirationTime.atZone(ZoneId.systemDefault()).toInstant()))
.claim("a", "foo")
.claim("b", "boo")
.signWith(secretKey, SignatureAlgorithm.RS256)
.compact();
Exception - io.jsonwebtoken.UnsupportedJwtException: Signed Claims JWSs are not supported.
What's the reason for this exception and how can it be fixed?