reviewboard.accounts.backends.registry¶
Authentication backend registry.
- class AuthBackendRegistry[source]¶
Bases:
EntryPointRegistry
[Type
[BaseAuthBackend
]]A registry for managing authentication backends.
- lookup_attrs: Sequence[str] = ('backend_id',)[source]¶
A list of attributes that items can be looked up by.
- errors: RegistryErrorsDict = {'already_registered': '"%(item)r" is already a registered authentication backend.', 'load_entry_point': 'Error loading authentication backend %(entry_point)s: %(error)s', 'not_registered': 'No authentication backend registered with %(attr_name)s = %(attr_value)s.', 'unregister': '"%(item)r is not a registered authentication backend.'}[source]¶
Error formatting strings for exceptions.
Entries here override the global
DEFAULT_ERRORS
dictionary for error messages.- Type:
- process_value_from_entry_point(entry_point: EntryPoint) _BaseAuthBackendClass [source]¶
Load the class from the entry point.
If the class lacks a value for
backend_id
, it will be set as the entry point’s name.- Parameters:
entry_point (
importlib_metadata.EntryPoint
) – The entry point.- Returns:
The
BaseAuthBackend
subclass.- Return type:
- get_defaults() Iterable[Type[BaseAuthBackend]] [source]¶
Yield the authentication backends.
This will make sure the standard authentication backend is always registered and returned first.
- Yields:
type
– TheBaseAuthBackend
subclasses.
- unregister(backend_class: Type[BaseAuthBackend]) None [source]¶
Unregister the requested authentication backend.
- Parameters:
backend_class (
type
) – The class of the backend to unregister. This must be a subclass ofBaseAuthBackend
.- Raises:
djblets.registries.errors.ItemLookupError – Raised when the class cannot be found.
- get_auth_backend(auth_backend_id: str) Optional[Type[BaseAuthBackend]] [source]¶
Return the requested authentication backend, if it exists.
- Parameters:
auth_backend_id (
str
) – The unique ID of theBaseAuthBackend
class.- Returns:
The
BaseAuthBackend
subclass, orNone
if it is not registered.- Return type:
- __annotations__ = {'_items': 'set[RegistryItemType]', '_lock': 'RLock', '_registry': 'dict[str, dict[object, RegistryItemType]]', 'already_registered_error_class': 'Type[AlreadyRegisteredError]', 'default_errors': 'RegistryErrorsDict', 'entry_point': 'Optional[str]', 'errors': 'RegistryErrorsDict', 'item_name': 'Optional[str]', 'lookup_attrs': 'Sequence[str]', 'lookup_error_class': 'Type[ItemLookupError]', 'state': 'RegistryState'}¶
- __orig_bases__ = (reviewboard.registries.registry.EntryPointRegistry[typing.Type[reviewboard.accounts.backends.base.BaseAuthBackend]],)¶
- __parameters__ = ()¶
- get_enabled_auth_backends() Sequence[Type[BaseAuthBackend]] [source]¶
Return all authentication backends being used by Review Board.
The returned list contains every authentication backend that Review Board will try, in order.
- Returns:
The list of registered
BaseAuthBackend
subclasses.- Return type: