djblets.secrets.token_generators.registry¶
Registry for token generators.
New in version 3.0.
- class TokenGeneratorRegistry[source]¶
Bases:
ExceptionFreeGetterMixin
[BaseTokenGenerator
],Registry
[BaseTokenGenerator
]Registry for managing token generators.
New in version 3.0.
- lookup_attrs: Sequence[str] = ['token_generator_id'][source]¶
A list of attributes that items can be looked up by.
- get_token_generator(token_generator_id: str) Optional[BaseTokenGenerator] [source]¶
Return a token generator with the specified ID.
- Parameters:
token_generator_id (
str
) – The ID of the token generator.- Returns:
The token generator instance, or
None
if not found.- Return type:
djblets.secrets.token_generators.BaseTokenGenerator
- get_default() BaseTokenGenerator [source]¶
Return the default token generator.
The default token generator ID can be set in
settings.DJBLETS_DEFAULT_API_TOKEN_GENERATOR
. If not set the default token generator will beVendorChecksumTokenGenerator
.- Returns:
The default token generator.
- Return type:
djblets.secrets.token_generators.BaseTokenGenerator
- get_defaults()[source]¶
Return the default token generators.
- Returns:
The list of default token generators.
- Return type:
list
ofdjblets.secrets.token_generators.BaseTokenGenerator
- get_deprecated_token_generators() Set[str] [source]¶
Return deprecated token generator IDs.
The set of deprecated token generator IDs can be set in
settings.DJBLETS_DEPRECATED_TOKEN_GENERATORS
. By default the set will contain theLegacySHA1TokenGenerator
’s ID.New in version 3.1.
- __annotations__ = {'_items': 'Set[RegistryItemType]', '_populated': 'bool', '_registry': 'Dict[str, Dict[object, RegistryItemType]]', 'already_registered_error_class': 'Type[AlreadyRegisteredError]', 'default_errors': 'RegistryErrorsDict', 'errors': 'RegistryErrorsDict', 'item_name': 'Optional[str]', 'lookup_attrs': 'Sequence[str]', 'lookup_error_class': 'Type[ItemLookupError]'}¶
- __orig_bases__ = (djblets.registries.mixins.ExceptionFreeGetterMixin[djblets.secrets.token_generators.base.BaseTokenGenerator], djblets.registries.registry.Registry[djblets.secrets.token_generators.base.BaseTokenGenerator])¶
- __parameters__ = ()¶