Hello, I have noticed that when passing a claim that has a boolean false as value, the validation fails with Invalid claim error, e.g.:
registry = jwt.JWTClaimsRegistry(bool_claim={"essential": True})
registry.validate({"bool_claim": False})
Traceback (most recent call last):
File "/home/schemer/test/test/main.py", line 23, in <module>
registry.validate({"bool_claim": False})
File "/home/schemer/test/.venv/lib/python3.12/site-packages/joserfc/rfc7519/registry.py", line 52, in validate
self.check_value(key, value)
File "/home/schemer/test/.venv/lib/python3.12/site-packages/joserfc/rfc7519/registry.py", line 31, in check_value
raise InvalidClaimError(claim_name)
joserfc.errors.InvalidClaimError: invalid_claim: Invalid claim: "bool_claim"
But the same registry validates correctly when the claim has a boolean true:
registry = jwt.JWTClaimsRegistry(bool_claim={"essential": True})
registry.validate({"bool_claim": True})
I went through the code, and found that the issue is getting raised here:
|
if not allow_blank and not value: |
Passing the "allow_blank" option does fix this, but I don't want to have a blank claim and I want to always ensure that it has a value.
Hello, I have noticed that when passing a claim that has a boolean false as value, the validation fails with Invalid claim error, e.g.:
But the same registry validates correctly when the claim has a boolean true:
I went through the code, and found that the issue is getting raised here:
joserfc/src/joserfc/rfc7519/registry.py
Line 30 in 18ae2e2
Passing the "allow_blank" option does fix this, but I don't want to have a blank claim and I want to always ensure that it has a value.