Create a CheckpointΒΆ
You can create your own checkpoint by inheriting from the BaseCheckpoint class:
from flask_imp.security import BaseCheckpoint
class MyCheckpoint(BaseCheckpoint):
my_attrs_here: str
def __init__(self, passed_in_arg: str):
self.my_attrs_here = passed_in_arg
def pass_(self) -> <truly>:
# conditional check here, must return truly.
...
MyCheckpoint(
passed_in_arg: str,
).action(
fail_url: t.Optional[t.Union[str, t.Callable[[], t.Any]]] = None,
fail_json: t.Optional[t.Dict[str, t.Any]] = None,
fail_response: t.Optional[t.Callable[[], Response]] = None,
fail_status: int = 403,
pass_url: t.Optional[t.Union[str, t.Callable[[], t.Any]]] = None,
message: t.Optional[str] = None,
message_category: str = "message",
disable_default_fail: bool = False
)