-
Notifications
You must be signed in to change notification settings - Fork 2
Unable to « acquire » an existing organization in DC from the portal #155
Comments
Did you use a token that was already known by the Datacore (ex. already clicked on an (dc) org info in the portal since logging in) ? Then it seems it could it be #124. So please try again (after the 5 minutes delay). If it's not, we'll have to debug the Datacore. If it is, read on. Indeed, according to those logs - and it's pretty obvious from the code (https://github.com/ozwillo/ozwillo-portal/blob/master/portal-parent/ozwillo-portal-front/src/main/java/org/oasis_eu/portal/services/dc/organization/OrganizationService.java#L155), the portal : creates the missing Kernel org, adds it to permissions of the existing DC org using the admin refresh token and rights, then attempts (and fails) to further update the DC org using the REGULAR user token, ALL IN THE SAME OPERATION. Since the Datacore caches token info for 5 minutes, token info won't bear the new org id in its sub_group field, which is what the Datacore looks at when checking rights. So relogging (and getting a new token with said kernel org id) should solve it. Now, why wasn't this case encountered before ? Merely because the usual case of a portal user that wants to "acquire" his (dc) organization is a user that HASN'T ANY org yet. Which is the case for agrilocal providers. (or maybe I'm forgetting something here... anybody ?) So THIS PROBLEM SHOULDN'T BE ENCOUNTERED BY NORMAL USERS. Beyond, solutions (if it is DC#124):
And workarounds:
|
Maybe the Portal could somehow ask the DC to evict the token from its cache? Or the DC could possibly refresh its token introspection data automatically when a token is used as at a resource whose rights have been updated recently and the presented token didn't match (i.e. if token doesn't match, then if rights have been updated recently, then refresh token introspection data and check token access rights again) Re. obtaining a new token, indeed it's possible: just redirect to the authorization endpoint at the Kernel. If you do that though, you should (probably) revoke the previous token (to limit the number of active tokens). Or we could make it possible for the Portal to ask for a new token "based on" the current token (and possibly with restricted scopes – |
Tested it, same result. |
I've just reproduced the bug myself. BUT when trying to save org info again 5 minutes later, it succeeded. So it really seems it is #124. (I guess I wasn't clear when asking you to try again : it was "try again saving this org" and not "tray again acquiring another org". Am I right ?) But I was wrong when saying that it shouldn't happen in the common case. Now that the portal looks for dc orgs in the Datacore before creating them, it always happens, because this first lookup request makes the Datacore cache token infos that are about to be obsoleted by "acquiring" the found org. |
Yes, that's what I understood.
And I made my yesterday evening test from the portal. That's why I still had the problem. |
NB - reproduced & tested fix in dev environment |
Hi,
From the portal, when I want to create an organization that already exists in the Datacore, I get a 403 Forbidden error.
Here are the logs :
The text was updated successfully, but these errors were encountered: