Search code examples
c#asp.net-coreasp.net-core-mvcidentityserver4saaskit

Using mutitenancy with identity server 4


We are trying to use saaskit with Identity Server 4 to make multi-tenant application using Identity Server.

Our requirement is as follows.

We have common login page for all clients. However, once client user will get logged in, we are showing the client list to which user has access and on click of client name user will be redirected to respective clients dashboard.

To achieve this we have used below kind of approach.

  1. Login, client list page added in Identity Server project.
  2. When user clicks desired client, it will be redirected to client project(Here we have already set the dashboard url to client).
  3. In client project based on url(For e.g. clientname/home/dashboard) we are resolving the client using saaskit.
  4. So now it is supposed to show the dashboard page, however we have added [Authorize] attribute to the dashboard method because of this it is trying to call account/login method. But here, the method is not called from server project instead it is searching in client project(which is not available) and resulting into error.Also, trying to append ReturnUrl of dashboard to it.

So, can anyone tell what is the issue and is the project structure is correct ?


Solution

  • When you click on the Client link in the IdentityServer portal, it should bounce you over to your client, which should then immediately begin the login process by bouncing you back through IdentityServer and finally back to the Client again.

    IdentityServer --> Client --> IdentityServer --> Client.

    Remember, just because the User has signed into IdentityServer, doesn't mean they have an cookie for the client application. The sign-in process/redirects still have to be performed.