synapse/synapse
reivilibre 1709234311
Add an access token introspection cache to make Matrix Authentication Service integration (MSC3861) more efficient. (#18231)
Evolution of
cd78f3d2ee

This cache does not have any explicit invalidation, but this is deemed
acceptable (see code comment).

We may still prefer to add it eventually, letting us bump up the
Time-To-Live (TTL) on the cache as we currently set a 2 minute expiry
to balance the fact that we have no explicit invalidation.


This cache makes several things more efficient:

- reduces number of outbound requests from Synapse, reducing CPU
utilisation + network I/O
- reduces request handling time in Synapse, which improves
client-visible latency
- reduces load on MAS and its database


---

Other than that, this PR also introduces support for `expires_in`
(seconds) on the introspection response.
This lets the cached responses expire at the proper expiry time of the
access token, whilst avoiding clock skew issues.

Corresponds to:
https://github.com/element-hq/matrix-authentication-service/pull/4241

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
2025-04-01 14:31:19 +01:00
..
_scripts Delete unreferenced state groups in background (#18254) 2025-03-21 17:09:49 +00:00
api Add an access token introspection cache to make Matrix Authentication Service integration (MSC3861) more efficient. (#18231) 2025-04-01 14:31:19 +01:00
app Add missing license header (#17799) 2024-10-08 12:01:44 +01:00
appservice Support for MSC4190: device management for application services (#17705) 2024-12-04 12:04:49 +01:00
config Add redirect_uri option to oidc_providers entries (#18197) 2025-03-03 09:40:48 +00:00
crypto Fix fetching signing keys when old_verify_keys is omitted (#17568) 2024-08-14 14:13:56 +01:00
events Fix GHSA-v56r-hwv5-mxg6 — Federation denial 2025-03-26 18:44:45 +00:00
federation Fix GHSA-v56r-hwv5-mxg6 — Federation denial 2025-03-26 18:44:45 +00:00
handlers Add a column participant to room_memberships table (#18068) 2025-03-18 17:59:57 +00:00
http Add support to proxy outbound requests from Synapse in tests (#18158) 2025-02-17 10:23:04 -06:00
logging Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
media Store hashes of media files, and allow quarantining by hash. (#18277) 2025-03-27 17:26:34 +00:00
metrics Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
module_api Add method to get current server time in milliseconds in ModuleApi (#18144) 2025-02-18 10:20:30 +00:00
push Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
replication Fix new scheduled tasks jumping the queue (#17962) 2024-11-28 18:06:19 +00:00
res Send an email if the address is already bound to an user account (#16819) 2024-04-23 16:45:24 +01:00
rest Make sure we advertise registration as disabled when MSC3861 is enabled (#17661) 2025-02-18 14:47:35 +00:00
server_notices Format files with Ruff (#17643) 2024-09-02 12:39:04 +01:00
spam_checker_api Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
state Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
static Update link to the clients webpage, fix #15825 (#15874) 2023-07-06 17:28:09 +02:00
storage Store hashes of media files, and allow quarantining by hash. (#18277) 2025-03-27 17:26:34 +00:00
streams Fix regression when bounding future tokens (#17391) 2024-07-02 14:06:36 +01:00
synapse_rust Move server event filtering logic to rust (#17928) 2024-11-14 16:18:24 +00:00
types Delete unreferenced state groups in background (#18254) 2025-03-21 17:09:49 +00:00
util Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
__init__.py Remove support for python 3.8 (#17908) 2024-11-06 19:36:01 +00:00
_pydantic_compat.py import pydantic objects from the _pydantic_compat module (#17667) 2024-09-11 21:01:43 +00:00
event_auth.py Cleanup Python 3.8 leftovers (#17967) 2025-02-10 16:53:24 +00:00
notifier.py Optimise notifier mk2 (#17766) 2024-09-30 13:32:31 +01:00
py.typed
server.py Fix join being denied after being invited over federation (#18075) 2025-01-27 11:21:10 -06:00
visibility.py Move server event filtering logic to rust (#17928) 2024-11-14 16:18:24 +00:00