All the changes introduced in this release can be found on GitHub, but here's a recap of the most important ones:
System.Linq.Async was removed from the OpenIddict.Core dependencies
Due to a namespace conflict between Entity Framework Core and System.Linq.Async (maintained by the RX team), we had to remove the dependency the OpenIddict.Core package had on this package, as explained in this GitHub thread.
This is not specific to OpenIddict and other popular libraries like Stripe.NEThad to make a similar decision. As such, I strongly encourage the EF and RX teams to work together to find a better solution to this issue, that has a serious impact on the .NET ecosystem.
The automatic initialization logic was removed from the MongoDB integration
In OpenIddict 1.x/2.x, the 4 collections used by the MongoDB stores were automatically initialized during the first use of the stores.
In OpenIddict 3.0 beta2, this logic was removed for performance reasons and consistency with the other stores. Instead, MongoDB users are encouraged to initialize their database once using a setup script. The following C# script can be used to initialize the 4 OpenIddict collections:
using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using MongoDB.Driver; using OpenIddict.MongoDb; using OpenIddict.MongoDb.Models;
namespaceMongoDbSetup { publicstaticclassProgram { publicstaticasync Task Main(string[] args) { var services = new ServiceCollection(); services.AddOpenIddict() .AddCore(options => options.UseMongoDb());
var provider = services.BuildServiceProvider(); var context = provider.GetRequiredService<IOpenIddictMongoDbContext>(); var options = provider.GetRequiredService<IOptionsMonitor<OpenIddictMongoDbOptions>>().CurrentValue; var database = await context.GetDatabaseAsync(CancellationToken.None);
var applications = database.GetCollection<OpenIddictMongoDbApplication>(options.ApplicationsCollectionName); await applications.Indexes.CreateManyAsync(new[] { new CreateIndexModel<OpenIddictMongoDbApplication>( Builders<OpenIddictMongoDbApplication>.IndexKeys.Ascending(application => application.ClientId), new CreateIndexOptions { Unique = true }),
new CreateIndexModel<OpenIddictMongoDbApplication>( Builders<OpenIddictMongoDbApplication>.IndexKeys.Ascending(application => application.PostLogoutRedirectUris), new CreateIndexOptions { Background = true }),
new CreateIndexModel<OpenIddictMongoDbApplication>( Builders<OpenIddictMongoDbApplication>.IndexKeys.Ascending(application => application.RedirectUris), new CreateIndexOptions { Background = true }) });
var scopes = database.GetCollection<OpenIddictMongoDbScope>(options.ScopesCollectionName); await scopes.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictMongoDbScope>( Builders<OpenIddictMongoDbScope>.IndexKeys.Ascending(scope => scope.Name), new CreateIndexOptions { Unique = true }));
var tokens = database.GetCollection<OpenIddictMongoDbToken>(options.TokensCollectionName); await tokens.Indexes.CreateManyAsync(new[] { new CreateIndexModel<OpenIddictMongoDbToken>( Builders<OpenIddictMongoDbToken>.IndexKeys.Ascending(token => token.ReferenceId), new CreateIndexOptions<OpenIddictMongoDbToken> { // Note: partial filter expressions are not supported on Azure Cosmos DB. // As a workaround, the expression and the unique constraint can be removed. PartialFilterExpression = Builders<OpenIddictMongoDbToken>.Filter.Exists(token => token.ReferenceId), Unique = true }),
With response_mode=form_post being impacted by same-site, some applications are moving back to the query response mode (the default mode for the authorization code flow). To avoid token length issues with clients using response_mode=query and having strict query string limits, authorization codes are now reference tokens in OpenIddict 3.0 beta2.
As part of this change, the options.UseReferenceTokens() setting was also split into options.UseReferenceAccessTokens() and options.UseReferenceRefreshTokens() for more flexibility and options.UseRollingTokens() was renamed to options.UseRollingRefreshTokens() for clarity.
The OpenIddict server Data Protection integration now offers more options
In OpenIddict 3.0 beta1, the OpenIddict server Data Protection integration allowed you to opt out of the ASP.NET Core Data Protection token format when creating new tokens thanks to the options.PreferDefaultTokenFormat() option.
In beta2, this option was split into multiple options for more control over the token format (JWT or Data Protection) used to produce the different token types supported by OpenIddict: