I have a multitenant application where a user can belong to multiple tenants. I'm using Identity-Server 4 for the authentication.
I have two applications Angular and API. When a user is not authenticated, it's being redirected to the Identity-Server and proceeds authentication. Once the ID4 ensures that the client credentials are correct a new access_token is generated and returned to the Angular side. then the Angular checks the tenant ID and if it is not present to the access_token it redirects to the tenant page where a user must select a tenant. Once the tenant ID is selected initLoginFlow is called and the tenant ID is sent to the identity-server side. Identity-Server looks for the tenant ID and if it's found then it issues another access_token that contains the tenant ID.
I have couple of questions:
- Is it possible to call ProfileService on the Identity-Server side from Angular to update the identity_token?
- Is the implementation flow correct?
Is it possible to call ProfileService on the Identity-Server side from Angular to update the identity_token?
wouldn't this be a vulnerability?initLoginFlow
by updating the access_token from SPA once the tenant ID is selected. If yes? What's the relationship between users and tenancy? Can 1 user "be" multiple tenants? if yes. Wouldn't be simpler to set a default|main tenant so you don't have to do the second trip?