Skip to content

Commit b7fce30

Browse files
Rework key-lifecycle docstrings per PR #1894 review
- deactivate_key: absorb the "deactivate on the active key with no replacement leaves the site unable to mint" warning, which belongs on deactivate_key itself (not delete_key). - delete_key: drop the create_key / activate_key chain from the rotation guidance. Reframe the docstring around what distinguishes delete from deactivate: both stop new signing with the key, but delete also pulls it from the JWKS, so still-unexpired tokens signed with it stop verifying. Rotation guidance now reduces to "keep the old key deactivated-but-published until its tokens expire, then delete". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e487e0c commit b7fce30

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

‎tableauserverclient/server/endpoint/auth_federation_endpoint.py‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ def deactivate_key(self, key: KeyIdentifier) -> None:
295295
Deactivate the given key. A deactivated key stays on the site (and in
296296
the public JWKS) so that already-issued JWTs can still be verified
297297
during their validity window, but no new JWTs will be signed with it.
298+
Deactivating the active key before another is activated leaves the
299+
site with no active key, and no new WIF tokens can be minted until
300+
a replacement is activated.
298301
299302
Parameters
300303
----------
@@ -311,19 +314,14 @@ def delete_key(self, key: KeyIdentifier) -> None:
311314
"""
312315
Delete a WIF signing key. Fails with 400 if the key is active.
313316
314-
For rotation, call ``create_key()`` → ``activate_key(new_kid)``, then
315-
**retain** the old (now-inactive) key in the site's JWKS until every
316-
JWT it signed has expired (upper bound: the site's current
317-
``token_lifetime_seconds``, default 7200 s / 2 h), and only then
318-
call ``delete_key(old_kid)``. ``activate_key`` atomically deactivates
319-
the previously active key, so the site is never without an active
320-
signing key — but the inactive key stays published in the JWKS so
321-
verifiers can keep validating tokens it already signed. Deleting it
322-
before those tokens have expired removes it from the JWKS, and any
323-
verifier that fetches the key set afterwards will reject the still-
324-
unexpired tokens. Calling ``deactivate_key`` on the active key
325-
before another is activated leaves the site with no active key, and
326-
no new WIF tokens can be minted until a replacement is activated.
317+
Unlike ``deactivate_key``, which keeps the (now-inactive) key
318+
published in the site's JWKS so that already-issued JWTs can still
319+
be verified, ``delete_key`` removes the key from the JWKS entirely —
320+
any verifier that fetches the key set afterwards will reject still-
321+
unexpired tokens signed with it. For a safe rotation, keep the old
322+
key deactivated-but-published until every JWT it signed has expired
323+
(upper bound: the site's current ``token_lifetime_seconds``, default
324+
7200 s / 2 h), and only then delete it.
327325
328326
Parameters
329327
----------

0 commit comments

Comments
 (0)