diff --git a/setup.py b/setup.py index c463c73..cc8b161 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ def run_tests(self): "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Python Modules"], install_requires=[ - "cryptojwt>=1.5.2", + "cryptojwt==1.6.1", "pyOpenSSL", "filelock>=3.0.12", 'pyyaml>=5.1.2' diff --git a/src/oidcmsg/__init__.py b/src/oidcmsg/__init__.py index c122148..388b6ff 100644 --- a/src/oidcmsg/__init__.py +++ b/src/oidcmsg/__init__.py @@ -1,5 +1,5 @@ __author__ = "Roland Hedberg" -__version__ = "1.5.2" +__version__ = "1.5.4" import os from typing import Dict diff --git a/src/oidcmsg/configure.py b/src/oidcmsg/configure.py index abe408e..26f65cb 100644 --- a/src/oidcmsg/configure.py +++ b/src/oidcmsg/configure.py @@ -9,7 +9,7 @@ from oidcmsg.logging import configure_logging from oidcmsg.util import load_yaml_config -DEFAULT_FILE_ATTRIBUTE_NAMES = ['server_key', 'server_cert', 'filename', +DEFAULT_FILE_ATTRIBUTE_NAMES = ['server_key', 'server_cert', 'filename', 'template_dir', 'private_path', 'public_path', 'db_file', 'jwks_file'] DEFAULT_DIR_ATTRIBUTE_NAMES = ['template_dir'] diff --git a/src/oidcmsg/context.py b/src/oidcmsg/context.py index facd91b..e30c9e6 100644 --- a/src/oidcmsg/context.py +++ b/src/oidcmsg/context.py @@ -35,6 +35,9 @@ def _keyjar(self, keyjar=None, conf=None, entity_id=""): if "keys" in conf: keys_args = {k: v for k, v in conf["keys"].items() if k != "uri_path"} _keyjar = init_key_jar(**keys_args) + elif "key_conf" in conf: + keys_args = {k: v for k, v in conf["key_conf"].items() if k != "uri_path"} + _keyjar = init_key_jar(**keys_args) else: _keyjar = KeyJar() if "jwks" in conf: diff --git a/src/oidcmsg/time_util.py b/src/oidcmsg/time_util.py index 8991bd7..643be42 100644 --- a/src/oidcmsg/time_util.py +++ b/src/oidcmsg/time_util.py @@ -15,17 +15,17 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Implements some usefull functions when dealing with validity of +Implements some useful functions when dealing with validity of different types of information. """ import calendar +from datetime import datetime +from datetime import timedelta +from datetime import timezone import logging import re -import sys import time -from datetime import datetime -from datetime import timedelta TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" TIME_FORMAT_WITH_FRAGMENT = re.compile("^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})\.\d*Z$") @@ -181,7 +181,8 @@ def time_in_a_while(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0 :return: datetime instance using UTC time """ delta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks) - return datetime.utcnow() + delta + res = datetime.now(timezone.utc) + delta + return res.replace(tzinfo=None) def time_a_while_ago( @@ -200,7 +201,8 @@ def time_a_while_ago( :return: datetime instance using UTC time """ delta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks) - return datetime.utcnow() - delta + res = datetime.now(timezone.utc) - delta + return res.replace(tzinfo=None) def in_a_while( @@ -350,8 +352,8 @@ def later_than(after, before): return after >= before -def utc_time_sans_frac(): - now_timestampt = int(datetime.utcnow().timestamp()) +def utc_time_sans_frac(): # MUST be the same as utc_time_sans_frac in cryptojwt + now_timestampt = int(datetime.now(timezone.utc).timestamp()) return now_timestampt diff --git a/tests/test_03_time_util.py b/tests/test_03_time_util.py index f5041b4..a0fe2b6 100644 --- a/tests/test_03_time_util.py +++ b/tests/test_03_time_util.py @@ -1,4 +1,4 @@ -# !/usr/bin/env python +#!/usr/bin/env python3 # pylint: disable=missing-docstring