Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

In step with time #64

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- '3.7'
- '3.8'
- '3.9'
- '3.10'

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
29 changes: 20 additions & 9 deletions src/oidcmsg/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down