Description
Describe the bug
In 0.11.5 and below, the Claims
object can be extracted from JWS regardless of whether the cty
field is set on header or not.
From 0.12.0 onwards, if the cty
header is set, an exception is thrown when attempting to extract the Claims
object, even when the content type is json.
The behaviour appears to have changed in this PR. The change is clearly driven by the RFC but I don't believe the jjwt library should automatically throw an exception in this scenario. We have no control over whether the client has included the cty field or not, but if they specify json, then I think we should continue to parse the claims as if the field weren't specified at all.
To Reproduce
Any attempt to invoke DefaultJwtParser#parseSignedClaims()
when the supplied JWS has the cty
field set results in io.jsonwebtoken.UnsupportedJwtException: Unexpected content JWS.
. This occurs even if the specified content type is json.
Expected behavior
The claims are parsed successfully and returned from the method.
Screenshots
Old, expected behaviour (0.11.5)
New, unexpected behaviour (0.12.3)