From decda4b1a80bbd73d46da4658a9ec243fe3d0851 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 11 Jan 2020 21:28:20 -0700 Subject: [PATCH] release: v5.0.0 **5.0.0** * Added support for ASP.NET Core 3.1. * Major refactor of how Entity Framework multitenant data isolation works. No longer need to derive from `MultiTenantDbContext` greatly improving flexibility. `IdentityMultiTenantDbContext` reworked under this new model and no longer requires or recommends use of multitenant support classes, e.g. `MultiTenantIdentityUser`. Attempted to minimize impact, but if using `IdentityMultiTenantDbContext` **this may be a breaking change!** Thanks **@GordonBlahut**! * Simplified `EFCoreStore` to use `TenantInfo` directly. **This is a breaking change!** * Fixed a bug with user id not being set correctly in legacy 'IdentityMultiTenantDbContext'. * Added `ConfigurationStore` to load tenant information from app configuration. The store is read-only in code, but changes in configuration (e.g. appsettings.json) are picked up at runtime. Updated most sample projects to use this store. * Deprecated `InMemoryStore` functionality that reads from configuration. * Added `HttpRemoteStore` which will make an http request to get a `TenantInfo` object. It can be extended with `DelegatingHandler`s (i.e. to add authentication headers). Added sample projects for this store. Thanks to **@colindekker**! * Fixed an exception with OpenIdConnect remote authentication if "state" is not returned from the identity provider. The new behavior will result in no tenant found for the request. * Updated samples. * Updated documentation. * Updated unit tests. --- CHANGELOG.md | 13 +++++++++++++ Directory.Build.props | 5 ++--- README.md | 4 ++-- docs/Introduction.md | 13 +++++++------ .../AuthenticationOptionsSample.csproj | 4 ++-- .../Views/Home/Index.cshtml | 4 ++-- .../BasePathStrategySample.csproj | 4 ++-- .../DataIsolationSample/DataIsolationSample.csproj | 4 ++-- .../DelegateStrategySample.csproj | 4 ++-- .../EFCoreStoreSample/EFCoreStoreSample.csproj | 4 ++-- .../FallbackStrategySample.csproj | 6 +++++- .../HostStrategySample/HostStrategySample.csproj | 4 ++-- .../IdentityDataIsolationSample.csproj | 4 ++-- .../RouteStrategySample/RouteStrategySample.csproj | 4 ++-- .../SharedLoginSample/SharedLoginSample.csproj | 4 ++-- .../StaticStrategySample.csproj | 4 ++-- .../AuthenticationOptionsSample.csproj | 4 ++-- .../Views/Home/Index.cshtml | 4 ++-- .../BasePathStrategySample.csproj | 4 ++-- .../DataIsolationSample/DataIsolationSample.csproj | 4 ++-- .../DelegateStrategySample.csproj | 4 ++-- .../EFCoreStoreSample/EFCoreStoreSample.csproj | 4 ++-- .../HostStrategySample/HostStrategySample.csproj | 4 ++-- .../HttpRemoteStoreSample.csproj | 4 ++-- .../HttpRemoteStoreSampleServer.csproj | 4 ++-- .../IdentityDataIsolationSample.csproj | 4 ++-- .../RouteStrategySample/RouteStrategySample.csproj | 4 ++-- .../StaticStrategySample.csproj | 4 ++-- 28 files changed, 75 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cca8533..9fc085d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,17 @@ ## Version +**5.0.0** +* Added support for ASP.NET Core 3.1. +* Major refactor of how Entity Framework multitenant data isolation works. No longer need to derive from `MultiTenantDbContext` greatly improving flexibility. `IdentityMultiTenantDbContext` reworked under this new model and no longer requires or recommends use of multitenant support classes, e.g. `MultiTenantIdentityUser`. Attempted to minimize impact, but if using `IdentityMultiTenantDbContext` **this may be a breaking change!** Thanks **@GordonBlahut**! +* Simplified `EFCoreStore` to use `TenantInfo` directly. **This is a breaking change!** +* Fixed a bug with user id not being set correctly in legacy 'IdentityMultiTenantDbContext'. +* Added `ConfigurationStore` to load tenant information from app configuration. The store is read-only in code, but changes in configuration (e.g. appsettings.json) are picked up at runtime. Updated most sample projects to use this store. +* Deprecated `InMemoryStore` functionality that reads from configuration. +* Added `HttpRemoteStore` which will make an http request to get a `TenantInfo` object. It can be extended with `DelegatingHandler`s (i.e. to add authentication headers). Added sample projects for this store. Thanks to **@colindekker**! +* Fixed an exception with OpenIdConnect remote authentication if "state" is not returned from the identity provider. The new behavior will result in no tenant found for the request. +* Updated samples. +* Updated documentation. +* Updated unit tests. + **4.0.0** * Added support for ASP.NET Core 3! Valid project targets are `netcoreapp3.0`, `netcoreapp2.0`, and `netcoreapp2.1`. * Added a sample app for ASP.NET 3 highlighting the route strategy improvements due to the endpoint routing mechanism. diff --git a/Directory.Build.props b/Directory.Build.props index 6d5ce184..29df15b9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,9 +1,8 @@ - false - 4.0.0 + 5.0.0 Andrew White - Copyright ©2019 Andrew White + Copyright ©2020 Andrew White https://www.finbuckle.com/images/favicon-64x64.png Apache-2.0 https://www.finbuckle.com diff --git a/README.md b/README.md index d99d3f0c..c725a4ad 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Finbuckle.MultiTenant 4.0.0 +# Finbuckle.MultiTenant 5.0.0 Finbuckle.MultiTenant is a multitenancy library for ASP.NET Core. It provides functionality for tenant resolution, per-tenant app configuration, and per-tenant data isolation. -ASP.NET Core 3.0, 2.2, and 2.1 are supported. +ASP.NET Core 3.1, 3.0, and 2.1 are actively supported. See [https://www.finbuckle.com](https://www.finbuckle.com) for more details and documentation. diff --git a/docs/Introduction.md b/docs/Introduction.md index 4d090bcd..156201c2 100644 --- a/docs/Introduction.md +++ b/docs/Introduction.md @@ -1,19 +1,18 @@ # Finbuckle.MultiTenant Docs -Current version: 4.0.0 +Current version: 5.0.0 [Version History](https://github.com/Finbuckle/Finbuckle.MultiTenant/blob/master/CHANGELOG.md) Finbuckle.MultiTenant is a multitenancy library for ASP.NET Core. It provides functionality for tenant resolution, per-tenant app configuration, and per-tenant data isolation. -ASP.NET Core 3.0, 2.2, and 2.1 are supported. +ASP.NET Core 3.1, 3.0, and 2.1 are actively supported. ## Community Check out the [GitHub repository](https://github.com/Finbuckle/Finbuckle.MultiTenant) to ask a question, make a request, or check out the code! ## Sample Projects -In addition to this documentation a variety of sample projects are available. Be sure to read the information on the index page of each -sample and the code comments in the `Startup` class. +In addition to this documentation a variety of sample projects are available. Be sure to read the information on the index page of each sample and the code comments in the `Startup` class. -**ASP.NET Core 3.0 Samples** +**ASP.NET Core 3.1 Samples** [Authentication Options Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%203/AuthenticationOptionsSample) @@ -27,13 +26,15 @@ sample and the code comments in the `Startup` class. [Host Strategy Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%203/HostStrategySample) +[Http Remote Store Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%203/HttpRemoteStoreSample) + [Identity DataIsolation Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%203/IdentityDataIsolationSample) [Route Strategy Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%203/RouteStrategySample) [Static Strategy Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%203/StaticStrategySample) -**ASP.NET Core 2.2 Samples** +**ASP.NET Core 2.1 Samples** [Authentication Options Sample](https://github.com/Finbuckle/Finbuckle.MultiTenant/tree/master/samples/ASP.NET%20Core%202/AuthenticationOptionsSample) diff --git a/samples/ASP.NET Core 2/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj b/samples/ASP.NET Core 2/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj index b6d5ba51..228ff770 100644 --- a/samples/ASP.NET Core 2/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj +++ b/samples/ASP.NET Core 2/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj @@ -7,10 +7,10 @@ - + - + diff --git a/samples/ASP.NET Core 2/AuthenticationOptionsSample/Views/Home/Index.cshtml b/samples/ASP.NET Core 2/AuthenticationOptionsSample/Views/Home/Index.cshtml index 91962b8a..1f49c19a 100644 --- a/samples/ASP.NET Core 2/AuthenticationOptionsSample/Views/Home/Index.cshtml +++ b/samples/ASP.NET Core 2/AuthenticationOptionsSample/Views/Home/Index.cshtml @@ -66,7 +66,7 @@ else

services.AddMultiTenant()... // Setup host and strategy...
     WithRemoteAuthentication(). // Important!
-    WithPerTenantOptions((options, tenantInfo) =>
+    WithPerTenantOptions<AuthenticationOptions>((options, tenantInfo) =>
     {
         // Allow each tenant to have a different default challenge scheme.
         if (tenantInfo.Items.TryGetValue("ChallengeScheme", out object challengeScheme))
@@ -74,7 +74,7 @@ else
             options.DefaultChallengeScheme = (string)challengeScheme;
         }
     }).
-    WithPerTenantOptions((options, tenantInfo) =>
+    WithPerTenantOptions<CookieAuthenticationOptions>((options, tenantInfo) =>
     {
         // Set a unique cookie name for this tenant.
         options.Cookie.Name = tenantInfo.Id + "-cookie";
diff --git a/samples/ASP.NET Core 2/BasePathStrategySample/BasePathStrategySample.csproj b/samples/ASP.NET Core 2/BasePathStrategySample/BasePathStrategySample.csproj
index 48f0a0b3..6df6109e 100644
--- a/samples/ASP.NET Core 2/BasePathStrategySample/BasePathStrategySample.csproj	
+++ b/samples/ASP.NET Core 2/BasePathStrategySample/BasePathStrategySample.csproj	
@@ -6,10 +6,10 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
 
\ No newline at end of file
diff --git a/samples/ASP.NET Core 2/DataIsolationSample/DataIsolationSample.csproj b/samples/ASP.NET Core 2/DataIsolationSample/DataIsolationSample.csproj
index ed9a4373..5446ec09 100644
--- a/samples/ASP.NET Core 2/DataIsolationSample/DataIsolationSample.csproj	
+++ b/samples/ASP.NET Core 2/DataIsolationSample/DataIsolationSample.csproj	
@@ -7,10 +7,10 @@
   
     
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 2/DelegateStrategySample/DelegateStrategySample.csproj b/samples/ASP.NET Core 2/DelegateStrategySample/DelegateStrategySample.csproj
index 74d14754..93bd19ca 100644
--- a/samples/ASP.NET Core 2/DelegateStrategySample/DelegateStrategySample.csproj	
+++ b/samples/ASP.NET Core 2/DelegateStrategySample/DelegateStrategySample.csproj	
@@ -6,10 +6,10 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 2/EFCoreStoreSample/EFCoreStoreSample.csproj b/samples/ASP.NET Core 2/EFCoreStoreSample/EFCoreStoreSample.csproj
index cd761536..a7476f1c 100644
--- a/samples/ASP.NET Core 2/EFCoreStoreSample/EFCoreStoreSample.csproj	
+++ b/samples/ASP.NET Core 2/EFCoreStoreSample/EFCoreStoreSample.csproj	
@@ -7,10 +7,10 @@
   
     
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 2/FallbackStrategySample/FallbackStrategySample.csproj b/samples/ASP.NET Core 2/FallbackStrategySample/FallbackStrategySample.csproj
index ab3577bb..93bd19ca 100644
--- a/samples/ASP.NET Core 2/FallbackStrategySample/FallbackStrategySample.csproj	
+++ b/samples/ASP.NET Core 2/FallbackStrategySample/FallbackStrategySample.csproj	
@@ -6,6 +6,10 @@
 
   
     
-    
+    
+  
+
+  
+    
   
 
diff --git a/samples/ASP.NET Core 2/HostStrategySample/HostStrategySample.csproj b/samples/ASP.NET Core 2/HostStrategySample/HostStrategySample.csproj
index 07ca7554..1b262af8 100644
--- a/samples/ASP.NET Core 2/HostStrategySample/HostStrategySample.csproj	
+++ b/samples/ASP.NET Core 2/HostStrategySample/HostStrategySample.csproj	
@@ -6,11 +6,11 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
   
 
diff --git a/samples/ASP.NET Core 2/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj b/samples/ASP.NET Core 2/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj
index 8b5babb1..b571a609 100644
--- a/samples/ASP.NET Core 2/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj	
+++ b/samples/ASP.NET Core 2/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj	
@@ -8,11 +8,11 @@
   
     
     
-    
+    
   
 
   
-    
+    
   
 
 
diff --git a/samples/ASP.NET Core 2/RouteStrategySample/RouteStrategySample.csproj b/samples/ASP.NET Core 2/RouteStrategySample/RouteStrategySample.csproj
index 74d14754..93bd19ca 100644
--- a/samples/ASP.NET Core 2/RouteStrategySample/RouteStrategySample.csproj	
+++ b/samples/ASP.NET Core 2/RouteStrategySample/RouteStrategySample.csproj	
@@ -6,10 +6,10 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 2/SharedLoginSample/SharedLoginSample.csproj b/samples/ASP.NET Core 2/SharedLoginSample/SharedLoginSample.csproj
index d54e40f0..139110aa 100644
--- a/samples/ASP.NET Core 2/SharedLoginSample/SharedLoginSample.csproj	
+++ b/samples/ASP.NET Core 2/SharedLoginSample/SharedLoginSample.csproj	
@@ -8,11 +8,11 @@
     
     
     
-    
+    
   
 
   
-    
+    
   
 
 
diff --git a/samples/ASP.NET Core 2/StaticStrategySample/StaticStrategySample.csproj b/samples/ASP.NET Core 2/StaticStrategySample/StaticStrategySample.csproj
index 74d14754..93bd19ca 100644
--- a/samples/ASP.NET Core 2/StaticStrategySample/StaticStrategySample.csproj	
+++ b/samples/ASP.NET Core 2/StaticStrategySample/StaticStrategySample.csproj	
@@ -6,10 +6,10 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj b/samples/ASP.NET Core 3/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj
index c8cdc935..3e78ac25 100644
--- a/samples/ASP.NET Core 3/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj	
+++ b/samples/ASP.NET Core 3/AuthenticationOptionsSample/AuthenticationOptionsSample.csproj	
@@ -9,10 +9,10 @@
     
     
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/AuthenticationOptionsSample/Views/Home/Index.cshtml b/samples/ASP.NET Core 3/AuthenticationOptionsSample/Views/Home/Index.cshtml
index 91962b8a..1f49c19a 100644
--- a/samples/ASP.NET Core 3/AuthenticationOptionsSample/Views/Home/Index.cshtml	
+++ b/samples/ASP.NET Core 3/AuthenticationOptionsSample/Views/Home/Index.cshtml	
@@ -66,7 +66,7 @@ else
         

services.AddMultiTenant()... // Setup host and strategy...
     WithRemoteAuthentication(). // Important!
-    WithPerTenantOptions((options, tenantInfo) =>
+    WithPerTenantOptions<AuthenticationOptions>((options, tenantInfo) =>
     {
         // Allow each tenant to have a different default challenge scheme.
         if (tenantInfo.Items.TryGetValue("ChallengeScheme", out object challengeScheme))
@@ -74,7 +74,7 @@ else
             options.DefaultChallengeScheme = (string)challengeScheme;
         }
     }).
-    WithPerTenantOptions((options, tenantInfo) =>
+    WithPerTenantOptions<CookieAuthenticationOptions>((options, tenantInfo) =>
     {
         // Set a unique cookie name for this tenant.
         options.Cookie.Name = tenantInfo.Id + "-cookie";
diff --git a/samples/ASP.NET Core 3/BasePathStrategySample/BasePathStrategySample.csproj b/samples/ASP.NET Core 3/BasePathStrategySample/BasePathStrategySample.csproj
index cd80c468..90f4a570 100644
--- a/samples/ASP.NET Core 3/BasePathStrategySample/BasePathStrategySample.csproj	
+++ b/samples/ASP.NET Core 3/BasePathStrategySample/BasePathStrategySample.csproj	
@@ -5,10 +5,10 @@
   
 
   
-    
+    
   
 
   
-    
+    
   
 
\ No newline at end of file
diff --git a/samples/ASP.NET Core 3/DataIsolationSample/DataIsolationSample.csproj b/samples/ASP.NET Core 3/DataIsolationSample/DataIsolationSample.csproj
index dc85393f..53d5ebdd 100644
--- a/samples/ASP.NET Core 3/DataIsolationSample/DataIsolationSample.csproj	
+++ b/samples/ASP.NET Core 3/DataIsolationSample/DataIsolationSample.csproj	
@@ -6,10 +6,10 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/DelegateStrategySample/DelegateStrategySample.csproj b/samples/ASP.NET Core 3/DelegateStrategySample/DelegateStrategySample.csproj
index fbd364c8..68495314 100644
--- a/samples/ASP.NET Core 3/DelegateStrategySample/DelegateStrategySample.csproj	
+++ b/samples/ASP.NET Core 3/DelegateStrategySample/DelegateStrategySample.csproj	
@@ -5,10 +5,10 @@
   
 
   
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/EFCoreStoreSample/EFCoreStoreSample.csproj b/samples/ASP.NET Core 3/EFCoreStoreSample/EFCoreStoreSample.csproj
index 58296e27..21650905 100644
--- a/samples/ASP.NET Core 3/EFCoreStoreSample/EFCoreStoreSample.csproj	
+++ b/samples/ASP.NET Core 3/EFCoreStoreSample/EFCoreStoreSample.csproj	
@@ -7,10 +7,10 @@
   
     
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/HostStrategySample/HostStrategySample.csproj b/samples/ASP.NET Core 3/HostStrategySample/HostStrategySample.csproj
index 07b2928b..0a8c8029 100644
--- a/samples/ASP.NET Core 3/HostStrategySample/HostStrategySample.csproj	
+++ b/samples/ASP.NET Core 3/HostStrategySample/HostStrategySample.csproj	
@@ -5,11 +5,11 @@
   
 
   
-    
+    
   
 
   
-    
+    
   
   
 
diff --git a/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSample/HttpRemoteStoreSample.csproj b/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSample/HttpRemoteStoreSample.csproj
index e08c28c9..cd65ed83 100644
--- a/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSample/HttpRemoteStoreSample.csproj	
+++ b/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSample/HttpRemoteStoreSample.csproj	
@@ -6,10 +6,10 @@
 
   
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSampleServer/HttpRemoteStoreSampleServer.csproj b/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSampleServer/HttpRemoteStoreSampleServer.csproj
index 70b1efd2..02f9e8dc 100644
--- a/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSampleServer/HttpRemoteStoreSampleServer.csproj	
+++ b/samples/ASP.NET Core 3/HttpRemoteStoreSample/HttpRemoteStoreSampleServer/HttpRemoteStoreSampleServer.csproj	
@@ -5,11 +5,11 @@
   
 
   
-    
+    
   
 
   
-    
+    
   
   
 
diff --git a/samples/ASP.NET Core 3/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj b/samples/ASP.NET Core 3/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj
index 0348e5df..efe4a613 100644
--- a/samples/ASP.NET Core 3/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj	
+++ b/samples/ASP.NET Core 3/IdentityDataIsolationSample/IdentityDataIsolationSample.csproj	
@@ -10,10 +10,10 @@
     
     
     
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/RouteStrategySample/RouteStrategySample.csproj b/samples/ASP.NET Core 3/RouteStrategySample/RouteStrategySample.csproj
index fbd364c8..68495314 100644
--- a/samples/ASP.NET Core 3/RouteStrategySample/RouteStrategySample.csproj	
+++ b/samples/ASP.NET Core 3/RouteStrategySample/RouteStrategySample.csproj	
@@ -5,10 +5,10 @@
   
 
   
-    
+    
   
 
   
-    
+    
   
 
diff --git a/samples/ASP.NET Core 3/StaticStrategySample/StaticStrategySample.csproj b/samples/ASP.NET Core 3/StaticStrategySample/StaticStrategySample.csproj
index fbd364c8..68495314 100644
--- a/samples/ASP.NET Core 3/StaticStrategySample/StaticStrategySample.csproj	
+++ b/samples/ASP.NET Core 3/StaticStrategySample/StaticStrategySample.csproj	
@@ -5,10 +5,10 @@
   
 
   
-    
+    
   
 
   
-    
+