Skip to content

deleted: Update to .NET 9 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2305ee2
chore(deps): update TargetFramework to net9.0
cnblogs-dudu Apr 30, 2025
05778f6
build: update global.json
cnblogs-dudu Apr 30, 2025
d1940b1
chore(desp): update packages version in Directory.Build.targets
cnblogs-dudu May 1, 2025
3f03417
fix: use IReadOnlyCollection instead
cnblogs-dudu May 1, 2025
7dfa549
chore(deps): update pacakges
cnblogs-dudu May 1, 2025
1f74be0
fix: use IReadOnlyCollection instead
cnblogs-dudu May 1, 2025
86634c2
chore(deps): update packages
cnblogs-dudu May 1, 2025
f28f82f
chore(deps): update packages
cnblogs-dudu May 1, 2025
26c45e5
fix: use news FluentAssertions apis
cnblogs-dudu May 1, 2025
5d00c32
fix: changes for Bullseye update
cnblogs-dudu May 1, 2025
40a7f4a
ci: use dotnet 9
cnblogs-dudu May 1, 2025
68fc729
chore(deps): rename IdentityModel to Duende.IdentityModel
cnblogs-dudu May 1, 2025
6cd7977
chore: change IdentityServerVersion to 4.3.0
cnblogs-dudu May 1, 2025
248a9ca
refactor: use Duende.IdentityModel.Client
cnblogs-dudu May 2, 2025
c4af605
test: shet ShowPII to true
cnblogs-dudu May 2, 2025
75f4698
fix(test): remove extra comma in json
cnblogs-dudu May 2, 2025
29cf3c2
fix(test): use double quote in json
cnblogs-dudu May 2, 2025
1d15407
refactor: use JsonSerializer of System.Text.Json
cnblogs-dudu May 2, 2025
466ef5e
test: remove a test for changes of System.IdentityModel.Tokens.Jwt
cnblogs-dudu May 2, 2025
bb2e602
test: remove a test align with Duende.IdentityModel.Client
cnblogs-dudu May 2, 2025
02d4583
refactor: use Duende.IdentityModel
cnblogs-dudu May 2, 2025
158dad4
chore(deps): update Clients to .net 9
cnblogs-dudu May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: '9'
- if: contains(matrix.runs-on, 'macOS') || contains(matrix.runs-on, 'ubuntu')
env:
MINVERVERSIONOVERRIDE: ${{ secrets.MINVER_VERSION }}
Expand Down
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk": {
"version": "7.0.100"
"version": "9.0.203",
"rollForward": "latestFeature"
}
}
26 changes: 13 additions & 13 deletions samples/Clients/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project>

<PropertyGroup>
<AspNetVersion>3.1.0</AspNetVersion>
</PropertyGroup>
<PropertyGroup>
<AspNetVersion>9.0.4</AspNetVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Update="IdentityModel" Version="4.3.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="$(AspNetVersion)" />
<PackageReference Update="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetVersion)" />
<PackageReference Update="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(AspNetVersion)" />
<PackageReference Update="Microsoft.AspNetCore.Authentication.Certificate" Version="$(AspNetVersion)"/>
<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Duende.IdentityModel" Version="7.0.0" />

<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="$(AspNetVersion)" />
<PackageReference Update="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetVersion)" />
<PackageReference Update="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(AspNetVersion)" />
<PackageReference Update="Microsoft.AspNetCore.Authentication.Certificate" Version="$(AspNetVersion)" />

<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/Clients/old/MvcHybrid/MvcHybrid.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />

<ProjectReference Include="..\Constants\Constants.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion samples/Clients/old/MvcHybrid/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IdentityModel.Tokens.Jwt;
using IdentityModel;
using Duende.IdentityModel;
using Clients;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication.Cookies;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/Clients/old/MvcHybridAutomaticRefresh/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IdentityModel.Tokens.Jwt;
using IdentityModel;
using Duende.IdentityModel;
using Clients;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication.Cookies;
Expand Down Expand Up @@ -50,7 +50,7 @@ public void ConfigureServices(IServiceCollection services)
options.Scope.Add("email");
options.Scope.Add("api1");
options.Scope.Add("offline_access");

options.ClaimActions.MapAllExcept("iss", "nbf", "exp", "aud", "nonce", "iat", "c_hash");

