OpenSlides / openslides-auth-service

Authentication service for OpenSlides 4+
MIT License
3 stars 15 forks source link

`/system/saml/metadata` serves potentially outdated data #165

Open peb-adr opened 11 months ago

peb-adr commented 11 months ago

In the current SAML implementation the datastore is only queried once for the organization.saml_metadata_sp field which is then stored in a local variable and served on /system/saml/metadata as long as the container lives - regardless of changes to the datastore.

A solution for this needs to be found. Options discussed before are:

As of right now the container needs to be restarted after changing metadata in order for it to be served on /system/saml/metadata.

jsangmeister commented 9 months ago

Another problem/overhead with your first two solutions is that the service currently does not have a long-running thread which could do the polling/listening, so this would have to be additionally implemented.

Not caching in a local variable, i.e. for every request to /system/saml/metadata/ the datastore is queried for the current metadata. This would also mean alot of avoidable requests / load, albeit probably very low performance impact.

Do we have any statistics on how often such a request is done? If it's a reasonable amount, I would favor this solution, as it's the easiest to implement.

peb-adr commented 8 months ago
  • The robust solution would be to have the auth service listen to datastore-events changing the field in one or another way. I.e. either making a subscription to the autoupdate service or by attaching to the redis message bus itself. However this would be quite some overhead, since the auth service otherwise doesn't listen for changed data, so an adapter would have to be implemented solely for this use-case.

Talked about this issue for a few minutes in plenum. This was the favored solution, as it will yield most consistent results. We would want to subscribe to the autoupdate for this. Apparently there is an interface to do this internally without user authentication.