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

Commit 00bfde9

Browse files
authored
Merge pull request #55 from IdentityPython/develop
utcnow plus configuration attribute additions.
2 parents 79e062a + fba48dc commit 00bfde9

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def run_tests(self):
6767
"Programming Language :: Python :: 3.8",
6868
"Topic :: Software Development :: Libraries :: Python Modules"],
6969
install_requires=[
70-
"cryptojwt>=1.5.2",
70+
"cryptojwt==1.6.1",
7171
"pyOpenSSL",
7272
"filelock>=3.0.12",
7373
'pyyaml>=5.1.2'

src/oidcmsg/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "Roland Hedberg"
2-
__version__ = "1.5.2"
2+
__version__ = "1.5.4"
33

44
import os
55
from typing import Dict

src/oidcmsg/configure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from oidcmsg.logging import configure_logging
1010
from oidcmsg.util import load_yaml_config
1111

12-
DEFAULT_FILE_ATTRIBUTE_NAMES = ['server_key', 'server_cert', 'filename',
12+
DEFAULT_FILE_ATTRIBUTE_NAMES = ['server_key', 'server_cert', 'filename', 'template_dir',
1313
'private_path', 'public_path', 'db_file', 'jwks_file']
1414

1515
DEFAULT_DIR_ATTRIBUTE_NAMES = ['template_dir']

src/oidcmsg/context.py

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def _keyjar(self, keyjar=None, conf=None, entity_id=""):
3535
if "keys" in conf:
3636
keys_args = {k: v for k, v in conf["keys"].items() if k != "uri_path"}
3737
_keyjar = init_key_jar(**keys_args)
38+
elif "key_conf" in conf:
39+
keys_args = {k: v for k, v in conf["key_conf"].items() if k != "uri_path"}
40+
_keyjar = init_key_jar(**keys_args)
3841
else:
3942
_keyjar = KeyJar()
4043
if "jwks" in conf:

src/oidcmsg/time_util.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
"""
18-
Implements some usefull functions when dealing with validity of
18+
Implements some useful functions when dealing with validity of
1919
different types of information.
2020
"""
2121

2222
import calendar
23+
from datetime import datetime
24+
from datetime import timedelta
25+
from datetime import timezone
2326
import logging
2427
import re
25-
import sys
2628
import time
27-
from datetime import datetime
28-
from datetime import timedelta
2929

3030
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
3131
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
181181
:return: datetime instance using UTC time
182182
"""
183183
delta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks)
184-
return datetime.utcnow() + delta
184+
res = datetime.now(timezone.utc) + delta
185+
return res.replace(tzinfo=None)
185186

186187

187188
def time_a_while_ago(
@@ -200,7 +201,8 @@ def time_a_while_ago(
200201
:return: datetime instance using UTC time
201202
"""
202203
delta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks)
203-
return datetime.utcnow() - delta
204+
res = datetime.now(timezone.utc) - delta
205+
return res.replace(tzinfo=None)
204206

205207

206208
def in_a_while(
@@ -350,8 +352,8 @@ def later_than(after, before):
350352
return after >= before
351353

352354

353-
def utc_time_sans_frac():
354-
now_timestampt = int(datetime.utcnow().timestamp())
355+
def utc_time_sans_frac(): # MUST be the same as utc_time_sans_frac in cryptojwt
356+
now_timestampt = int(datetime.now(timezone.utc).timestamp())
355357
return now_timestampt
356358

357359

tests/test_03_time_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# !/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# pylint: disable=missing-docstring
44

0 commit comments

Comments
 (0)