From d02b57f04f0267aad4cc051be7c8d183ddc6b00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Fri, 20 Oct 2017 10:56:52 +0200 Subject: [PATCH] Remove AspNet.Security.OpenIdConnect.Primitives from OpenIddict.Core's dependencies and move OpenIddict.Models to netstandard2.0 --- src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs | 7 +++---- src/OpenIddict.Core/OpenIddict.Core.csproj | 1 - src/OpenIddict.Core/OpenIddictConstants.cs | 8 ++++++++ src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs | 9 ++++----- src/OpenIddict.Models/OpenIddict.Models.csproj | 4 ++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs index 646e4acb..5ccaa461 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs @@ -9,7 +9,6 @@ using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Primitives; using JetBrains.Annotations; using Microsoft.Extensions.Logging; @@ -680,9 +679,9 @@ namespace OpenIddict.Core throw new ArgumentException("The token type cannot be null or empty.", nameof(descriptor)); } - if (!string.Equals(descriptor.Type, OpenIdConnectConstants.TokenTypeHints.AccessToken, StringComparison.OrdinalIgnoreCase) && - !string.Equals(descriptor.Type, OpenIdConnectConstants.TokenTypeHints.AuthorizationCode, StringComparison.OrdinalIgnoreCase) && - !string.Equals(descriptor.Type, OpenIdConnectConstants.TokenTypeHints.RefreshToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(descriptor.Type, OpenIddictConstants.TokenTypes.AccessToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(descriptor.Type, OpenIddictConstants.TokenTypes.AuthorizationCode, StringComparison.OrdinalIgnoreCase) && + !string.Equals(descriptor.Type, OpenIddictConstants.TokenTypes.RefreshToken, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("The specified token type is not supported by the default token manager."); } diff --git a/src/OpenIddict.Core/OpenIddict.Core.csproj b/src/OpenIddict.Core/OpenIddict.Core.csproj index ef1cd4de..f035cd14 100644 --- a/src/OpenIddict.Core/OpenIddict.Core.csproj +++ b/src/OpenIddict.Core/OpenIddict.Core.csproj @@ -17,7 +17,6 @@ - diff --git a/src/OpenIddict.Core/OpenIddictConstants.cs b/src/OpenIddict.Core/OpenIddictConstants.cs index 976d2198..098c2e85 100644 --- a/src/OpenIddict.Core/OpenIddictConstants.cs +++ b/src/OpenIddict.Core/OpenIddictConstants.cs @@ -67,5 +67,13 @@ namespace OpenIddict.Core public const string Revoked = "revoked"; public const string Valid = "valid"; } + + public static class TokenTypes + { + public const string AccessToken = "access_token"; + public const string AuthorizationCode = "authorization_code"; + public const string IdToken = "id_token"; + public const string RefreshToken = "refresh_token"; + } } } diff --git a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs index 01c8f991..d2f24866 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs @@ -10,7 +10,6 @@ using System.ComponentModel; using System.Linq; using System.Threading; using System.Threading.Tasks; -using AspNet.Security.OpenIdConnect.Primitives; using JetBrains.Annotations; using OpenIddict.Models; @@ -162,7 +161,7 @@ namespace OpenIddict.Core foreach (var candidate in candidates) { var uris = candidate.PostLogoutRedirectUris?.Split( - OpenIdConnectConstants.Separators.Space, + new[] { OpenIddictConstants.Separators.Space }, StringSplitOptions.RemoveEmptyEntries); if (uris == null) @@ -223,7 +222,7 @@ namespace OpenIddict.Core foreach (var candidate in candidates) { var uris = candidate.RedirectUris?.Split( - OpenIdConnectConstants.Separators.Space, + new[] { OpenIddictConstants.Separators.Space }, StringSplitOptions.RemoveEmptyEntries); if (uris == null) @@ -378,7 +377,7 @@ namespace OpenIddict.Core } var uris = application.PostLogoutRedirectUris.Split( - OpenIdConnectConstants.Separators.Space, + new[] { OpenIddictConstants.Separators.Space }, StringSplitOptions.RemoveEmptyEntries); return Task.FromResult(ImmutableArray.Create(uris)); @@ -406,7 +405,7 @@ namespace OpenIddict.Core } var uris = application.RedirectUris.Split( - OpenIdConnectConstants.Separators.Space, + new[] { OpenIddictConstants.Separators.Space }, StringSplitOptions.RemoveEmptyEntries); return Task.FromResult(ImmutableArray.Create(uris)); diff --git a/src/OpenIddict.Models/OpenIddict.Models.csproj b/src/OpenIddict.Models/OpenIddict.Models.csproj index ac2abd49..dad3203d 100644 --- a/src/OpenIddict.Models/OpenIddict.Models.csproj +++ b/src/OpenIddict.Models/OpenIddict.Models.csproj @@ -3,11 +3,11 @@ - netstandard1.0 + netstandard2.0 - Provides default entities for OpenIddict, that can be used by the EntityFramework stores. + OpenIddict's default entities, used by the Entity Framework 6.x and Entity Framework Core stores. Kévin Chalet aspnetcore;authentication;jwt;openidconnect;openiddict;security