-
-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyJWK doesn't support RSA-OAEP algorithm #722
Comments
Seems to be affecting token validation from keycloak 16. Downgrading keycloak to version 15.0.1 solves this issue for me. Waiting for this to be fixed before upgrading keycloak. |
I was running into the same problem. Since keys with algorithms I cannot handle are the same to me as non existing keys, I decided to simply ignore them. I derived a slightly adapted PyJWKClient: class FilteredPyJWKClient(PyJWKClient):
"""
A PyJWKClient which ignores keys with unknown algorithms instead of throwing an exception.
"""
@lru_cache(maxsize=1)
def _default_algorithms(self):
return get_default_algorithms()
def fetch_data(self) -> Any:
data = super().fetch_data()
return {"keys": [key for key in data.get("keys", []) if key.get("alg", None) in self._default_algorithms()]} I am not sure if it could be feasible to integrate this kind of behaviour via a flag during the creation of a genuine PyJWKClient or not, but I just wanted to share the solution that worked for me. As soon as this Issue is resolved I will happily switch to the "official" solution. |
As a workaround you can also configure keycloak to disable the RSA-OAEP key or use a different algorithm until it is supported.
|
That didn't work for me @pm-coelho while using jboss/keycloak latest version Notice that |
@tiago-peres do you have the crypto optional dependency dependency installed? |
Well spotted... I don't and using Then tried |
that looks like a missing OS dependency, make sure you have all that crypto requires installed and on $PATH |
you're right again... As per the documentation:
it was missing |
yep, that's working if we ensure the next steps I've done after! Thank you! |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
We encountered the same error while using pyjwt with keycloak. Is support for RSA-OAEP planned ? |
I think the issue itself may be resolved with #762. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Using a hosted KeyCloak instance from https://www.cloud-iam.com/ which sets its
enc
public cert to useRSA-OAEP
causesPyJWKClient
to throw an exception (raised byPyJWK
constructor).Expected Result
I don't know the ins and outs of it, but either the
RSA-OAEP
algorithm should be supported or theenc
cert ignored (thesig
one isRSA256
).Actual Result
Reproduction Steps
Pretty-printed cert for your pleasure
System Information
The text was updated successfully, but these errors were encountered: