Skip to content

Commit d396d00

Browse files
committed
Version 6.2.0
1 parent 9ff37bb commit d396d00

File tree

6 files changed

+29
-23
lines changed

6 files changed

+29
-23
lines changed

AuthPermissions.AspNetCore.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2222
UpdateToVersion3.md = UpdateToVersion3.md
2323
UpdateToVersion5.md = UpdateToVersion5.md
2424
UpdateToVersion6.md = UpdateToVersion6.md
25+
UpdateToVersion620.md = UpdateToVersion620.md
2526
EndProjectSection
2627
EndProject
2728
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example2.WebApiWithToken.IndividualAccounts", "Example2.WebApiWithToken.IndividualAccounts\Example2.WebApiWithToken.IndividualAccounts.csproj", "{E2667176-A75B-4182-94AF-43D8F0CF989A}"
@@ -54,7 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example7.MvcWebApp.Sharding
5455
EndProject
5556
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example7.SingleLevelShardingOnly", "Example7.SingleLevelShardingOnly\Example7.SingleLevelShardingOnly.csproj", "{9ABE93FC-DE35-47E1-B5B3-27867E350933}"
5657
EndProject
57-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp.AuthP6Upgrade", "ConsoleApp.AuthP6Upgrade\ConsoleApp.AuthP6Upgrade.csproj", "{65A69729-B8E3-4F11-B88F-2AF1AFAB50F2}"
58+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.AuthP6Upgrade", "ConsoleApp.AuthP6Upgrade\ConsoleApp.AuthP6Upgrade.csproj", "{65A69729-B8E3-4F11-B88F-2AF1AFAB50F2}"
5859
EndProject
5960
Global
6061
GlobalSection(SolutionConfigurationPlatforms) = preSolution

AuthPermissions.AspNetCore/CreateNuGetRelease.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>AuthPermissions.AspNetCore</id>
5-
<version>6.1.0</version>
5+
<version>6.2.0</version>
66
<authors>Jon P Smith</authors>
77
<product>AuthPermissions.AspNetCore</product>
88
<copyright>Copyright (c) 2021 Jon P Smith</copyright>
9-
<description>Provides extra authorization and multi-tenant features to a ASP.NET Core application.</description>
9+
<description>Provides extra authorization and multi-tenant features to an ASP.NET Core application.</description>
1010
<releaseNotes>
11-
- New version to support NET 8 - now supports NET 6, 7, and 8
11+
- Updated the "Sign up for a new tenant, with versioning" feature. See the UpdateToVersion620.md file in the GitHub repo for more
1212
</releaseNotes>
1313
<license type="expression">MIT</license>
1414
<projectUrl>https://github.com/JonPSmith/AuthPermissions.AspNetCore</projectUrl>

AuthPermissions.AspNetCore/MultiProjPack.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<!-- See documentation for all the possible values -->
55
<metadata>
66
<id>AuthPermissions.AspNetCore</id>
7-
<version>6.1.0</version>
7+
<version>6.2.0</version>
88
<authors>Jon P Smith</authors>
99
<product>AuthPermissions.AspNetCore</product>
1010
<copyright>Copyright (c) 2021 Jon P Smith</copyright>
11-
<description>Provides extra authorization and multi-tenant features to a ASP.NET Core application.</description>
11+
<description>Provides extra authorization and multi-tenant features to an ASP.NET Core application.</description>
1212
<releaseNotes>
13-
- New version to support NET 8 - now supports NET 6, 7, and 8
13+
- Updated the "Sign up for a new tenant, with versioning" feature. See the UpdateToVersion620.md file in the GitHub repo for more info.
1414
</releaseNotes>
1515
<license type="expression">MIT</license>
1616
<projectUrl>https://github.com/JonPSmith/AuthPermissions.AspNetCore</projectUrl>

