SURFscz / SBS

Samenwerking Beheer Systeem ↣ Collaboration Management System
Apache License 2.0
3 stars 2 forks source link

Remove Bearer token if SCIM URL changes #1451

Closed baszoetekouw closed 4 weeks ago

baszoetekouw commented 1 month ago

As the encryption of the SCIM server bearer token is tied to the SCIM url, we need to remove old SCIM bearer token if the SCIM url changes or SCIM is disabled.

Otherwise the API won't allow you to change the SCIM properties.

oharsta commented 4 weeks ago

Als de scim_url wordt aangepast van een service, dan decrypt ik de scim_bearer_token en na de update, encrypt ik deze opnieuw met de nieuwe context (de url is daar tenslotte onderdeel van). Dat gaat gewoon goed. Alleen als er wel een scim_bearer_token is en geen scim_url, en de scim_url wordt aangepast, dan gaat het fout, omdat zonder een scim_url de decryption niet kan worden gedaan. Dan krijg je:

BadRequest("encrypt_scim_bearer_token requires scim_bearer_token and scim_url")

Bas heeft de volgende query uitgevoerd op prod

select id, name , scim_url, scim_bearer_token from services where (scim_bearer_token is not NULL or trim(scim_bearer_token) <> '') and (scim_url is NULL or trim(scim_url) = '');

en die was empty. Volgens mij was de oorzaak dus een foutieve / legacy geconfigureerde service.