diff --git a/pyeudiw/satosa/backend.py b/pyeudiw/satosa/backend.py index 9771b19d..6d53ee3f 100644 --- a/pyeudiw/satosa/backend.py +++ b/pyeudiw/satosa/backend.py @@ -822,7 +822,7 @@ def status_endpoint(self, context): request_object = session.get("request_object", None) if request_object: - if request_object["exp"] >= iat_now(): + if iat_now() > request_object["exp"]: return self.handle_error( context=context, message="expired", diff --git a/pyeudiw/tests/satosa/test_backend.py b/pyeudiw/tests/satosa/test_backend.py index 096efd75..c5406eef 100644 --- a/pyeudiw/tests/satosa/test_backend.py +++ b/pyeudiw/tests/satosa/test_backend.py @@ -380,7 +380,7 @@ def test_request_endpoint(self, context): assert payload["response_uri"] == CONFIG["metadata"]["redirect_uris"][0] datetime_mock = Mock(wraps=datetime.datetime) - datetime_mock.now.return_value = datetime.datetime(1999, 1, 1) + datetime_mock.now.return_value = datetime.datetime(2999, 1, 1) with patch('datetime.datetime', new=datetime_mock): self.backend.status_endpoint(context) state_endpoint_response = self.backend.status_endpoint(context)