Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Tenancy Strangeness - Angular CLI / Azure - 4.5.1 #4094


User avatar
0
godrunner created

Using Angular-CLI on Azure version 4.5.1 All it is the basic app with the phonebook implemented. I want to do a proof of concept of everything before I start building the main app, so hosting successfully with a real domain name on Azure is the next step for us. I have the API backend and the angular client app on Azure. (did not bother with the public site for now.)

Everything works very well in testing locally and on Azure, EXCEPT, there is a problem with multitenancy / domain / tenancy logins.

  • If I create a tenant called "test" I can impersonate that tenant from the host account and it appears that everything works as it should from test.mysite.com
  • If go to test.mysite.com I cannot login with the test user, however, I CAN login right there with the host admin account. (which is strange isn’t it?) The test user is activated.
  • I can go to fakesite.mysite.com which has never been created and I can login with the main host password.
  • If I login from these different hostnames, I get the full host account with tenants.

I have checked and double checked. Any ideas??

Thanks!!


8 Answer(s)
  • User Avatar
    0
    XugoWebTeam created

    See my post #4018 basically you will need to write your own codes to set the tenant id base on the url. The template 4.5.1 missed this part. Not sure if it is the same in 4.6.1

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @godrunner,

    Can you share your Host and Angular app setting files ?

    Thanks.

  • User Avatar
    0
    godrunner created

    Thanks @XugoWebTeam. From what you are saying it sounds like a known issue.

    @smcagdas, if this is so, is it fixed in 4.6.1?

    From .core project I have: public const bool MultiTenancyEnabled = true;

    From appsettings.json in .host

    "ServerRootAddress": "http://api.azurewebsites.net", "ClientRootAddress": "http://mysite.com",

    "CorsOrigins": "http://mysite.com"

    From appconfig.json in Angular project

    "remoteServiceBaseUrl": "http://api.azurewebsites.net", "appBaseUrl": "http://{TENANCY_NAME}.mysite.com"

    Thanks!

  • User Avatar
    0
    godrunner created

    So I downloaded a fresh copy of 4.6.1 and deployed it to Azure App Services and I get the exact same behavior as I did in 4.5.1 . So, is the framework just broken then at this time or am I doing something wrong? It all seems to work fine except for multi-tenancy which is a bit of an issue. :-)

    Thanks!

  • User Avatar
    0
    XugoWebTeam created

    the remoteServiceBaseUrl should have {TENANCY_NAME} as well in the appconfig.json in Angular project

    "remoteServiceBaseUrl": "http://{TENANCY_NAME}.api.azurewebsites.net",

    And you need to do a bit of coding to check and set the tenant id.

  • User Avatar
    0
    godrunner created

    Wow, that seems odd. I'll give it a try. I am almost certain it is not documented like that.

    This would be a bug for sure either way.

  • User Avatar
    0
    godrunner created

    Is there any "official" word on this? This is core tenant functionality. Do I need to post this on Github? I don't see this issue there but could have missed it.

    Thank you.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @godrunner,

    It is mentioned here <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Angular#configuration">https://aspnetzero.com/Documents/Develo ... figuration</a>. I have replied your issue on github. We will try to understand if there is a problem according to your feedback.

    Thanks.