Closes #20210: Implement new version of API token #1151

Closed
opened 2026-04-05 21:09:41 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @jeremystretch on 10/2/2025

Closes: #20210

  • Extend the Token model
    • Rename key to plaintext (used only for v1 tokens)
    • Add an integer field version to denote v1/v2 tokens
    • Add key, pepper_id, and hmac_digest fields to store v2 token attributes
  • Introduce the API_TOKEN_PEPPERS configuration parameter
  • Extend TokenAuthentication to recognize both token versions and to validate v2 tokens
  • Introduce the get_current_pepper() utility function to retrieve the most recent pepper
  • Simplify the token.html template for the account view
  • Adapt all test suites to use v2 API tokens by default
  • Update the documentation
*Originally created by @jeremystretch on 10/2/2025* ### Closes: #20210 - Extend the Token model - Rename `key` to `plaintext` (used only for v1 tokens) - Add an integer field `version` to denote v1/v2 tokens - Add `key`, `pepper_id`, and `hmac_digest` fields to store v2 token attributes - Introduce the `API_TOKEN_PEPPERS` configuration parameter - Extend `TokenAuthentication` to recognize both token versions and to validate v2 tokens - Introduce the `get_current_pepper()` utility function to retrieve the most recent pepper - Simplify the `token.html` template for the account view - Adapt all test suites to use v2 API tokens by default - Update the documentation
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#1151