idp.py 631 B

12345678910111213141516171819202122232425262728
  1. from abc import ABC, abstractmethod
  2. from redis.auth.token import TokenInterface
  3. """
  4. This interface is the facade of an identity provider
  5. """
  6. class IdentityProviderInterface(ABC):
  7. """
  8. Receive a token from the identity provider.
  9. Receiving a token only works when being authenticated.
  10. """
  11. @abstractmethod
  12. def request_token(self, force_refresh=False) -> TokenInterface:
  13. pass
  14. class IdentityProviderConfigInterface(ABC):
  15. """
  16. Configuration class that provides a configured identity provider.
  17. """
  18. @abstractmethod
  19. def get_provider(self) -> IdentityProviderInterface:
  20. pass