AuthPermissions.SupportCode/AddUsersServices/SignInAndCreateTenant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public async Task<IStatusGeneric> SignUpNewTenantAsync(AddNewUserDto newUser, Ad
9090
/// This implements "sign up" feature, where a new user signs up for a new tenant, with versioning.
9191
/// This method creates the tenant using the <see cref="MultiTenantVersionData"/> for this application
9292
/// with backup version information provides by the user.
93-
/// At the same time is creates a new user which is linked to the new tenant.
93+
/// At the same time its creates a new user which is linked to the new tenant.
9494
/// </summary>
9595
/// <param name="newUser">The information for the new user that is signing in</param>
9696
/// <param name="tenantData">The information for how the new tenant should be created</param>

Test/UnitTests/TestSupportCode/TestSignInAndCreateTenant.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using AuthPermissions.SupportCode;
1212
using AuthPermissions.SupportCode.AddUsersServices;
1313
using Example3.MvcWebApp.IndividualAccounts.PermissionsCode;
14-
using Example6.MvcWebApp.Sharding.PermissionsCode;
1514
using Example7.MvcWebApp.ShardingOnly.PermissionsCode;
1615
using LocalizeMessagesAndErrors.UnitTestingCode;
1716
using Microsoft.EntityFrameworkCore;

UpdateToVersion620.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
# Upgrade to the SignInAndCreateTenant service - version 6.2.0
22

3-
AuthP version 6.2.0 has a **BREAKING CHANGE** around the `SignInAndCreateTenant` ???????????????????????
3+
AuthP version 6.2.0 has a **BREAKING CHANGE**, but **ONLY** if you are using the "Sign up for a new tenant, with versioning" (shortened to "Sign up Tenant") feature **AND** your multi-tenant uses [sharding](https://github.com/JonPSmith/AuthPermissions.AspNetCore/wiki/Sharding-explained). Otherwise you can ignore this breaking change.
44

5-
## Why I changed the SignInAndCreateTenant service
5+
The information on updated "Sign up Tenant" feature can be found at:
66

7-
The AuthP library has a service called `SignInAndCreateTenant` which a new user can log in and obtain a new tenant (see the [“Multi-tenant apps with different versions can increase your profits”](https://www.thereformedprogrammer.net/multi-tenant-apps-with-different-versions-can-increase-your-profits/) article for more on this). The current (6.1.0) AuthP version of the `SignInAndCreateTenant` service will try to “undo” the sign up for a tenant so that the user can again but has the following issues.
7+
- [Sign up for a new tenant, with versioning](https://github.com/JonPSmith/AuthPermissions.AspNetCore/wiki/Sign-up-for-a-new-tenant%2C-with-versioning) page in the documentation.
8+
- [Multi-tenant apps with different versions can increase your profits](https://www.thereformedprogrammer.net/multi-tenant-apps-with-different-versions-can-increase-your-profits/) article in my tech blog.
89

9-
- You can’t always undo a new tenant, which means the new user can’t use the multi-tenant app.
10-
- When an Exception occurs its not logged, which makes it to
11-
- The “undo” feature code very complex and uses direct access to the tenant instead of using the AuthTenantAdminService service.
10+
## What changes do I you need to do my existing app?
1211

13-
Therefore I have created a new `SignInAndCreateTenant` service which uses a very different approach to overcome the issues in the 6.1.0 AuthP version. The changes are:
12+
The the `ISignInAndCreateTenant` hasn't changed, but the `IGetDatabaseForNewTenant` service, which you needed to create if your multi-tenant app is using sharding, is replaced it with the `ISignUpGetShardingEntry` service. If you used `IGetDatabaseForNewTenant`, then you will get a compile error and you need to remove your old `ISignUpGetShardingEntry` service with and create a new service that follows the `IGetDatabaseForNewTenant` interface.
1413

15-
- If a fatal error, e.g Exception, occurs:
16-
1. They are logged within the application, with a unique name.
17-
2. The user is given the error unique name and asked to contact the App's support team.
18-
3. A new service is added that allows the support team to create a tenant for a tenant using the version data.
14+
There are two demo versions in the code before release of version 6.2.0 and they have been updated to the new version. See the updated demos below:
1915

20-
The new design won't create a tenant that would stop the user creating the tenant they want because the service uses a temporary name, e.g. "TempSignIn-{tenantId}-{DateTime}" for the tenant and any sharding entry name during setting up the new tenant. Once the process has successfully ended it changes the tenant's name(s) to the name that the user provided. This has two benefits:
16+
- For hybrid sharding see the [`DemoGetDatabaseForNewTenant`](https://github.com/JonPSmith/AuthPermissions.AspNetCore/blob/main/AuthPermissions.SupportCode/DemoGetDatabaseForNewTenant.cs) for the changes.
17+
- For sharding-only see the [`DemoShardOnlyGetDatabaseForNewTenant`](https://github.com/JonPSmith/AuthPermissions.AspNetCore/blob/main/AuthPermissions.SupportCode/DemoShardOnlyGetDatabaseForNewTenant.cs) for the changes.
2118

22-
- This makes the `SignInAndCreateTenant`'s code much simpler (the original code used direct Auth database accesses rather than the normal services such as `IAuthTenantAdminService` and `IGetSetShardingEntries`).
23-
- If an fatal error occurs, then the admin user can look for "TempSignIn...", which might help the admin user to see what went wrong.
19+
## Why I changed the SignInAndCreateTenant service?
2420

21+
The original version of the `SignInAndCreateTenant` service will try to “undo” the sign up for a tenant if there is an error. The original would try to delete the tenant so that the new user can try again. Errors are rare in a properly build application, but problem is sometimes the "undo" doesn't work, which can stop the new user from using your multi-tenant application.
2522

23+
In the 6.2.0 version of the AuthP library the `SignInAndCreateTenant` service works works in a different way: instead of trying to “undo” things it tells the user to ask your support admin to look at the problem, with a unique string to help the support admin to look what went wrong.
2624

25+
The main change is that is uses a unique name (formed from current time) the for the tenant name, tenant database name, etc. and only when the sign up has successfully finished that the correct tenant name.
26+
27+
Other improvements are:
28+
29+
- The original “undo” code was very complex, which makes it hard to cover / test every situations. The new code is much simpler because the unique name makes each "Sign Up" to be different so the new user can again, or talk to your support admin with a reference of what they were trying to do.
30+
- The original code didn't report `Exception`s properly. The new code logs the Exception with the unique name and send the user a message saying they should contact your support team, with the unique name. This allows your support team to find the Exception log and manually set up the new user.
31+
32+
END

0 commit comments

Comments
 (0)