Skip to content

Keycloak OIDC - #1112

Open
gwynndp wants to merge 8 commits into
Greenstand:old_master_2025from
gwynndp:keycloak-oidc
Open

Keycloak OIDC#1112
gwynndp wants to merge 8 commits into
Greenstand:old_master_2025from
gwynndp:keycloak-oidc

Conversation

@gwynndp

@gwynndp gwynndp commented Oct 6, 2023

Copy link
Copy Markdown
Collaborator

Description

Start replacing custom auth code with keycloak-oidc implementation

  • installed module
  • login with keycloak
  • redirect to login when session runs out or of user is not logged in anymore
  • loading organizations based on keycloak permissions

Issue(s) addressed

  • Resolves #

What kind of change(s) does this PR introduce?

  • Enhancement
  • Bug fix
  • Refactor

Please check if the PR fulfils these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Breaking change

Does this PR introduce a breaking change? NO

@gwynndp
gwynndp requested a review from a team as a code owner October 6, 2023 20:31
@gwynndp
gwynndp requested a review from dadiorchen October 6, 2023 20:33
Comment thread src/api/treeTrackerApi.js
const query = `${QUERY_API}/v2/organizations`; // default for testing
// const query = `${QUERY_API}/v2/organizations?ids=${JSON.stringify(
// session.user.organization_id
// )}`;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next step will be to update the microservices to take queries with auth

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, actually, the microservices themselves don't support auth so we can do nothing on the client side for now

Comment thread src/api/treeTrackerApi.js
const query = `${QUERY_API}/v2/organizations`; // default for testing
// const query = `${QUERY_API}/v2/organizations?ids=${JSON.stringify(
// session.user.organization_id
// )}`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, actually, the microservices themselves don't support auth so we can do nothing on the client side for now

Comment thread src/context/AppContext.js
loadOrganizations();
}
setUserHasOrg(!!user?.policy?.organization?.id);
setUserHasOrg(!!user?.organization_id.length);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gwynndp can you return organization id from keycloak now?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though I had to choose to return an array of all the organization ids related to the group or just the id that the user is manually assigned in keycloak.

The admin panel needs to receive all the ids the way it's currently implemented so I chose to return the array.

In future we may want to return either both or just the organization id, but if we do that we'll have to handle identifying sub-organizations from the group for every api-request on the backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: 🏗️ In Progress

Development

Successfully merging this pull request may close these issues.

Keycloak: take example and integrate it into Admin Panel (need cloud, api, react support)

3 participants