Change the default client token expiration from None to the value set in the site config.
Review Request #13410 — Created Nov. 8, 2023 and updated
client tokens with no expiration date by default. In most cases, we want to
create client tokens with the
client_token_expirationvalue set in the site
configuration (e.g. 1 year from now). Instead of carrying around the logic for
this to multiple areas, this change makes this value the default expiration
- Tested creating client/using client tokens with RBTool's login.
- Ran unit tests.
This approach definitely works, but I wonder if it might make sense to use some of the new symbol support in Djblets. We'd want to backport some of the stuff in Djblets 4 to 3.4, but in Djblets 4, we have
UNSET, so you can do:
expires: Unsettable[Optional[datetime.datetime]] = UNSET
This has the advantage of having a clearly-defined, documented, doc-generated value that differs from a
Noneand can't be confused with any other value.
If that approach works for you, feel free to backport commit 0b0f0de79.
Makes use of
djblets.util.sumbols.UNSETinstead of a custom sentinel value.
Revision 2 (+94 -42)