diff --git a/docs/en/Migration-Guides/OpenIddict4-to-5.md b/docs/en/Migration-Guides/OpenIddict4-to-5.md new file mode 100644 index 0000000000..21bfc0adee --- /dev/null +++ b/docs/en/Migration-Guides/OpenIddict4-to-5.md @@ -0,0 +1,108 @@ +# OpenIddict 4.x to 5.x Migration Guide + +The 5.0 release of OpenIddict is a major release that introduces breaking changes. + +Check this blog [Introducing native applications, per-client token lifetimes and client assertions support in OpenIddict 5.0 preview1](https://kevinchalet.com/2023/10/20/introducing-native-applications-per-client-token-lifetimes-and-client-assertions-support-in-openiddict-5-0-preview1/) for the new features introduced in OpenIddict 5.0. + +I will show the changes you need to make to do the migration. + +> Please backup your database before doing the migration. + +## OpenIddictApplication changes + +1. The `Type(string)` of the `OpenIddictApplication` has been renamed to `ClientType(string)`. +2. The `ApplicationType(string)` as been added to the `OpenIddictApplication` entity. +3. The `JsonWebKeySet(string)` as been added to the `OpenIddictApplication` entity. +4. The `Settings(string)` as been added to the `OpenIddictApplication` entity. + +The new migration looks like this: + +````csharp +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace OpenIddict.Demo.Server.Migrations +{ + /// + public partial class openiddict5 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "Type", + table: "OpenIddictApplications", + newName: "ClientType"); + + migrationBuilder.AddColumn( + name: "ApplicationType", + table: "OpenIddictApplications", + type: "nvarchar(50)", + maxLength: 50, + nullable: true); + + migrationBuilder.AddColumn( + name: "JsonWebKeySet", + table: "OpenIddictApplications", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Settings", + table: "OpenIddictApplications", + type: "nvarchar(max)", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ApplicationType", + table: "OpenIddictApplications"); + + migrationBuilder.DropColumn( + name: "JsonWebKeySet", + table: "OpenIddictApplications"); + + migrationBuilder.DropColumn( + name: "Settings", + table: "OpenIddictApplications"); + + migrationBuilder.RenameColumn( + name: "ClientType", + table: "OpenIddictApplications", + newName: "Type"); + } + } +} +```` + +## OpenIddictApplicationModel changes + +1. The `Type(string)` of the `OpenIddictApplicationModel` has been renamed to `ClientType(string)`. +2. The `ApplicationType(string)` as been added to the `OpenIddictApplicationModel` entity. +3. The `JsonWebKeySet`([JsonWebKeySet](https://learn.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.jsonwebkeyset)) as been added to the `OpenIddictApplicationModel` entity. +4. The `Settings(string)` as been added to the `OpenIddictApplicationModel` entity. + +## OpenIddictApplicationDescriptor changes + +You have to change the `Type` to `ClientType` when creating a new `OpenIddictApplicationDescriptor`. + +````csharp +var application = new AbpApplicationDescriptor { + ClientId = name, +- Type = type, ++ ClientType = type, + ClientSecret = secret, + ConsentType = consentType, + DisplayName = displayName, +```` + +## OpenIddict Pro module UI changes + +You can change the `ApplicationType` when creating/editing a OpenIddict's application, also set time life of the tokens for each application. + +![ropeniddict-pro-application-modal](images/openiddict-pro-application-modal.png) +![openiddict-pro-application-timelife-modal](images/openiddict-pro-application-timelife-modal.png) diff --git a/docs/en/Migration-Guides/images/openiddict-pro-application-modal.png b/docs/en/Migration-Guides/images/openiddict-pro-application-modal.png new file mode 100644 index 0000000000..10fe722053 Binary files /dev/null and b/docs/en/Migration-Guides/images/openiddict-pro-application-modal.png differ diff --git a/docs/en/Migration-Guides/images/openiddict-pro-application-timelife-modal.png b/docs/en/Migration-Guides/images/openiddict-pro-application-timelife-modal.png new file mode 100644 index 0000000000..b951c1f93d Binary files /dev/null and b/docs/en/Migration-Guides/images/openiddict-pro-application-timelife-modal.png differ