Skip to content

Commit 3476d5f

Browse files
authored
Merge pull request #3 from cnblogs/update-to-net9
chore(deps): update to .net 9
2 parents 0c463bd + 46d9ca1 commit 3476d5f

10 files changed

+42
-41
lines changed

build/Program.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Threading.Tasks;
34
using static Bullseye.Targets;
45
using static SimpleExec.Command;
56

@@ -22,7 +23,7 @@ private static class Targets
2223
public const string SignPackage = "sign-package";
2324
}
2425

25-
internal static void Main(string[] args)
26+
internal static async Task Main(string[] args)
2627
{
2728
Target(Targets.RestoreTools, () =>
2829
{
@@ -34,17 +35,17 @@ internal static void Main(string[] args)
3435
Run("dotnet", "clean -c Release -v m --nologo");
3536
});
3637

37-
Target(Targets.Build, DependsOn(Targets.CleanBuildOutput), () =>
38+
Target(Targets.Build, dependsOn: [Targets.CleanBuildOutput], () =>
3839
{
3940
Run("dotnet", "build -c Release --nologo");
4041
});
4142

42-
Target(Targets.SignBinary, DependsOn(Targets.Build, Targets.RestoreTools), () =>
43+
Target(Targets.SignBinary, dependsOn: [Targets.Build, Targets.RestoreTools], () =>
4344
{
4445
Sign("./src/bin/Release", "IdentityServer4.AccessTokenValidation.dll");
4546
});
4647

47-
Target(Targets.Test, DependsOn(Targets.Build), () =>
48+
Target(Targets.Test, dependsOn: [Targets.Build], () =>
4849
{
4950
Run("dotnet", "test -c Release --no-build --nologo");
5051
});
@@ -57,21 +58,21 @@ internal static void Main(string[] args)
5758
}
5859
});
5960

60-
Target(Targets.Pack, DependsOn(Targets.Build, Targets.CleanPackOutput), () =>
61+
Target(Targets.Pack, dependsOn: [Targets.Build, Targets.CleanPackOutput], () =>
6162
{
6263
Run("dotnet", $"pack ./src/IdentityServer4.AccessTokenValidation.csproj -c Release -o {Directory.CreateDirectory(packOutput).FullName} --no-build --nologo");
6364
});
6465

65-
Target(Targets.SignPackage, DependsOn(Targets.Pack, Targets.RestoreTools), () =>
66+
Target(Targets.SignPackage, dependsOn: [Targets.Pack, Targets.RestoreTools], () =>
6667
{
6768
Sign(packOutput, "*.nupkg");
6869
});
6970

70-
Target("default", DependsOn(Targets.Test, Targets.Pack));
71+
Target("default", dependsOn: [Targets.Test, Targets.Pack]);
7172

72-
Target("sign", DependsOn(Targets.SignBinary, Targets.Test, Targets.SignPackage));
73+
Target("sign", dependsOn: [Targets.SignBinary, Targets.Test, Targets.SignPackage]);
7374

74-
RunTargetsAndExit(args, ex => ex is SimpleExec.NonZeroExitCodeException || ex.Message.EndsWith(envVarMissing));
75+
await RunTargetsAndExitAsync(args, ex => ex is SimpleExec.ExitCodeException || ex.Message.EndsWith(envVarMissing));
7576
}
7677

7778
private static void Sign(string path, string searchTerm)

build/build.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Bullseye" Version="3.3.0" />
10-
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.4.4" />
11-
<PackageReference Include="SimpleExec" Version="6.2.0" />
9+
<PackageReference Include="Bullseye" Version="6.0.0" />
10+
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
11+
<PackageReference Include="SimpleExec" Version="12.0.0" />
1212
</ItemGroup>
1313

1414
</Project>

global.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"sdk": {
3-
"version": "7.0.100"
3+
"version": "9.0.203",
4+
"rollForward": "latestFeature"
45
}
56
}

src/AuthorizationPolicyExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

4-
using IdentityModel;
4+
using Duende.IdentityModel;
55

66
namespace Microsoft.AspNetCore.Authorization
77
{

src/ConfigureInternalOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace IdentityServer4.AccessTokenValidation
99
{
10-
internal class ConfigureInternalOptions :
10+
internal class ConfigureInternalOptions :
1111
IConfigureNamedOptions<JwtBearerOptions>,
1212
IConfigureNamedOptions<OAuth2IntrospectionOptions>
1313
{
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
</PropertyGroup>
6-
6+
77
<PropertyGroup>
88
<Description>ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4</Description>
99
<Authors>Brock Allen;Dominick Baier</Authors>
@@ -13,11 +13,11 @@
1313
<PackageProjectUrl>https://github.com/cnblogs/IdentityServer4.AccessTokenValidation</PackageProjectUrl>
1414
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1515
<PackageReleaseNotes>https://github.com/cnblogs/IdentityServer4.AccessTokenValidation/releases</PackageReleaseNotes>
16-
16+
1717
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
1818
<SignAssembly>true</SignAssembly>
1919
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
20-
20+
2121
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2222
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2323
<EmbedUntrackedSources>true</EmbedUntrackedSources>
@@ -31,14 +31,14 @@
3131
<ItemGroup>
3232
<FrameworkReference Include="Microsoft.AspNetCore.App" />
3333
</ItemGroup>
34-
34+
3535
<ItemGroup>
36-
<PackageReference Include="IdentityModel" Version="6.0.0" />
37-
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="6.1.0" />
38-
39-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" />
40-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
41-
42-
<PackageReference Include="minver" Version="4.2.0" PrivateAssets="All" />
36+
<PackageReference Include="Duende.IdentityModel" Version="7.0.0" />
37+
<PackageReference Include="Cnblogs.IdentityModel.AspNetCore.OAuth2Introspection" Version="7.0.0" />
38+
39+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.4" />
40+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
41+
42+
<PackageReference Include="minver" Version="6.0.0" PrivateAssets="All" />
4343
</ItemGroup>
4444
</Project>

src/IdentityServerAuthenticationExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

4-
using System;
54
using IdentityModel.AspNetCore.OAuth2Introspection;
65
using IdentityServer4.AccessTokenValidation;
76
using Microsoft.AspNetCore.Authentication;
87
using Microsoft.AspNetCore.Authentication.JwtBearer;
98
using Microsoft.Extensions.DependencyInjection;
109
using Microsoft.Extensions.Options;
10+
using System;
1111

1212
namespace Microsoft.AspNetCore.Builder
1313
{
@@ -59,13 +59,13 @@ public static AuthenticationBuilder AddIdentityServerAuthentication(this Authent
5959
var monitor = services.GetRequiredService<IOptionsMonitor<IdentityServerAuthenticationOptions>>();
6060
return new ConfigureInternalOptions(monitor.Get(authenticationScheme), authenticationScheme);
6161
});
62-
62+
6363
builder.Services.AddSingleton<IConfigureOptions<OAuth2IntrospectionOptions>>(services =>
6464
{
6565
var monitor = services.GetRequiredService<IOptionsMonitor<IdentityServerAuthenticationOptions>>();
6666
return new ConfigureInternalOptions(monitor.Get(authenticationScheme), authenticationScheme);
6767
});
68-
68+
6969
return builder.AddScheme<IdentityServerAuthenticationOptions, IdentityServerAuthenticationHandler>(authenticationScheme, configureOptions);
7070
}
7171

@@ -77,7 +77,7 @@ public static AuthenticationBuilder AddIdentityServerAuthentication(this Authent
7777
/// <param name="jwtBearerOptions">The JWT bearer options.</param>
7878
/// <param name="introspectionOptions">The introspection options.</param>
7979
/// <returns></returns>
80-
public static AuthenticationBuilder AddIdentityServerAuthentication(this AuthenticationBuilder builder, string authenticationScheme,
80+
public static AuthenticationBuilder AddIdentityServerAuthentication(this AuthenticationBuilder builder, string authenticationScheme,
8181
Action<JwtBearerOptions> jwtBearerOptions,
8282
Action<OAuth2IntrospectionOptions> introspectionOptions)
8383
{

src/IdentityServerAuthenticationOptions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

4+
using Duende.IdentityModel.Client;
45
using IdentityModel.AspNetCore.OAuth2Introspection;
5-
using IdentityModel.Client;
66
using Microsoft.AspNetCore.Authentication;
77
using Microsoft.AspNetCore.Authentication.JwtBearer;
88
using Microsoft.AspNetCore.Http;
99
using Microsoft.IdentityModel.Protocols;
1010
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
1111
using System;
12-
using System.Collections.Generic;
1312
using System.IdentityModel.Tokens.Jwt;
1413
using System.Net.Http;
1514

test/Tests.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="FluentAssertions" Version="6.8.0" />
9-
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.0" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
11-
<PackageReference Include="xunit" Version="2.4.2" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
8+
<PackageReference Include="FluentAssertions" Version="8.2.0" />
9+
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="9.0.4" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
11+
<PackageReference Include="xunit" Version="2.9.3" />
12+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1515
</PackageReference>

test/TokenValidationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
using Duende.IdentityModel.Client;
12
using FluentAssertions;
2-
using IdentityModel.Client;
33
using System.Net;
44
using System.Threading.Tasks;
55
using Tests.Util;

0 commit comments

Comments
 (0)