From 4bd714728b0de8d00e837de93d55d074fb315aa1 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Fri, 20 Oct 2023 11:25:44 -0400 Subject: [PATCH] fix: issues with MarkAuthzDoneMixin --- bento_lib/auth/middleware/base.py | 10 ++-------- bento_lib/auth/middleware/mark_authz_done_mixin.py | 12 ++++++++++++ bento_lib/auth/types.py | 2 +- bento_lib/responses/flask_errors.py | 1 - 4 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 bento_lib/auth/middleware/mark_authz_done_mixin.py diff --git a/bento_lib/auth/middleware/base.py b/bento_lib/auth/middleware/base.py index acd2116..a75c175 100644 --- a/bento_lib/auth/middleware/base.py +++ b/bento_lib/auth/middleware/base.py @@ -7,15 +7,9 @@ from ..exceptions import BentoAuthException from ..types import EvaluationResultMatrix +from .mark_authz_done_mixin import MarkAuthzDoneMixin -__all__ = ["MarkAuthzDoneMixin", "BaseAuthMiddleware"] - - -class MarkAuthzDoneMixin(ABC): - @staticmethod - @abstractmethod - def mark_authz_done(request: Any): # pragma: no cover - pass +__all__ = ["BaseAuthMiddleware"] class BaseAuthMiddleware(ABC, MarkAuthzDoneMixin): diff --git a/bento_lib/auth/middleware/mark_authz_done_mixin.py b/bento_lib/auth/middleware/mark_authz_done_mixin.py new file mode 100644 index 0000000..1494c74 --- /dev/null +++ b/bento_lib/auth/middleware/mark_authz_done_mixin.py @@ -0,0 +1,12 @@ +from abc import abstractmethod +from typing import Any + + +__all__ = ["MarkAuthzDoneMixin"] + + +class MarkAuthzDoneMixin: + @staticmethod + @abstractmethod + def mark_authz_done(request: Any): # pragma: no cover + pass diff --git a/bento_lib/auth/types.py b/bento_lib/auth/types.py index bc85608..d37dd45 100644 --- a/bento_lib/auth/types.py +++ b/bento_lib/auth/types.py @@ -1,6 +1,6 @@ from typing import Type -from ..auth.middleware.base import MarkAuthzDoneMixin +from ..auth.middleware.mark_authz_done_mixin import MarkAuthzDoneMixin __all__ = [ "EvaluationResultMatrix", diff --git a/bento_lib/responses/flask_errors.py b/bento_lib/responses/flask_errors.py index a762d21..d384e78 100644 --- a/bento_lib/responses/flask_errors.py +++ b/bento_lib/responses/flask_errors.py @@ -5,7 +5,6 @@ from functools import partial from typing import Callable -from ..auth.middleware.flask import FlaskAuthMiddleware from ..auth.types import MarkAuthzDoneType from ..responses import errors