From 4d81907966dc45ab983bc47a71f18f61015e1d16 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 14 Feb 2023 11:34:45 -0500 Subject: [PATCH] fix for mypy on python 3.9 w/ burnettk --- .../src/spiffworkflow_backend/models/spiff_step_details.py | 7 ++++++- .../services/authentication_service.py | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py index dac4e469..9fd1b296 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py @@ -1,5 +1,6 @@ """Spiff_step_details.""" from dataclasses import dataclass +from typing import Union from sqlalchemy import ForeignKey from sqlalchemy import UniqueConstraint @@ -32,4 +33,8 @@ class SpiffStepDetailsModel(SpiffworkflowBaseDBModel): bpmn_task_identifier: str = db.Column(db.String(255), nullable=False) start_in_seconds: float = db.Column(db.DECIMAL(17, 6), nullable=False) - end_in_seconds: float | None = db.Column(db.DECIMAL(17, 6)) + + # to fix mypy in 3.9 - not sure why syntax like: + # float | None + # works in other dataclass db models + end_in_seconds: Union[float, None] = db.Column(db.DECIMAL(17, 6)) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py index 04b2704a..7b8d6e70 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py @@ -165,7 +165,7 @@ class AuthenticationService: iss = decoded_token["iss"] aud = decoded_token["aud"] - azp = decoded_token['azp'] if "azp" in decoded_token else None + azp = decoded_token["azp"] if "azp" in decoded_token else None iat = decoded_token["iat"] if iss != cls.server_url(): valid = False @@ -179,6 +179,7 @@ class AuthenticationService: "account", ): valid = False + # make sure issued at time is not in the future elif now + iat_clock_skew_leeway < iat: valid = False