Source code for structum_lab.plugins.auth.base
# Auth Plugin - Base Class
# SPDX-License-Identifier: Apache-2.0
"""
Base class for auth implementations with Factory Pattern support.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, ClassVar
if TYPE_CHECKING:
from structum_lab.config import ConfigInterface
[docs]
class BaseAuthProvider:
"""Base class providing Factory Pattern configuration."""
#: Default config key prefix
DEFAULT_CONFIG_KEY: ClassVar[str] = "auth"
[docs]
@classmethod
def get_config(
cls,
config_key: str | None = None,
config: ConfigInterface | None = None,
) -> tuple[dict[str, Any], dict[str, Any]]:
"""Helper to get config and secrets.
Returns:
Tuple of (public_config, secrets)
"""
if config is None:
from structum_lab.config import get_config
config = get_config()
key = config_key or cls.DEFAULT_CONFIG_KEY
# Get flattened config for this key
# Note: Depending on dynaconf setup, this might need adjustment
# For now, we manually fetch known keys in the subclasses
return {}, {}