From 8ae8ac47c503595590148935154943703ace7a40 Mon Sep 17 00:00:00 2001 From: roland Date: Sat, 5 Mar 2022 15:47:51 +0100 Subject: [PATCH 1/3] A more robust implementation of the function that adds domain and port to strings in the configuration. This will modify any string that contains '{domain}' and/or '{port}'. --- src/oidcmsg/configure.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/oidcmsg/configure.py b/src/oidcmsg/configure.py index d9b0c4b..0d62fa5 100644 --- a/src/oidcmsg/configure.py +++ b/src/oidcmsg/configure.py @@ -51,19 +51,30 @@ def add_base_path(conf: dict, base_path: str, attributes: List[str], attribute_t return conf +def _conv(val, domain, port): + if isinstance(val, str) and ("{domain}" in val or "{port}" in val): + return val.format(domain=domain, port=port) + + return val + + def set_domain_and_port(conf: dict, uris: List[str], domain: str, port: int): + update = {} for key, val in conf.items(): - if key in uris: - if not val: - continue + if not val: + continue - if isinstance(val, list): - _new = [v.format(domain=domain, port=port) for v in val] - else: - _new = val.format(domain=domain, port=port) - conf[key] = _new + if isinstance(val, list): + _new = [_conv(v, domain=domain, port=port) for v in val] elif isinstance(val, dict): - conf[key] = set_domain_and_port(val, uris, domain, port) + _new = set_domain_and_port(val, uris, domain, port) + else: + _new = _conv(val, domain=domain, port=port) + + if _new != val: + update[key] = _new + if update: + conf.update(update) return conf From 64f3291c485bbfbeac8af47f28a02b36c5fe158b Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Sun, 27 Mar 2022 12:28:35 +0200 Subject: [PATCH 2/3] bump requirement --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 03527b6..2a8ec3f --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ def run_tests(self): "Programming Language :: Python :: 3.10", "Topic :: Software Development :: Libraries :: Python Modules"], install_requires=[ - "cryptojwt==1.6.1", + "cryptojwt>=1.7.1", "pyOpenSSL", "filelock>=3.0.12", 'pyyaml>=5.1.2' From fccf44e95af42acd7cfa80e02d9475c1078950ea Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Mon, 28 Mar 2022 09:05:43 +0200 Subject: [PATCH 3/3] build on Python 3.10 --- .github/workflows/python-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 9490a07..58174ff 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -21,6 +21,7 @@ jobs: - '3.7' - '3.8' - '3.9' + - '3.10' steps: - uses: actions/checkout@v2