Hello
I have an issue with fence configuration using our company's internal IDP. I did a setup using the generic_oidc_idp
template but I think there's a problem with the token returned from our IDP :
[2023-07-25 13:59:36,306][ fence][ ERROR] Can't get user info from pingfed: Incorrect key type. Expected: 'RSA', Recieved: EC
Traceback (most recent call last):
File "/fence/fence/resources/openid/idp_oauth2.py", line 167, in get_user_id
claims = self.get_jwt_claims_identity(token_endpoint, jwks_endpoint, code)
File "/fence/fence/resources/openid/idp_oauth2.py", line 82, in get_jwt_claims_identity
return jwt.decode(
File "/usr/local/lib/python3.9/site-packages/jose/jwt.py", line 134, in decode
payload = jws.verify(token, key, algorithms, verify=verify_signature)
File "/usr/local/lib/python3.9/site-packages/jose/jws.py", line 75, in verify
_verify_signature(signing_input, header, signature, key, algorithms)
File "/usr/local/lib/python3.9/site-packages/jose/jws.py", line 262, in _verify_signature
if not _sig_matches_keys(keys, signing_input, signature, alg):
File "/usr/local/lib/python3.9/site-packages/jose/jws.py", line 210, in _sig_matches_keys
key = jwk.construct(key, alg)
File "/usr/local/lib/python3.9/site-packages/jose/jwk.py", line 61, in construct
return key_class(key_data, algorithm)
File "/usr/local/lib/python3.9/site-packages/jose/backends/pycrypto_backend.py", line 57, in __init__
self._process_jwk(key)
File "/usr/local/lib/python3.9/site-packages/jose/backends/pycrypto_backend.py", line 81, in _process_jwk
raise JWKError("Incorrect key type. Expected: 'RSA', Recieved: %s" % jwk_dict.get('kty'))
jose.exceptions.JWKError: Incorrect key type. Expected: 'RSA', Recieved: EC
If I understand that error correctly it is because our IDP returned a JWT signed with an algorithm different than RSA, but I don't understand why and don't see any way of influencing that through configuration.
What's strange is when I do the authorization flow manually (using Postman or curl) I receive JWTs with "alg": "RS256"
by default without any extra parameters needed.
I already found out that JWT decoding code in fence has hardcoded usage of the "RS256" algorithm so I definitely can't change that through configuration:
Are my assumptions correct? Any advice on how to manage that issue?