Registry mapping scheme strings to AuthAdapter impls.
Apps wanting a custom adapter construct their own AuthRegistry([NoAuth(), MyAuth()]) and pass it to Hub(... auth=...). Use :meth:default for the NoAuth-only default.
Source code in autogen/beta/network/auth.py
| def __init__(self, adapters: list[AuthAdapter]) -> None:
# __init__ stores params; no side effects.
self._adapters: dict[str, AuthAdapter] = {a.scheme: a for a in adapters}
|
default classmethod
Return the lazily-initialised default registry — NoAuth only.
Source code in autogen/beta/network/auth.py
| @classmethod
def default(cls) -> "AuthRegistry":
"""Return the lazily-initialised default registry — ``NoAuth`` only."""
if cls._DEFAULT is None:
cls._DEFAULT = cls([NoAuth()])
return cls._DEFAULT
|
get
Source code in autogen/beta/network/auth.py
| def get(self, scheme: str) -> AuthAdapter:
try:
return self._adapters[scheme]
except KeyError as exc:
raise AuthError(f"unknown auth scheme: {scheme!r}") from exc
|
schemes
Source code in autogen/beta/network/auth.py
| def schemes(self) -> list[str]:
return list(self._adapters.keys())
|