Multitenancy Explanation #335
Replies: 1 comment 9 replies
-
Coincidentally there's been a similar discussing going on yesterday on the webapi discord channel. The multitenancy story is indeed still a work in progress. I would personally vote for adapting a library for something like this in stead of trying to roll our own. Finbuckle.MultiTenant seems to be a good one. Tried and tested and even supported by the .NET Foundation. That said, I think you have a few misunderstandings about multi tenancy. About the tenantid/name in the product tenant column. That's actually the tenantkey in our case. But anyway, this should actually not be visible on the Product entity. That Finbuckle library attaches the "tenantId" property as a shadow property to all the entities and takes care of it behind the scenes without it being in the way of the developer... which is a much nicer experience imo. A tenant is never automatically created. Creating a tenant is the responsibility of the owner of the app that rents out its application to that tenant. When a tenant is created, one admin user is automatically provisioned for that tenant which can then be used by that tenant's administrator to create more users or assign roles to users that are registered through the self-register process if that's enabled for that specific tenant. So there's also no data shared between tenants (and there shouldn't be). There's the tenant table itself which could be extended to add more information you want to keep per tenant, but that's it. When you are using AzureAD Authentication, there's an option to specify the RootIssuer in the securitysettings. This should be set to the issuer of the root tenant in AzureId. When someone is logging in from that AzureAD tenant, the local root tenant will automatically be selected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Can someone explain multitenancy in FSH for me? There are a few bits which I do not understand. Once I understand this I am happy to create the documentation. I would like to develop a Saas for fun and this is a great starting point, but multitenancy seems lacking or maybe it's just I don't understand how it is implemented in FSH.
What I understand:
in mind.
tenant
header to set a tenant name in the HTTP request in post man.TenantMiddleware
gets the tenant from the HTTP header key titledtenant
to set the tenant for all API requests.Questions:
products/search
postman collection isbeta
.Functionality I am looking for in multitenancy is:
IdentityService.RegisterAsync()
to create a new tenant and set the user as an admin of the tenant.modelBuilder.ApplyGlobalFilters<IIdentityTenant>(b => EF.Property<string>(b, "root") == Tenant);
.Beta Was this translation helpful? Give feedback.
All reactions