Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak OIDC #1112

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Keycloak OIDC #1112

wants to merge 8 commits into from

Conversation

gwynndp
Copy link
Collaborator

@gwynndp gwynndp commented Oct 6, 2023

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
const query = `${QUERY_API}/v2/organizations`; // default for testing
// const query = `${QUERY_API}/v2/organizations?ids=${JSON.stringify(
// session.user.organization_id
// )}`;
Copy link
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
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

const query = `${QUERY_API}/v2/organizations`; // default for testing
// const query = `${QUERY_API}/v2/organizations?ids=${JSON.stringify(
// session.user.organization_id
// )}`;
Copy link
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

// check if the user has an org load organizations when the user changes
useEffect(() => {
if (user && token) {
loadOrganizations();
}
setUserHasOrg(!!user?.policy?.organization?.id);
setUserHasOrg(!!user?.organization_id.length);
Copy link
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
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