Create a signal for expired API tokens.
Review Request #12589 — Created Sept. 12, 2022 and submitted
Create a signal for expired API tokens. This signal gets triggered when an
expired API token is used for authentication.We also switch from using naive date objects to timezone-aware date objects in
API token related unit tests to ensure that test data can be properly compared
to the API token's timezone-aware date objects.
- Created unit tests for the new signal and ran tests in
djblets/webapi/tests/test_signals.py
- Manually tested authenticating with expired and non expired tokens, confirmed
that appropriate notifications were sent and triggered by the signal.
Summary | ID |
---|---|
b2c89cfc2dbf184b23b09e7819b1892ead21b5bc |
Description | From | Last Updated |
---|---|---|
Can we make it so we set this key here in djblets instead of in Review Board? It seems fragile … |
david | |
The summary has to be one line without wrapping. |
chipx86 | |
Too many "d"s. |
chipx86 | |
pytz is a third-party library, so it needs to be in the second import group. Although, we don't need it … |
chipx86 | |
Can we update this to explicitly specify the class that's being tested? |
chipx86 | |
No blank line here. |
chipx86 | |
This should be outside the try, since if it were to fail (highly theoretical), the disconnect would have nothing to … |
chipx86 |
- Change Summary:
-
No longer checks the token to see if an expired notification has already been sent.
- Description:
-
Create a signal for expired API tokens. This signal gets triggered when an
~ expired API token is used for authentication, with the purpose of signaling an ~ expired API token is used for authentication. - email to be sent to the user to notify them of the expired token. An - expired_email_sent
flag may be set in the token'sextra_data
, and when set- the signal will not be triggered even when the expired API token is used. This - way the email will only be sent once, upon first use of an expired token. We also switch from using naive date objects to timezone-aware date objects in
API token related unit tests to ensure that test data can be properly compared to the API token's timezone-aware date objects. - Testing Done:
-
- Created unit tests for the new signal and ran tests in
djblets/webapi/tests/test_signals.py
~ - Manually tested authenticating with expired and non expired tokens, confirmed
that appropriate emails were sent and triggered by the signal.
~ - Manually tested authenticating with expired and non expired tokens, confirmed
that appropriate notifications were sent and triggered by the signal.
- Created unit tests for the new signal and ran tests in
- Commits:
-
Summary ID 89d3defa21d263b06d9be996aa4a60f10cdb5ade a8fadd9d397f8a9bba97795acd7573f2b97a1c11
Checks run (2 succeeded)
- Commits:
-
Summary ID a8fadd9d397f8a9bba97795acd7573f2b97a1c11 167262ee55eae0c5540d3981d54d47d7fb9f61b1