-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Caching of token introspection response when using MSC3861 auth #16087
Comments
FWIW We cache queries from the database and do cache invalidation, so we should be able to do something similar here with a backchannel logout or a custom API. We probably also have to worry about if the user's claims change? |
In terms of timings on this: ideally we would have this in the RC that is cut on 2023-08-22 so that it can make it into the release on 2023-08-29. |
Got it, will prioritize this. |
A question about implementing this: reading through the RFC for token revocation I saw information about how a client could revoke a token with the authorizing server, but not how the authorizing server should interact with the resource server after revoking a token (I am assuming Synapse is the resource server and Matrix Authentication Server is the authorizing server?) - although the RFC did contain this comment here: "In the former case, some (currently non-standardized) backend which I think is saying that it's essentially an implementation detail whether the authorizing server alerts the resource server if a token is revoked? Since presumably we are in control of the behavior of both the authorizing server and the resource server, it seems we could implement an endpoint in Synapse to listen for when an access token is revoked (I imagine this is what @clokep was talking about when mentioning a custom API?), which would be mirrored in the Matrix Authentication Service to send alerts about the revocation. If all of this is correct (I am not familiar with OIDC or the Matrix Authentication Service, this has just been gleaned from the MSCs and RFCs and code so please correct me if I am wrong), then it seems like it the plan for this issue would be to:
Am I missing anything/does this make sense? |
You are right that there is no standard way to signal token expiry. The OIDC CAEP events might help in the future, but right now I'd rather add a custom admin API on the Synapse side for this. In terms of implementing this, I think it makes more sense to cache the For designing the MAS -> Synapse API, what would be helpful is to use the |
Here is a preliminary PR for this: #16117 |
Description:
When experimental support for MSC3861 delegated auth by OIDC is enabled the Synapse will call the token introspection endpoint on the OpenID Provider for each invocation of
get_user_by_access_token()
.This is adding latency on all authenticated requests and load on the OpenID Provider.
Instead the Synapse could cache the result for some period of time.
Things to consider:
CC @sandhose @erikjohnston
The text was updated successfully, but these errors were encountered: