diff --git a/README.md b/README.md index b77632e..085d789 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,8 @@ We use GitHub pull requests. If your PR should produce a new release of authoriz Changelog --------- +* v2.4.1 + * Bugfix: handle both string and dict versions of jwks definitions. * v2.4.0 * Make middleware use TRUSTED_JWKS by default; compose this from other settings if needed. * Allow jwks from file/dict in TRUSTED_JWKS rather than url for testing. diff --git a/authorization_django/jwks.py b/authorization_django/jwks.py index e90a816..de0ab18 100644 --- a/authorization_django/jwks.py +++ b/authorization_django/jwks.py @@ -1,5 +1,6 @@ from __future__ import annotations +import json import logging import time from collections import defaultdict @@ -62,7 +63,10 @@ def check_update_keyset(self): def _load_jwks(keyset: JWKSet, jwks): try: - keyset.import_keyset(jwks) + if type(jwks) is str: + keyset.import_keyset(jwks) + else: + keyset.import_keyset(json.dumps(jwks)) except JWException as e: raise AuthzConfigurationError("Failed to import keyset from settings") from e logger.info("Loaded JWKS from JWKS setting.") diff --git a/pyproject.toml b/pyproject.toml index c155d8b..6ac0180 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "uv_build" [project] name = "datapunt-authorization-django" -version = "2.4.0" +version = "2.4.1" description = "Datapunt authorization check for Django" readme = "README.md" requires-python = ">=3.10" diff --git a/uv.lock b/uv.lock index 306c7e4..1fa493e 100644 --- a/uv.lock +++ b/uv.lock @@ -519,7 +519,7 @@ wheels = [ [[package]] name = "datapunt-authorization-django" -version = "2.4.0" +version = "2.4.1" source = { editable = "." } dependencies = [ { name = "django" },