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 19f3077a..77c01cf1 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -8,11 +8,11 @@ 3.0.2 4.4.0 6.1.3 - 10.3.0 + 2018.2.1 10.0.2 1.0.1 - 1.4.0 - 2.6.1 + 1.5.0 + 2.7.0 4.7.63 2.0.0 2.0.0 diff --git a/samples/Mvc.Server/Controllers/UserinfoController.cs b/samples/Mvc.Server/Controllers/UserinfoController.cs index 078bb33f..9cc5d84c 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(AuthenticationSchemes = OAuthValidationDefaults.AuthenticationScheme)] + [Authorize(AuthenticationSchemes = 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 4c09652b..d8f1105d 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 76cea3b6..8b0ba466 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.CurrentValue.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 cdb0002c..64b2d00f 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.CurrentValue.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 6f67aa56..558c88de 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.CurrentValue.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 f41f0542..34de4e89 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.CurrentValue.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 93d70cef..75ba7a31 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));