SFM/app/auth/providers.py
Raykov-MS a2e9b1c65f fix
2026-06-04 16:57:08 +03:00

34 lines
1010 B
Python

from __future__ import annotations
from typing import Any, Protocol
from .mock_provider import get_jwt_token as get_jwt_token_local
from .mock_provider import protect_application as protect_application_local
class AuthProvider(Protocol):
def get_token_data(self) -> dict[str, Any] | None: ...
class LocalMockProvider:
def get_token_data(self) -> dict[str, Any] | None:
protect_application_local(render_exit=False)
return get_jwt_token_local()
class RaisaProvider:
def get_token_data(self) -> dict[str, Any] | None:
from raisa_streamlit_oauth import (
get_jwt_token as get_jwt_token_raisa, # type: ignore[reportMissingImports]
)
from raisa_streamlit_oauth import (
protect_application as protect_application_raisa, # type: ignore[reportMissingImports]
)
protect_application_raisa(render_exit=False)
return get_jwt_token_raisa()
def build_auth_provider() -> AuthProvider:
return RaisaProvider()