djblets.secrets.token_generators.registry¶
Registry for token generators.
New in version 3.0.
- class TokenGeneratorRegistry¶
Bases:
ExceptionFreeGetterMixin
[BaseTokenGenerator
],Registry
[BaseTokenGenerator
]Registry for managing token generators.
New in version 3.0.
- lookup_attrs: Sequence[str] = ['token_generator_id']¶
A list of attributes that items can be looked up by.
- get_token_generator(token_generator_id: str) Optional[BaseTokenGenerator] ¶
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 ¶
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()¶
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] ¶
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.
- __orig_bases__ = (djblets.registries.mixins.ExceptionFreeGetterMixin[djblets.secrets.token_generators.base.BaseTokenGenerator], djblets.registries.registry.Registry[djblets.secrets.token_generators.base.BaseTokenGenerator])¶
- __parameters__ = ()¶