Source code for imednet.auth.strategy

"""Authentication strategy protocol."""

from typing import Protocol, runtime_checkable


[docs]@runtime_checkable class AuthStrategy(Protocol): """Protocol for authentication strategies. Strategies must provide headers to be injected into requests. """
[docs] def get_headers(self) -> dict[str, str]: """Return authentication headers.""" ...
[docs] def get_user_roles(self) -> list[str]: """Return resolved roles for the user, if available.""" ...
[docs] def get_user_id(self) -> str | None: """Return user identity, if available.""" ...