From cc79326fb4eda909b78582f097f829cef2c40bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Wed, 23 Nov 2016 03:07:27 +0100 Subject: [PATCH] React to API/namespace changes in aspnet-contrib/AspNet.Security.OpenIdConnect.Server https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/commit/146759e15ecfbba8e8316fb6a52e486ff03e199e https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/commit/7f0760bbc759a37ea0e400418bbe5f5f6426aa98 --- .../Controllers/AccountController.cs | 2 +- .../Controllers/AuthorizationController.cs | 1 + .../Mvc.Server/Controllers/ErrorController.cs | 2 +- .../Infrastructure/OpenIddictHelpers.cs | 59 ------------------- .../OpenIddictProvider.Authentication.cs | 16 +++-- .../OpenIddictProvider.Discovery.cs | 2 +- .../OpenIddictProvider.Exchange.cs | 1 + .../OpenIddictProvider.Introspection.cs | 1 + .../OpenIddictProvider.Revocation.cs | 1 + .../OpenIddictProvider.Serialization.cs | 1 + .../OpenIddictProvider.Session.cs | 17 +++--- .../Managers/OpenIddictApplicationManager.cs | 29 +++++++++ src/OpenIddict.Core/OpenIddictBuilder.cs | 2 +- src/OpenIddict.Core/OpenIddictExtensions.cs | 2 +- src/OpenIddict.Mvc/OpenIddictModelBinder.cs | 2 +- .../OpenIddictProviderTests.Authentication.cs | 5 +- .../OpenIddictProviderTests.Discovery.cs | 3 +- .../OpenIddictProviderTests.Exchange.cs | 2 + .../OpenIddictProviderTests.Introspection.cs | 8 ++- .../OpenIddictProviderTests.Revocation.cs | 6 +- .../OpenIddictProviderTests.Serialization.cs | 3 +- .../OpenIddictProviderTests.Session.cs | 5 +- .../OpenIddictProviderTests.Userinfo.cs | 2 + .../Infrastructure/OpenIddictProviderTests.cs | 1 + .../OpenIddictBuilderTests.cs | 2 +- .../OpenIddictExtensionsTests.cs | 2 +- test/OpenIddict.Core.Tests/project.json | 1 + .../OpenIddictModelBinderTests.cs | 2 +- 28 files changed, 88 insertions(+), 92 deletions(-) delete mode 100644 src/OpenIddict.Core/Infrastructure/OpenIddictHelpers.cs diff --git a/samples/Mvc.Server/Controllers/AccountController.cs b/samples/Mvc.Server/Controllers/AccountController.cs index 3b580a51..37ab7477 100644 --- a/samples/Mvc.Server/Controllers/AccountController.cs +++ b/samples/Mvc.Server/Controllers/AccountController.cs @@ -2,7 +2,7 @@ using System.Security.Claims; using System.Threading.Tasks; using AspNet.Security.OAuth.Validation; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; diff --git a/samples/Mvc.Server/Controllers/AuthorizationController.cs b/samples/Mvc.Server/Controllers/AuthorizationController.cs index f96d3af5..29c469b6 100644 --- a/samples/Mvc.Server/Controllers/AuthorizationController.cs +++ b/samples/Mvc.Server/Controllers/AuthorizationController.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; diff --git a/samples/Mvc.Server/Controllers/ErrorController.cs b/samples/Mvc.Server/Controllers/ErrorController.cs index 4ed793ca..7e80ecca 100644 --- a/samples/Mvc.Server/Controllers/ErrorController.cs +++ b/samples/Mvc.Server/Controllers/ErrorController.cs @@ -4,7 +4,7 @@ * the license and the contributors participating to this project. */ -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.AspNetCore.Mvc; using Mvc.Server.ViewModels.Shared; diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictHelpers.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictHelpers.cs deleted file mode 100644 index 3192174c..00000000 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictHelpers.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) - * See https://github.com/openiddict/openiddict-core for more information concerning - * the license and the contributors participating to this project. - */ - -using System; -using System.Threading.Tasks; -using JetBrains.Annotations; - -namespace OpenIddict.Infrastructure { - public static class OpenIddictHelpers { - /// - /// Determines whether an application is a confidential client. - /// - /// The type of the Application entity. - /// The application manager. - /// The application. - /// true if the application is a confidential client, false otherwise. - public static async Task IsConfidentialAsync( - [NotNull] this OpenIddictApplicationManager manager, - [NotNull] TApplication application) where TApplication : class { - if (manager == null) { - throw new ArgumentNullException(nameof(manager)); - } - - if (application == null) { - throw new ArgumentNullException(nameof(application)); - } - - var type = await manager.GetClientTypeAsync(application); - - return string.Equals(type, OpenIddictConstants.ClientTypes.Confidential, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether an application is a public client. - /// - /// The type of the Application entity. - /// The application manager. - /// The application. - /// true if the application is a public client, false otherwise. - public static async Task IsPublicAsync( - [NotNull] this OpenIddictApplicationManager manager, - [NotNull] TApplication application) where TApplication : class { - if (manager == null) { - throw new ArgumentNullException(nameof(manager)); - } - - if (application == null) { - throw new ArgumentNullException(nameof(application)); - } - - var type = await manager.GetClientTypeAsync(application); - - return string.Equals(type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase); - } - } -} diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Authentication.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Authentication.cs index b5597670..6174203d 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Authentication.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Authentication.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.AspNetCore.Builder; @@ -20,6 +21,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Bson; +using Newtonsoft.Json.Linq; namespace OpenIddict.Infrastructure { public partial class OpenIddictProvider : OpenIdConnectServerProvider @@ -84,12 +86,14 @@ namespace OpenIddict.Infrastructure { // Restore the authorization request parameters from the serialized payload. using (var reader = new BsonReader(new MemoryStream(payload))) { - var serializer = JsonSerializer.CreateDefault(); - - // Note: JsonSerializer.Populate() automatically preserves - // the original request parameters resolved from the cache - // when parameters with the same names are specified. - serializer.Populate(reader, context.Request); + foreach (var parameter in JObject.Load(reader)) { + // Avoid overriding the current request parameters. + if (context.Request.HasParameter(parameter.Key)) { + continue; + } + + context.Request.SetParameter(parameter.Key, parameter.Value); + } } } } diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Discovery.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Discovery.cs index ad94d459..f6d36344 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Discovery.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Discovery.cs @@ -5,7 +5,7 @@ */ using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.AspNetCore.Builder; diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Exchange.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Exchange.cs index dd4eeeb3..23aec84e 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Exchange.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Exchange.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.AspNetCore.Builder; diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Introspection.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Introspection.cs index ee2543cd..4eae8c3b 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Introspection.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Introspection.cs @@ -8,6 +8,7 @@ using System; using System.Diagnostics; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Revocation.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Revocation.cs index d0fa4a92..8ff12c43 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Revocation.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Revocation.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Serialization.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Serialization.cs index 1f0d09d1..6ded3da3 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Serialization.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Serialization.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; diff --git a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Session.cs b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Session.cs index f332e83f..a5293da3 100644 --- a/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Session.cs +++ b/src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Session.cs @@ -7,7 +7,7 @@ using System; using System.IO; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using JetBrains.Annotations; using Microsoft.AspNetCore.Diagnostics; @@ -17,6 +17,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Bson; +using Newtonsoft.Json.Linq; namespace OpenIddict.Infrastructure { public partial class OpenIddictProvider : OpenIdConnectServerProvider @@ -57,12 +58,14 @@ namespace OpenIddict.Infrastructure { // Restore the logout request parameters from the serialized payload. using (var reader = new BsonReader(new MemoryStream(payload))) { - var serializer = JsonSerializer.CreateDefault(); - - // Note: JsonSerializer.Populate() automatically preserves - // the original request parameters resolved from the cache - // when parameters with the same names are specified. - serializer.Populate(reader, context.Request); + foreach (var parameter in JObject.Load(reader)) { + // Avoid overriding the current request parameters. + if (context.Request.HasParameter(parameter.Key)) { + continue; + } + + context.Request.SetParameter(parameter.Key, parameter.Value); + } } } } diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index 0df8a3a0..16c9f430 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -157,6 +157,35 @@ namespace OpenIddict { return Store.GetTokensAsync(application, CancellationToken); } + /// + /// Determines whether an application is a confidential client. + /// + /// The application. + /// true if the application is a confidential client, false otherwise. + public async Task IsConfidentialAsync([NotNull] TApplication application) { + if (application == null) { + throw new ArgumentNullException(nameof(application)); + } + + var type = await GetClientTypeAsync(application); + + return string.Equals(type, OpenIddictConstants.ClientTypes.Confidential, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines whether an application is a public client. + /// + /// The application. + /// true if the application is a public client, false otherwise. + public async Task IsPublicAsync(TApplication application) { + if (application == null) { + throw new ArgumentNullException(nameof(application)); + } + + var type = await GetClientTypeAsync(application); + + return string.Equals(type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase); + } /// /// Validates the redirect_uri associated with an application. diff --git a/src/OpenIddict.Core/OpenIddictBuilder.cs b/src/OpenIddict.Core/OpenIddictBuilder.cs index f168fd4a..d2874707 100644 --- a/src/OpenIddict.Core/OpenIddictBuilder.cs +++ b/src/OpenIddict.Core/OpenIddictBuilder.cs @@ -10,7 +10,7 @@ using System.IdentityModel.Tokens.Jwt; using System.IO; using System.Reflection; using System.Security.Cryptography.X509Certificates; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using JetBrains.Annotations; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Http; diff --git a/src/OpenIddict.Core/OpenIddictExtensions.cs b/src/OpenIddict.Core/OpenIddictExtensions.cs index 05b96d69..8c7f2816 100644 --- a/src/OpenIddict.Core/OpenIddictExtensions.cs +++ b/src/OpenIddict.Core/OpenIddictExtensions.cs @@ -5,7 +5,7 @@ */ using System; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using JetBrains.Annotations; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; diff --git a/src/OpenIddict.Mvc/OpenIddictModelBinder.cs b/src/OpenIddict.Mvc/OpenIddictModelBinder.cs index cbbe7663..ed27023a 100644 --- a/src/OpenIddict.Mvc/OpenIddictModelBinder.cs +++ b/src/OpenIddict.Mvc/OpenIddictModelBinder.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Authentication.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Authentication.cs index 817ed416..0ddde455 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Authentication.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Authentication.cs @@ -1,7 +1,8 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Client; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; using Moq; @@ -416,7 +417,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { var identifier = (string) response[OpenIdConnectConstants.Parameters.RequestId]; // Assert - Assert.Equal(1, response.Count()); + Assert.Equal(1, response.GetParameters().Count()); Assert.NotNull(identifier); cache.Verify(mock => mock.SetAsync( diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Discovery.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Discovery.cs index 80c21f89..6a0678de 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Discovery.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Discovery.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Client; +using AspNet.Security.OpenIdConnect.Primitives; using Xunit; namespace OpenIddict.Core.Tests.Infrastructure { diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Exchange.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Exchange.cs index 27a13a5f..301452ed 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Exchange.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Exchange.cs @@ -1,6 +1,8 @@ using System.Security.Claims; using System.Threading.Tasks; +using AspNet.Security.OpenIdConnect.Client; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http.Authentication; diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Introspection.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Introspection.cs index b626c398..87ed713b 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Introspection.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Introspection.cs @@ -1,7 +1,9 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using AspNet.Security.OpenIdConnect.Client; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http.Authentication; @@ -196,7 +198,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { }); // Assert - Assert.Equal(1, response.Count()); + Assert.Equal(1, response.GetParameters().Count()); Assert.False((bool) response[OpenIdConnectConstants.Claims.Active]); } @@ -253,7 +255,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { }); // Assert - Assert.Equal(1, response.Count()); + Assert.Equal(1, response.GetParameters().Count()); Assert.False((bool) response[OpenIdConnectConstants.Claims.Active]); Mock.Get(manager).Verify(mock => mock.FindByIdAsync("3E228451-1555-46F7-A471-951EFBA23A56"), Times.Once()); @@ -312,7 +314,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { }); // Assert - Assert.Equal(1, response.Count()); + Assert.Equal(1, response.GetParameters().Count()); Assert.False((bool) response[OpenIdConnectConstants.Claims.Active]); Mock.Get(manager).Verify(mock => mock.FindByIdAsync("3E228451-1555-46F7-A471-951EFBA23A56"), Times.Once()); diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Revocation.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Revocation.cs index 965c69b9..51d5d2eb 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Revocation.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Revocation.cs @@ -3,7 +3,9 @@ using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using AspNet.Security.OpenIdConnect.Client; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http.Authentication; @@ -300,7 +302,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { }); // Assert - Assert.Equal(0, response.Count()); + Assert.Equal(0, response.GetParameters().Count()); Mock.Get(manager).Verify(mock => mock.FindByIdAsync("3E228451-1555-46F7-A471-951EFBA23A56"), Times.Once()); Mock.Get(manager).Verify(mock => mock.RevokeAsync(It.IsAny()), Times.Never()); @@ -343,7 +345,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { }); // Assert - Assert.Equal(0, response.Count()); + Assert.Equal(0, response.GetParameters().Count()); Mock.Get(manager).Verify(mock => mock.FindByIdAsync("3E228451-1555-46F7-A471-951EFBA23A56"), Times.Once()); Mock.Get(manager).Verify(mock => mock.RevokeAsync(token), Times.Once()); diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Serialization.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Serialization.cs index 56215744..67c066da 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Serialization.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Serialization.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Client; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.Extensions.DependencyInjection; using Moq; using Xunit; diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Session.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Session.cs index 9b6d11d4..faab7e68 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Session.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Session.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Client; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; using Moq; @@ -100,7 +101,7 @@ namespace OpenIddict.Core.Tests.Infrastructure { var identifier = (string) response[OpenIdConnectConstants.Parameters.RequestId]; // Assert - Assert.Equal(1, response.Count()); + Assert.Equal(1, response.GetParameters().Count()); Assert.NotNull(identifier); cache.Verify(mock => mock.SetAsync( diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Userinfo.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Userinfo.cs index a384a07d..750b00ea 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Userinfo.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.Userinfo.cs @@ -1,6 +1,8 @@ using System.Security.Claims; using System.Threading.Tasks; +using AspNet.Security.OpenIdConnect.Client; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http.Authentication; diff --git a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.cs b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.cs index ab48bfab..b29ea10a 100644 --- a/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.cs +++ b/test/OpenIddict.Core.Tests/Infrastructure/OpenIddictProviderTests.cs @@ -3,6 +3,7 @@ using System.Reflection; using System.Security.Claims; using System.Threading.Tasks; using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; diff --git a/test/OpenIddict.Core.Tests/OpenIddictBuilderTests.cs b/test/OpenIddict.Core.Tests/OpenIddictBuilderTests.cs index bed6a409..8e4c9a3d 100644 --- a/test/OpenIddict.Core.Tests/OpenIddictBuilderTests.cs +++ b/test/OpenIddict.Core.Tests/OpenIddictBuilderTests.cs @@ -1,7 +1,7 @@ using System; using System.IdentityModel.Tokens.Jwt; using System.Reflection; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Http; diff --git a/test/OpenIddict.Core.Tests/OpenIddictExtensionsTests.cs b/test/OpenIddict.Core.Tests/OpenIddictExtensionsTests.cs index aace74e4..2c5ac5bd 100644 --- a/test/OpenIddict.Core.Tests/OpenIddictExtensionsTests.cs +++ b/test/OpenIddict.Core.Tests/OpenIddictExtensionsTests.cs @@ -1,5 +1,5 @@ using System; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.DataProtection; diff --git a/test/OpenIddict.Core.Tests/project.json b/test/OpenIddict.Core.Tests/project.json index 2748ca54..50640ba2 100644 --- a/test/OpenIddict.Core.Tests/project.json +++ b/test/OpenIddict.Core.Tests/project.json @@ -8,6 +8,7 @@ }, "dependencies": { + "AspNet.Security.OpenIdConnect.Client": "1.0.0-beta7-*", "dotnet-test-xunit": "2.2.0-preview2-build1029", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.TestHost": "1.0.0", diff --git a/test/OpenIddict.Mvc.Tests/OpenIddictModelBinderTests.cs b/test/OpenIddict.Mvc.Tests/OpenIddictModelBinderTests.cs index b5d7908f..0d094233 100644 --- a/test/OpenIddict.Mvc.Tests/OpenIddictModelBinderTests.cs +++ b/test/OpenIddict.Mvc.Tests/OpenIddictModelBinderTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Extensions; +using AspNet.Security.OpenIdConnect.Primitives; using AspNet.Security.OpenIdConnect.Server; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features;