Change the default client token expiration from None to the value set in the site config.
Review Request #13410 — Created Nov. 8, 2023 and submitted
Previously, the
WebAPITokens.objects.get_or_create_client_tokenwould create
client tokens with no expiration date by default. In most cases, we want to
create client tokens with theclient_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
forWebAPITokens.objects.get_or_create_client_token.
- Tested creating client/using client tokens with RBTool's login.
- Ran unit tests.
| Summary | ID |
|---|---|
| 4e6132d1dddbce11fc47b265d87c1bbea0fd2e32 |
| Description | From | Last Updated |
|---|---|---|
|
This approach definitely works, but I wonder if it might make sense to use some of the new symbol support … |
|
-
-
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
djblets.util.symbolswithUnsettable[...]andUNSET, so you can do:expires: Unsettable[Optional[datetime.datetime]] = UNSETThis 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.