-
Notifications
You must be signed in to change notification settings - Fork 164
Creating a multi tenant app
This page gives an overview of what you need to do to use AuthP's multi-tenant to build a multi-tenant application.
This is explained in Multi tenant configuration.
You need to create a AuthP Tenant (see Multi tenant admin service) for each group of data. Each tenant contains a method called GetTenantDataKey that returns a string used in EF Core's query filter to only show data in the specific AuthP Tenant.
NOTE: if you are using AuthP's HierarchicalTenant, then tenants can link to a 'parent' Tenant - see Multi tenant explained.
When a user logs in AuthP is set up to add a DataKey claim to the logged-in user. This is automatic if you are using the authentication cookie approach, or by AuthP's ITokenBuilder service that can create the JWT Token for you.
The typical way to do this is to create a service that which will capture the ClaimsPrincipal of the currently logged in user and extract the DataKey claim. AuthP registers the GetDataKeyFilterFromUser against the IDataKeyFilter interface.
This allows you to add a IDataKeyFilter parameter to your application's DbContext
- Intro to multi-tenants (ASP.NET video)
- Articles in date order:
- 0. Improved Roles/Permissions
- 1. Setting up the database
- 2. Admin: adding users and tenants
- 3. Versioning your app
- 4. Hierarchical multi-tenant
- 5. Advanced technique with claims
- 6. Sharding multi-tenant setup
- 7. Three ways to add new users
- 8. The design of the sharding data
- 9. Down for maintenance article
- 10: Three ways to refresh claims
- 11. Features of Multilingual service
- 12. Custom databases - Part1
- Videos (old)
- Authentication explained
- Permissions explained
- Roles explained
- AuthUser explained
- Multi tenant explained
- Sharding explained
- How AuthP handles sharding
- How AuthP handles errors
- Languages & cultures explained
- JWT Token refresh explained
- Setup Permissions
- Setup Authentication
- Startup code
- Setup the custom database feature
- JWT Token configuration
- Multi tenant configuration
- Using Permissions
- Using JWT Tokens
- Creating a multi-tenant app
- Supporting multiple languages
- Unit Test your AuthP app