Base solution for your next web application
Open Closed

Can't get subdomain tenant resolution to work during SignIn in staging and production #8028


User avatar
0
dev1_premierpoint created

I'm working through the Phonebook example and can't get subdomain tenant resolution during SignIn to work in either a staging or production environment.

I've tried defining the MultiTenancy.DomainFormat Property in the module class:

That matches with the configuration of the WebSiteRootAddress in appsettings.Staging.json and appsettings.Production.json:

Multi-tenancy works in general with this setup, but only by using the "Tenant Switcher", which is not what I want in production.

I just want the application to match the subdomain in the Url to the value of TenantId in the Tenant table in the database, and execute the login credentials against the users that belong to that tenant.

Secondarily, I prefer that the Tenanet Switcher control not even show up on the Sign In page in production (assuming subdomain tenant resolution is working properly).


3 Answer(s)
  • User Avatar
    0
    dev1_premierpoint created

    Continuing to grind on this and it is now looking like I made the change to the wrong Module class.

    I changed PhoneBookDemoWebCoreModule.cs.

    It looks like I should have changed PhoneBookDemoWebMvcModule.cs, instead.

    (Whew, this N-layer architecture of ASP.Net Zero\Abp, can sure get confusing at times.)

    In the WebMvcModule I ended up commenting out this existing line:

    and replacing it with this line:

    Its working now in staging and production.  The "Tenant Switcher" is still showing on the Sign In page, but surely I can figure out how to remove it.

    You guys have extensive documentation, true, but your architecture is so complex that it seems that there are still a lot of under-documented areas.   I would say this is one.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @dev1_premierpoint

    Its working now in staging and production. The "Tenant Switcher" is still showing on the Sign In page, but surely I can figure out how to remove it.

    Did you figure it out ?

    You guys have extensive documentation, true, but your architecture is so complex that it seems that there are still a lot of under-documented areas. I would say this is one.

    Thanks for your feedback. We are trying to improve that. Sometimes it is really hard to get out of developer perspective and write those documents from a target developer's point of view :).

  • User Avatar
    0
    dev1_premierpoint created

    Yeah, i got it to work by adding this code to AccountController.cs:

    The View for the Login page already had a check for the DisableTenantChange property of the ViewBag.  So, no change in Login.cshtml was necessary.

    As far as your documentation goes, later that day it occurred to me that I was probably being too hard on you.  I was just frustrated that I was having to keep digging on my own.  Then I realized that is one of the reasons that there is a job description named "Developer". :)