Update WebAPITokenManager to use token generators

Review Request #12419 — Created June 28, 2022 and submitted — Latest diff uploaded

maubin
Djblets
release-3.x
12341, 12415
djblets

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 in WebAPITokenManager.
To do this we add two new parameters to WebAPITokenManager,
token_generator_id to decide what token generator to use and token_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.

Commits

Files

Loading...