Skip to content

Commit

Permalink
Start testing OpenIddict on .NET 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchalet committed Nov 3, 2022
1 parent d36acab commit 75b17c9
Show file tree
Hide file tree
Showing 41 changed files with 397 additions and 238 deletions.
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
<DefineConstants>$(DefineConstants);SUPPORTS_ZLIB_COMPRESSION</DefineConstants>
</PropertyGroup>

<PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '7.0'))) ">
<DefineConstants>$(DefineConstants);SUPPORTS_AUTHENTICATION_HANDLER_SELECTION_FALLBACK</DefineConstants>
</PropertyGroup>

<!--
Note: Entity Framework Core 2.x references System.Interactive.Async 3.x, that includes
its own IAsyncEnumerable. To work around collisions between this type and the new type
Expand Down
493 changes: 293 additions & 200 deletions Packages.props

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"sdk": {
"version": "6.0.402"
"version": "7.0.100-rc.2.22477.23"
},

"tools": {
"dotnet": "6.0.402",
"dotnet": "7.0.100-rc.2.22477.23",

"runtimes": {
"aspnetcore": [
"2.1.30",
"3.1.30"
"3.1.30",
"6.0.10"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<IsShipping>false</IsShipping>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<IsShipping>false</IsShipping>
<SignAssembly>false</SignAssembly>
<TypeScriptEnabled>false</TypeScriptEnabled>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<GenerateResxSourceEmitFormatMethods>true</GenerateResxSourceEmitFormatMethods>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>
Expand All @@ -25,6 +25,7 @@
<None Include="_._" Pack="true" PackagePath="lib\net461\_._" />
<None Include="_._" Pack="true" PackagePath="lib\netcoreapp3.1\_._" />
<None Include="_._" Pack="true" PackagePath="lib\net6.0\_._" />
<None Include="_._" Pack="true" PackagePath="lib\net7.0\_._" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ public void PostConfigure(string? name, AuthenticationOptions options)
throw new InvalidOperationException(SR.GetResourceString(SR.ID0289));
}

#if SUPPORTS_AUTHENTICATION_HANDLER_SELECTION_FALLBACK
// Starting in ASP.NET 7.0, the authentication stack integrates a fallback
// mechanism to select the default scheme to use when no value is set, but
// only if a single handler has been registered in the authentication options.
//
// Unfortunately, this behavior is problematic for OpenIddict as it enforces
// strict checks to prevent calling certain unsafe authentication operations
// on invalid endpoints. To opt out this undesirable behavior, a fake entry
// is dynamically added if one of the default schemes properties is not set
// and less than 2 handlers were registered in the authentication options.
if (options.SchemeMap.Count < 2 && string.IsNullOrEmpty(options.DefaultScheme) &&
(string.IsNullOrEmpty(options.DefaultAuthenticateScheme) ||
string.IsNullOrEmpty(options.DefaultSignInScheme) ||
string.IsNullOrEmpty(options.DefaultSignOutScheme)))
{
options.AddScheme<IAuthenticationHandler>(Guid.NewGuid().ToString(), displayName: null);
}
#endif

static bool TryValidate(IDictionary<string, AuthenticationSchemeBuilder> map, string? scheme)
{
// If the scheme was not set or if it cannot be found in the map, return true.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.Client/OpenIddict.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.Core/OpenIddict.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net472;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net6.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net6.0;net7.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.MongoDb/OpenIddict.MongoDb.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<SignAssembly>false</SignAssembly>
<PublicSign>false</PublicSign>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.Quartz/OpenIddict.Quartz.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ public void PostConfigure(string? name, AuthenticationOptions options)
throw new InvalidOperationException(SR.GetResourceString(SR.ID0109));
}

#if SUPPORTS_AUTHENTICATION_HANDLER_SELECTION_FALLBACK
// Starting in ASP.NET 7.0, the authentication stack integrates a fallback
// mechanism to select the default scheme to use when no value is set, but
// only if a single handler has been registered in the authentication options.
//
// Unfortunately, this behavior is problematic for OpenIddict as it enforces
// strict checks to prevent calling certain unsafe authentication operations
// on invalid endpoints. To opt out this undesirable behavior, a fake entry
// is dynamically added if one of the default schemes properties is not set
// and less than 2 handlers were registered in the authentication options.
if (options.SchemeMap.Count < 2 && string.IsNullOrEmpty(options.DefaultScheme) &&
(string.IsNullOrEmpty(options.DefaultAuthenticateScheme) ||
string.IsNullOrEmpty(options.DefaultChallengeScheme) ||
string.IsNullOrEmpty(options.DefaultForbidScheme) ||
string.IsNullOrEmpty(options.DefaultSignInScheme) ||
string.IsNullOrEmpty(options.DefaultSignOutScheme)))
{
options.AddScheme<IAuthenticationHandler>(Guid.NewGuid().ToString(), displayName: null);
}
#endif

static bool TryValidate(IDictionary<string, AuthenticationSchemeBuilder> map, string? scheme)
{
// If the scheme was not set or if it cannot be found in the map, return true.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.Server/OpenIddict.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ public void PostConfigure(string? name, AuthenticationOptions options)
throw new InvalidOperationException(SR.GetResourceString(SR.ID0165));
}

#if SUPPORTS_AUTHENTICATION_HANDLER_SELECTION_FALLBACK
// Starting in ASP.NET 7.0, the authentication stack integrates a fallback
// mechanism to select the default scheme to use when no value is set, but
// only if a single handler has been registered in the authentication options.
//
// Unfortunately, this behavior is problematic for OpenIddict as it enforces
// strict checks to prevent calling certain unsafe authentication operations
// on invalid endpoints. To opt out this undesirable behavior, a fake entry
// is dynamically added if one of the default schemes properties is not set
// and less than 2 handlers were registered in the authentication options.
if (options.SchemeMap.Count < 2 && string.IsNullOrEmpty(options.DefaultScheme) &&
(string.IsNullOrEmpty(options.DefaultSignInScheme) ||
string.IsNullOrEmpty(options.DefaultSignOutScheme)))
{
options.AddScheme<IAuthenticationHandler>(Guid.NewGuid().ToString(), displayName: null);
}
#endif

static bool TryValidate(IDictionary<string, AuthenticationSchemeBuilder> map, string? scheme)
{
// If the scheme was not set or if it cannot be found in the map, return true.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIddict.Validation/OpenIddict.Validation.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net472;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/OpenIddict/OpenIddict.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>
Expand Down Expand Up @@ -29,6 +29,7 @@ To use these features on ASP.NET Core or OWIN/Katana/ASP.NET 4.x, reference the
<None Include="_._" Pack="true" PackagePath="lib\net461\_._" />
<None Include="_._" Pack="true" PackagePath="lib\netcoreapp3.1\_._" />
<None Include="_._" Pack="true" PackagePath="lib\net6.0\_._" />
<None Include="_._" Pack="true" PackagePath="lib\net7.0\_._" />
<None Include="_._" Pack="true" PackagePath="lib\netstandard2.0\_._" />
<None Include="_._" Pack="true" PackagePath="lib\netstandard2.1\_._" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;net472;net48;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/OpenIddict.Core.Tests/OpenIddict.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<SignAssembly>false</SignAssembly>
<PublicSign>false</PublicSign>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 75b17c9

Please sign in to comment.