Re-read information from idp
Closes #29 (closed)
This MR now have the additional option to handle failed validations (this is meant in case of updates on the JWT public key due to changes on the IDP).
The code does the following:
- it tests if the validation fails
- if so, then it checks if there is a service class in the config to query the idp again
- if there is one, it asks for up to date JWT public key
- then it tries the validation again; if it works then, it is fine; if not the user can't access the route.
This has some tweaks to not break the performance:
- it only runs if there is a problem with the current validation. Normally the users should get a valid token and if should work as usual.
- in case that there is no valid token, it will try to update the JWT public key. But it will do so only once in 10 mins. So even if there are a lot of queries without a valid token - only 1 in 10 mins will be effected by this (due to parallelism some more, but definitely not all)..
As the WELL_KNOWN_URL is set on startup, there is no change to change it once the service runs. This will be a protection for our security (as updating the JWT_PUBLIC_KEY otherwise can be problematic).
Edited by Nils Brinckmann