Open Closed

Issue when login as a tenant #1020


User avatar
0
MarekH created

ABP Framework version: v4.2.0 UI type: Angular DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): yes Exception message and stack trace: Steps to reproduce the issue:

Hello, we are trying to resolve issue related to switching between host and customer DBs..

Our solution is deployed with host DB and separated Identity Server (IS) (running as separate microservice and using host DB). We would like to use Multi-tenant solution with separate DB for each tenant. We are trying to use centralized IS to handle all requests. We already created our custom override of CreateAsync method in TenantAppService to create some custom actions during tenant creation (tenant DB creation, running some seed methods, etc.). UpdateDefaultConnectionStringAsync is called too in our method to update SaasTenantConnectionStrings table in host DB.

So when we create new tenant from host app, there is a new tenant DB, SaasTenantConnectionStrings table in host DB contains correct connection string too. We have also a wildcard rule in IdentityServerClientRedirectUris table in IS.

When we access https://tenant1.ourappurl/ and click Login, we are redirected to the correct IS page with login. My question is: Can we identify the tenant using the domain resolver to direct to the tenant db once the authorization is completed on the centralised IS server?

Thanks a lot!


34 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @AndrewT

    Use subdomain to confirm current tenant is no problem. https://docs.abp.io/en/abp/latest/Multi-Tenancy#domain-subdomain-tenant-resolver

  • User Avatar
    0
    AndrewT created

    Hi @maliming, yes, but we'd like a demo for multi-tenant that shows how to login to tenant without having to create subdomains, and where the username is unique, as per question in 917.

    It would be good if we could have an explanation/demo for that. :)

    Andrew

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @AndrewT

    I will prepare a demo.

    https://github.com/abpframework/abp/issues/8281

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @AndrewT

    https://github.com/abpframework/abp-samples/tree/master/SignInWithoutSpecifyingTenant

  • User Avatar
    0
    AndrewT created

    Cheers @Maliming ! - Now can you fix the login/impersonate a tenant user from the host side too like in ASPNetZero.. :)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    We will work on it.

  • User Avatar
    0
    MarekH created

    We will work on it.

    Hello Maliming

    We are waiting for demo ,We are using separate identity server with angular as a front end. Do we have demo for that?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi MarekH

    Angular and MVC will perfectly support the use of subdomains to resolve tenants and work with the Identity Server after v4.3 released.

    https://github.com/maliming/DomainTenantResolver

  • User Avatar
    0
    MarekH created

    after

    Ok thank you. For the quick response ,

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35