Browse Source

Backport the dependencies changes to OpenIddict 1.x

pull/670/head
Kévin Chalet 8 years ago
parent
commit
7956e55380
  1. 2
      README.md
  2. 4
      build/dependencies.props
  3. 4
      samples/Mvc.Server/Controllers/UserinfoController.cs
  4. 20
      src/OpenIddict.MongoDb/OpenIddictMongoDbContext.cs
  5. 2
      src/OpenIddict.MongoDb/Stores/OpenIddictApplicationStore.cs
  6. 2
      src/OpenIddict.MongoDb/Stores/OpenIddictAuthorizationStore.cs
  7. 2
      src/OpenIddict.MongoDb/Stores/OpenIddictScopeStore.cs
  8. 2
      src/OpenIddict.MongoDb/Stores/OpenIddictTokenStore.cs
  9. 2
      test/OpenIddict.MongoDb.Tests/OpenIddictMongoDbContextTests.cs

2
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.

4
build/dependencies.props

@ -9,9 +9,9 @@
<DataAnnotationsVersion>4.1.0</DataAnnotationsVersion>
<EntityFrameworkVersion>6.1.3</EntityFrameworkVersion>
<ImmutableCollectionsVersion>1.2.0</ImmutableCollectionsVersion>
<JetBrainsVersion>10.3.0</JetBrainsVersion>
<JetBrainsVersion>2018.2.1</JetBrainsVersion>
<JsonNetVersion>9.0.1</JsonNetVersion>
<MongoDbVersion>2.6.1</MongoDbVersion>
<MongoDbVersion>2.7.0</MongoDbVersion>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<MoqVersion>4.7.63</MoqVersion>
<QueryableVersion>4.0.1</QueryableVersion>

4
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<IActionResult> Userinfo()
{

20
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<OpenIddictApplication>(options.ApplicationsCollectionName);
await applications.Indexes.CreateOneAsync(
await applications.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictApplication>(
Builders<OpenIddictApplication>.IndexKeys.Ascending(application => application.ClientId),
new CreateIndexOptions
{
Unique = true
});
}));
await applications.Indexes.CreateOneAsync(
Builders<OpenIddictApplication>.IndexKeys.Ascending(application => application.PostLogoutRedirectUris));
await applications.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictApplication>(
Builders<OpenIddictApplication>.IndexKeys.Ascending(application => application.PostLogoutRedirectUris)));
await applications.Indexes.CreateOneAsync(
Builders<OpenIddictApplication>.IndexKeys.Ascending(application => application.RedirectUris));
await applications.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictApplication>(
Builders<OpenIddictApplication>.IndexKeys.Ascending(application => application.RedirectUris)));
var scopes = database.GetCollection<OpenIddictScope>(options.ScopesCollectionName);
await scopes.Indexes.CreateOneAsync(
await scopes.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictScope>(
Builders<OpenIddictScope>.IndexKeys.Ascending(scope => scope.Name),
new CreateIndexOptions
{
Unique = true
});
}));
var tokens = database.GetCollection<OpenIddictToken>(options.TokensCollectionName);
await tokens.Indexes.CreateOneAsync(
await tokens.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictToken>(
Builders<OpenIddictToken>.IndexKeys.Ascending(token => token.ReferenceId),
new CreateIndexOptions<OpenIddictToken>
{
PartialFilterExpression = Builders<OpenIddictToken>.Filter.Exists(token => token.ReferenceId),
Unique = true
});
}));
return _database = database;
}

2
src/OpenIddict.MongoDb/Stores/OpenIddictApplicationStore.cs

@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb
var database = await Context.GetDatabaseAsync(cancellationToken);
var collection = database.GetCollection<TApplication>(Options.Value.ApplicationsCollectionName);
return await collection.CountAsync(FilterDefinition<TApplication>.Empty);
return await collection.CountDocumentsAsync(FilterDefinition<TApplication>.Empty);
}
/// <summary>

2
src/OpenIddict.MongoDb/Stores/OpenIddictAuthorizationStore.cs

@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb
var database = await Context.GetDatabaseAsync(cancellationToken);
var collection = database.GetCollection<TAuthorization>(Options.Value.AuthorizationsCollectionName);
return await collection.CountAsync(FilterDefinition<TAuthorization>.Empty);
return await collection.CountDocumentsAsync(FilterDefinition<TAuthorization>.Empty);
}
/// <summary>

2
src/OpenIddict.MongoDb/Stores/OpenIddictScopeStore.cs

@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb
var database = await Context.GetDatabaseAsync(cancellationToken);
var collection = database.GetCollection<TScope>(Options.Value.ScopesCollectionName);
return await collection.CountAsync(FilterDefinition<TScope>.Empty);
return await collection.CountDocumentsAsync(FilterDefinition<TScope>.Empty);
}
/// <summary>

2
src/OpenIddict.MongoDb/Stores/OpenIddictTokenStore.cs

@ -68,7 +68,7 @@ namespace OpenIddict.MongoDb
var database = await Context.GetDatabaseAsync(cancellationToken);
var collection = database.GetCollection<TToken>(Options.Value.TokensCollectionName);
return await collection.CountAsync(FilterDefinition<TToken>.Empty);
return await collection.CountDocumentsAsync(FilterDefinition<TToken>.Empty);
}
/// <summary>

2
test/OpenIddict.MongoDb.Tests/OpenIddictMongoDbContextTests.cs

@ -48,7 +48,7 @@ namespace OpenIddict.MongoDb.Tests
var provider = services.BuildServiceProvider();
var manager = new Mock<IMongoIndexManager<OpenIddictApplication>>();
manager.Setup(mock => mock.CreateOneAsync(It.IsAny<IndexKeysDefinition<OpenIddictApplication>>(), It.IsAny<CreateIndexOptions>(), It.IsAny<CancellationToken>()))
manager.Setup(mock => mock.CreateOneAsync(It.IsAny<CreateIndexModel<OpenIddictApplication>>(), It.IsAny<CreateOneIndexOptions>(), It.IsAny<CancellationToken>()))
.Returns(async delegate
{
await Task.Delay(TimeSpan.FromMilliseconds(1000));

Loading…
Cancel
Save