jsonwebtoken
jsonwebtoken copied to clipboard
Treat empty audience as equivalent to no audience
Hello,
There's a specific case where audience is supplied but empty, which I think should be treated as the same as audience not being supplied.
Ie:
{
"iss": ...,
"aud": [],
"exp": ...
...
}
Will fail validation if options.aud is None.
While (no aud)
{
"iss": ...,
"exp": ...
...
}
passes validation in that same case where options.aud is None.
The user could just turn off audience validation, but the default is audience validation on, which is reasonable, but then it should accept the supplied but empty audience.
This could also be fixed by changing the deserialization, an empty vec gets deserialized into Multiple but it could be deserialized into NotPresent, but that is a bit trickier.