Source code for auth_middleware.providers.authz.groups_provider

from abc import ABCMeta, abstractmethod

from auth_middleware.types.jwt import JWTAuthorizationCredentials


[docs] class GroupsProvider(metaclass=ABCMeta): """Basic interface for a groups provider Args: metaclass (_type_, optional): _description_. Defaults to ABCMeta. """
[docs] @abstractmethod async def fetch_groups(self, token: str | JWTAuthorizationCredentials) -> list[str]: """Get groups using the token provided Args: token (JWTAuthorizationCredentials | str): The token containing the claims. Raises: NotImplementedError: _description_ Returns: List[str]: _description_ """ raise NotImplementedError("This method should be overridden by subclasses")