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

Multi Tenancy through Scopes #231

Open
VizorKit opened this issue Mar 6, 2020 · 3 comments
Open

Multi Tenancy through Scopes #231

VizorKit opened this issue Mar 6, 2020 · 3 comments
Labels
enhancement This issue/PR is an enhancement or new feature.

Comments

@VizorKit
Copy link

VizorKit commented Mar 6, 2020

- [ ] bug report -> please search for issues before submitting
- [ x] feature request

Versions.

^5.1.0

Multi Tenancy is a bit difficult, its a bit more difficult if a user can act on behalf of another organization while being in their own organization.

Keycloak has an issue with scaling past 1000+ Realms. So we have solved Multi tenancy in an interesting way,
We use a client scope created for each tenant. And then a set of mappers to return the Client Roles a User has for that client scope that is active.

The only thing we are missing is in this angular support, we need the ability on init to pass in the scope.

@jonkoops jonkoops added the enhancement This issue/PR is an enhancement or new feature. label Jul 21, 2020
@jonkoops
Copy link
Collaborator

It is not possible to pass in the scope at the moment of initialization, you can however pass a scope into the login() method. For example:

function initializeKeycloak(keycloak: KeycloakService) {
  return async () => {
    const authenticated = await keycloak.init({
      config: {
        url: 'http://localhost:8080/auth',
        realm: 'master',
        clientId: 'my-app',
      },
    });

    if (!authenticated) {
      await keycloak.login({ scope: 'YOUR SCOPE HERE' });
    }
  }
}

@VizorKit does this resolve your issue?

@LeoPote
Copy link

LeoPote commented Oct 7, 2020

Hi jonkoops,

  1. If there are many scopes to be requested, how do you have to set in your scope clause, with space or comma separated? Or how exactly?

  2. I tested for one scope and it didn't work for me. Are you sure that this procedure should work?

Thank you

@CodeSwimBikeRunner
Copy link

@LeoPote last I checked on this, it looked like keycloak.js, completely dropped the scope all together. (at least the version I was looking at)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue/PR is an enhancement or new feature.
Projects
None yet
Development

No branches or pull requests

4 participants