diff --git a/README.md b/README.md index cb5fb260..687a6605 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ OpenIddict is based on OpenIddict fully supports the **[code/implicit/hybrid flows](http://openid.net/specs/openid-connect-core-1_0.html)** and the **[client credentials/resource owner password grants](https://tools.ietf.org/html/rfc6749)**. You can also create your own custom grant types. -Note: OpenIddict natively supports **[Entity Framework Core](https://github.com/aspnet/EntityFramework)** and **[Entity Framework 6](https://github.com/aspnet/EntityFramework6)** out-of-the-box, but you can also provide your own stores. +Note: OpenIddict natively supports **[Entity Framework Core](https://www.nuget.org/packages/OpenIddict.EntityFrameworkCore)**, **[Entity Framework 6](https://www.nuget.org/packages/OpenIddict.EntityFramework)** and **[MongoDB](https://www.nuget.org/packages/OpenIddict.MongoDb)** out-of-the-box, but you can also provide your own stores. > Note: **the OpenIddict 2.x packages are only compatible with ASP.NET Core 2.x**. > If your application targets ASP.NET Core 1.x, use the OpenIddict 1.x packages. diff --git a/build/dependencies.props b/build/dependencies.props index 46d982df..ecf205fd 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -9,9 +9,9 @@ 4.1.0 6.1.3 1.2.0 - 10.3.0 + 2018.2.1 9.0.1 - 2.6.1 + 2.7.0 1.6.0 4.7.63 4.0.1 diff --git a/samples/Mvc.Server/Controllers/UserinfoController.cs b/samples/Mvc.Server/Controllers/UserinfoController.cs index 16dc1665..1abb6635 100644 --- a/samples/Mvc.Server/Controllers/UserinfoController.cs +++ b/samples/Mvc.Server/Controllers/UserinfoController.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using AspNet.Security.OAuth.Validation; using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; @@ -7,6 +6,7 @@ using Microsoft.AspNetCore.Mvc; using Mvc.Server.Models; using Newtonsoft.Json.Linq; using OpenIddict.Abstractions; +using OpenIddict.Validation; namespace Mvc.Server.Controllers { @@ -22,7 +22,7 @@ namespace Mvc.Server.Controllers // // GET: /api/userinfo - [Authorize(ActiveAuthenticationSchemes = OAuthValidationDefaults.AuthenticationScheme)] + [Authorize(ActiveAuthenticationSchemes = OpenIddictValidationDefaults.AuthenticationScheme)] [HttpGet("userinfo"), Produces("application/json")] public async Task Userinfo() { diff --git a/src/OpenIddict.MongoDb/OpenIddictMongoDbContext.cs b/src/OpenIddict.MongoDb/OpenIddictMongoDbContext.cs index 6288a79d..39fd5047 100644 --- a/src/OpenIddict.MongoDb/OpenIddictMongoDbContext.cs +++ b/src/OpenIddict.MongoDb/OpenIddictMongoDbContext.cs @@ -87,35 +87,35 @@ namespace OpenIddict.MongoDb // Note: the cancellation token passed as a parameter is deliberately not used here to ensure // the cancellation of a single store operation doesn't prevent the indexes from being created. var applications = database.GetCollection(options.ApplicationsCollectionName); - await applications.Indexes.CreateOneAsync( + await applications.Indexes.CreateOneAsync(new CreateIndexModel( Builders.IndexKeys.Ascending(application => application.ClientId), new CreateIndexOptions { Unique = true - }); + })); - await applications.Indexes.CreateOneAsync( - Builders.IndexKeys.Ascending(application => application.PostLogoutRedirectUris)); + await applications.Indexes.CreateOneAsync(new CreateIndexModel( + Builders.IndexKeys.Ascending(application => application.PostLogoutRedirectUris))); - await applications.Indexes.CreateOneAsync( - Builders.IndexKeys.Ascending(application => application.RedirectUris)); + await applications.Indexes.CreateOneAsync(new CreateIndexModel( + Builders.IndexKeys.Ascending(application => application.RedirectUris))); var scopes = database.GetCollection(options.ScopesCollectionName); - await scopes.Indexes.CreateOneAsync( + await scopes.Indexes.CreateOneAsync(new CreateIndexModel( Builders.IndexKeys.Ascending(scope => scope.Name), new CreateIndexOptions { Unique = true - }); + })); var tokens = database.GetCollection(options.TokensCollectionName); - await tokens.Indexes.CreateOneAsync( + await tokens.Indexes.CreateOneAsync(new CreateIndexModel( Builders.IndexKeys.Ascending(token => token.ReferenceId), new CreateIndexOptions { PartialFilterExpression = Builders.Filter.Exists(token => token.ReferenceId), Unique = true - }); + })); return _database = database; } diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictApplicationStore.cs index 0ea80b0f..3bb980d6 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictApplicationStore.cs @@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.Value.ApplicationsCollectionName); - return await collection.CountAsync(FilterDefinition.Empty); + return await collection.CountDocumentsAsync(FilterDefinition.Empty); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictAuthorizationStore.cs index 6e955e3a..e706e6df 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictAuthorizationStore.cs @@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.Value.AuthorizationsCollectionName); - return await collection.CountAsync(FilterDefinition.Empty); + return await collection.CountDocumentsAsync(FilterDefinition.Empty); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictScopeStore.cs index cf67f4f1..301c631a 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictScopeStore.cs @@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.Value.ScopesCollectionName); - return await collection.CountAsync(FilterDefinition.Empty); + return await collection.CountDocumentsAsync(FilterDefinition.Empty); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictTokenStore.cs index 48e2f4f3..82629066 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictTokenStore.cs @@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.Value.TokensCollectionName); - return await collection.CountAsync(FilterDefinition.Empty); + return await collection.CountDocumentsAsync(FilterDefinition.Empty); } /// diff --git a/test/OpenIddict.MongoDb.Tests/OpenIddictMongoDbContextTests.cs b/test/OpenIddict.MongoDb.Tests/OpenIddictMongoDbContextTests.cs index 098eff9e..be92ba4d 100644 --- a/test/OpenIddict.MongoDb.Tests/OpenIddictMongoDbContextTests.cs +++ b/test/OpenIddict.MongoDb.Tests/OpenIddictMongoDbContextTests.cs @@ -48,7 +48,7 @@ namespace OpenIddict.MongoDb.Tests var provider = services.BuildServiceProvider(); var manager = new Mock>(); - manager.Setup(mock => mock.CreateOneAsync(It.IsAny>(), It.IsAny(), It.IsAny())) + manager.Setup(mock => mock.CreateOneAsync(It.IsAny>(), It.IsAny(), It.IsAny())) .Returns(async delegate { await Task.Delay(TimeSpan.FromMilliseconds(1000));