Skip to content

Commit bcb0d17

Browse files
cleanup for net6
1 parent af0f5df commit bcb0d17

5 files changed

Lines changed: 32 additions & 10 deletions

File tree

global.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"sdk": {
3-
"version": "5.0.100",
4-
"rollForward": "latestMajor"
3+
"version": "6.0.100",
4+
"rollForward": "latestMajor",
5+
"allowPrerelease": false
56
}
67
}

src/IdentityModel.AspNetCore.OAuth2Introspection.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
44

55
<PackageId>IdentityModel.AspNetCore.OAuth2Introspection</PackageId>
66
<Description>ASP.NET Core authentication handler for validating tokens using OAuth 2.0 introspection</Description>
@@ -35,9 +35,9 @@
3535
</ItemGroup>
3636

3737
<ItemGroup>
38-
<PackageReference Include="IdentityModel" Version="5.1.0" />
38+
<PackageReference Include="IdentityModel" Version="5.2.0" />
3939

4040
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
41-
<PackageReference Include="minver" Version="2.5.0" PrivateAssets="All" />
41+
<PackageReference Include="minver" Version="3.0.0-alpha.1" PrivateAssets="All" />
4242
</ItemGroup>
4343
</Project>

src/Infrastructure/CacheExtensions.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,33 @@
99
using System.Security.Claims;
1010
using System.Text;
1111
using System.Text.Json;
12+
using System.Text.Json.Serialization;
1213
using System.Threading.Tasks;
1314

1415
namespace IdentityModel.AspNetCore.OAuth2Introspection
1516
{
1617
internal static class CacheExtensions
1718
{
18-
internal readonly static JsonSerializerOptions Options;
19+
private static readonly JsonSerializerOptions Options;
1920

2021
static CacheExtensions()
2122
{
23+
24+
#if NET6_0_OR_GREATER
25+
Options = new JsonSerializerOptions
26+
{
27+
IgnoreReadOnlyFields = true,
28+
IgnoreReadOnlyProperties = true,
29+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
30+
};
31+
#else
2232
Options = new JsonSerializerOptions
2333
{
2434
IgnoreReadOnlyFields = true,
2535
IgnoreReadOnlyProperties = true,
2636
IgnoreNullValues = true
2737
};
38+
#endif
2839

2940
Options.Converters.Add(new ClaimConverter());
3041
}

test/Tests/Tests.csproj

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
2+
3+
<PropertyGroup Condition=" '$(NETCoreSdkPortableRuntimeIdentifier)' != 'osx-arm64' ">
4+
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Condition=" '$(NETCoreSdkPortableRuntimeIdentifier)' == 'osx-arm64' ">
8+
<TargetFramework>net6.0</TargetFramework>
49
</PropertyGroup>
510

611
<ItemGroup>
@@ -25,6 +30,10 @@
2530
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
2631
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.0" />
2732
</ItemGroup>
33+
34+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
35+
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
36+
</ItemGroup>
2837

2938

3039
</Project>

test/Tests/Util/PipelineFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Text;
1313
using Microsoft.AspNetCore.Http;
1414
using System;
15+
using System.Threading.Tasks;
1516
using IdentityModel.AspNetCore.OAuth2Introspection;
1617

1718
namespace Tests.Util
@@ -41,8 +42,8 @@ public static TestServer CreateServer(Action<OAuth2IntrospectionOptions> options
4142
.Configure(app =>
4243
{
4344
app.UseAuthentication();
44-
45-
app.Use(async (context, next) =>
45+
46+
app.Run(async context =>
4647
{
4748
var user = context.User;
4849

0 commit comments

Comments
 (0)