fix(control-plane): resolve organization on OIDC login and set default org on first membership#174
Closed
gozen59 wants to merge 6 commits into
Closed
fix(control-plane): resolve organization on OIDC login and set default org on first membership#174gozen59 wants to merge 6 commits into
gozen59 wants to merge 6 commits into
Conversation
537c378 to
4c5fe63
Compare
… to the list of discovered services/API) and Experimental screens Signed-off-by: Thierry MATHIAS <thierry.mathias@disney.com>
Signed-off-by: Thierry MATHIAS <thierry.mathias@disney.com>
Signed-off-by: Thierry MATHIAS <thierry.mathias@disney.com>
Run Keycloak detached with health wait, master sslRequired=NONE, and clearer dev instructions for the 3rdparty realm. Signed-off-by: Thierry MATHIAS <thierry.mathias@disney.com>
Add User.ensureDefaultOrganization() and call it whenever a user is assigned their first organization, including via admin memberships API. Signed-off-by: Thierry MATHIAS <thierry.mathias@disney.com>
Use defaultOrganization or the first membership when generating the JWT after OIDC callback, instead of failing with a null pointer. Signed-off-by: Thierry MATHIAS <thierry.mathias@disney.com>
4c5fe63 to
c13e10e
Compare
Member
|
Hi @gozen59 Thanks a lot for pushing this one but unfortunately your branch also embeds a lot of changes that are not related to these bug fixes. First, I'm gonna create the issue to track the bugs you mentioned; then I'm going to propose that you reopen the PR with just the related changes (I'm also going to merge #170 in the meantime). |
Contributor
Author
|
Hi @lbroudoux , I based these changes on the branch currently under review in PR 170. Logically, once the merge is complete, the changes will be less extensive. Regards. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two issues when authenticating users via an external OIDC provider (Keycloak):
defaultOrganizationwas unset, even though the user already belonged to one or more organizations.defaultOrganizationset, leaving them in an inconsistent state for subsequent logins.Also improves the local Keycloak startup script for OIDC development.
Changes
Control plane
User.ensureDefaultOrganization()and call it whenever a membership is added or reassigned (UserResource,OrganizationResource,OnboardingService)defaultOrganizationor fall back to the first membership; return403if the user has no organizationDev tooling
dev/start-keycloak-docker.sh: detached container, health wait,sslRequired=NONEon master realm, clearer local dev instructionsTest plan
dev/start-keycloak-docker.shand confirm it becomes ready on port 8888defaultOrganization— login should succeed and a JWT should be issuedPOST /admin/users/{id}/organizations/{name}and verifydefaultOrganizationis set automaticallyPUT /admin/users/{id}/organizationsand verifydefaultOrganizationis preserved or set from the new list403 User has no organization