options.GetClaimsFromUserInfoEndpoint = true;
Expand Down
2 changes: 1 addition & 1 deletion samples/Clients/old/MvcImplicit/MvcImplicit.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Clients/old/MvcImplicit/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Clients;
using IdentityModel;
using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />

<ProjectReference Include="..\Constants\Constants.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/Clients/old/MvcImplicitJwtRequest/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Clients;
using IdentityModel;
using Duende.IdentityModel;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
Expand Down
4 changes: 2 additions & 2 deletions samples/Clients/old/MvcManual/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Linq;
using Microsoft.IdentityModel.Tokens;
using System.Collections.Generic;
using IdentityModel;
using Duende.IdentityModel;
using System.Security.Cryptography;
using System.IdentityModel.Tokens.Jwt;
using Clients;
Expand All @@ -32,7 +32,7 @@ public async Task<IActionResult> Secure()
return await StartAuthentication();
}

public async Task <IActionResult> Logout()
public async Task<IActionResult> Logout()
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);

Expand Down
6 changes: 3 additions & 3 deletions samples/Clients/old/MvcManual/MvcManual.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />

<ProjectReference Include="..\Constants\Constants.csproj" />
</ItemGroup>

Expand All @@ -25,4 +25,4 @@
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
</ItemGroup>

</Project>
</Project>
18 changes: 10 additions & 8 deletions samples/Clients/src/APIs/ResourceBasedApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using System;

namespace ResourceBasedApi
{
Expand All @@ -13,10 +13,10 @@ public static void Main(string[] args)
{
Console.Title = "Sample API";

BuildWebHost(args).Run();
CreateHostBuilder(args).Build().Run();
}

public static IWebHost BuildWebHost(string[] args)
public static IHostBuilder CreateHostBuilder(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
Expand All @@ -27,10 +27,12 @@ public static IWebHost BuildWebHost(string[] args)
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.CreateLogger();

return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog()
.Build();
return Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Constants\Constants.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="IdentityModel.AspNetCore.AccessTokenValidation" Version="1.0.0-preview.3" />
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="4.0.1" />

<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />

<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageReference Include="Cnblogs.IdentityServer4.AccessTokenValidation" Version="3.1.0" />
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="6.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />

<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
</ItemGroup>

</Project>
14 changes: 3 additions & 11 deletions samples/Clients/src/APIs/ResourceBasedApi/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
using Clients;
using Clients;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using IdentityModel.AspNetCore.AccessTokenValidation;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;

namespace ResourceBasedApi
{
Expand All @@ -32,7 +24,7 @@ public void ConfigureServices(IServiceCollection services)
options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };

// if token does not contain a dot, it is a reference token
options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
// options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
})

// reference tokens
Expand All @@ -44,7 +36,7 @@ public void ConfigureServices(IServiceCollection services)
options.ClientSecret = "secret";
});

services.AddScopeTransformation();
// services.AddScopeTransformation();
}

public void Configure(IApplicationBuilder app)
Expand Down
18 changes: 10 additions & 8 deletions samples/Clients/src/APIs/SimpleApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using System;

namespace SampleApi
{
Expand All @@ -13,10 +13,10 @@ public static void Main(string[] args)
{
Console.Title = "Sample API";

BuildWebHost(args).Run();
CreateHostBuilder(args).Build().Run();
}

public static IWebHost BuildWebHost(string[] args)
public static IHostBuilder CreateHostBuilder(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
Expand All @@ -27,10 +27,12 @@ public static IWebHost BuildWebHost(string[] args)
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.CreateLogger();

return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog()
.Build();
return Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
}
11 changes: 5 additions & 6 deletions samples/Clients/src/APIs/SimpleApi/SimpleApi.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Constants\Constants.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />

<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />

<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
</ItemGroup>

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

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
7 changes: 3 additions & 4 deletions samples/Clients/src/ConsoleClientCredentialsFlow/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Clients;
using IdentityModel.Client;
using Newtonsoft.Json.Linq;
using Clients;
using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
Expand Down Expand Up @@ -52,7 +51,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");

"\n\nService claims:".ConsoleGreen();
Console.WriteLine(JArray.Parse(response));
Console.WriteLine(response);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Loading
Loading