There's some discussion, for example in python-keycloak,to migrate away from python-jose as it isn't maintained anymore. I think jwcrypto fits the bill but without some extra security knowledge, it's hard to make the jump.
For example, the current way in the above library, to decode a JWT is:
jwt.decode(token, key, algorithms=algorithms, audience=self.client_id, **kwargs)
The public key is provided by keycloak.
If we do something similar (in the API sense, not with correctness in mind) with jwcrypto we get:
jwt.JWT(jwt=token, key=key, algs=algorithms,...)
But this won't work, in this case for example that external public key is not even a JWK object but if we try to convert it (how?) then I could only get JWSInvalidSignature or something similar.
I think it would be an improvement to document how to use jwcrypto in that case and/or provide higher level functions which take the correct steps for a potential user.
Please do tell if this example is bad or unclear.
Thanks!
There's some discussion, for example in python-keycloak,to migrate away from
python-joseas it isn't maintained anymore. I thinkjwcryptofits the bill but without some extra security knowledge, it's hard to make the jump.For example, the current way in the above library, to decode a JWT is:
The public key is provided by keycloak.
If we do something similar (in the API sense, not with correctness in mind) with
jwcryptowe get:But this won't work, in this case for example that external public key is not even a
JWKobject but if we try to convert it (how?) then I could only getJWSInvalidSignatureor something similar.I think it would be an improvement to document how to use
jwcryptoin that case and/or provide higher level functions which take the correct steps for a potential user.Please do tell if this example is bad or unclear.
Thanks!