Update WebAPITokenManager to use token generators
Review Request #12419 — Created June 28, 2022 and submitted — Latest diff uploaded
Currently, token generation is baked into
djblets.webapi.managers.WebAPITokenManager
. With our move to API Tokens v2,
we don't want token generation to be tightly coupled with Web API tokens. We
want tokens to be usable outside of just the API.This change moves token generation out of
WebAPITokenManager
by making use of
token generators instead of directly generating tokens inWebAPITokenManager
.
To do this we add two new parameters toWebAPITokenManager
,
token_generator_id
to decide what token generator to use andtoken_info
to
pass along information needed for token generation to the token generator.
- Updated
WebAPITokenManager
's unit tests to account for the use
of token generators. - Ran all unit tests in
djblets.webapi.tests
with success.