Skip to content

Commit

Permalink
Trying to decode
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadam14 committed Dec 4, 2024
1 parent 664744e commit 4958dcc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/regtech_api_commons/oauth2/oauth2_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ def __init__(self, kc_settings: KeycloakSettings) -> None:

def get_claims(self, token: str) -> Dict[str, str] | None:
try:
kid = jwt.get_unverified_header(token).get("kid")
keys = self._get_keys()
key = next((key for key in keys["keys"] if key["kid"] == kid), None)
if not key:
pass
return jwt.decode(
jwt=token,
key=jwt.pyJWK.from_json(self._get_keys()),
key=jwt.PyJWK.from_json(json.dumps(key)),
issuer=self._kc_settings.kc_realm_url.unicode_string(),
audience=self._kc_settings.auth_client,
options=self._kc_settings._jwt_opts,
Expand Down

0 comments on commit 4958dcc

Please sign in to comment.