Skip to content

Commit cf8e784

Browse files
committed
chore(deps): update samples to .net 9
1 parent 02d4583 commit cf8e784

File tree

94 files changed

+270
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+270
-312
lines changed

samples/Clients/Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project>
22

33
<PropertyGroup>
4-
<AspNetVersion>3.1.0</AspNetVersion>
4+
<AspNetVersion>9.0.4</AspNetVersion>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Update="Duende.IdentityModel" Version="4.3.0" />
8+
<PackageReference Update="Duende.IdentityModel" Version="7.0.0" />
99

1010
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="$(AspNetVersion)" />
1111
<PackageReference Update="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetVersion)" />
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

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

77
<ItemGroup>
88
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />
9-
9+
1010
<ProjectReference Include="..\Constants\Constants.csproj" />
1111
</ItemGroup>
1212
</Project>

samples/Clients/old/MvcHybridAutomaticRefresh/MvcHybridAutomaticRefresh.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

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

77
<ItemGroup>

samples/Clients/old/MvcImplicit/MvcImplicit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

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

77
<ItemGroup>

samples/Clients/old/MvcImplicitJwtRequest/MvcImplicitJwtRequest.csproj

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

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

77
<ItemGroup>
88
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />
9-
9+
1010
<ProjectReference Include="..\Constants\Constants.csproj" />
1111
</ItemGroup>
1212

samples/Clients/old/MvcManual/MvcManual.csproj

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

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

77
<ItemGroup>
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
15-
15+
1616
<ProjectReference Include="..\Constants\Constants.csproj" />
1717
</ItemGroup>
1818

@@ -25,4 +25,4 @@
2525
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
2626
</ItemGroup>
2727

28-
</Project>
28+
</Project>
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using System;
2-
using Microsoft.AspNetCore;
31
using Microsoft.AspNetCore.Hosting;
2+
using Microsoft.Extensions.Hosting;
43
using Serilog;
54
using Serilog.Events;
65
using Serilog.Sinks.SystemConsole.Themes;
6+
using System;
77

88
namespace ResourceBasedApi
99
{
@@ -13,10 +13,10 @@ public static void Main(string[] args)
1313
{
1414
Console.Title = "Sample API";
1515

16-
BuildWebHost(args).Run();
16+
CreateHostBuilder(args).Build().Run();
1717
}
1818

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

30-
return WebHost.CreateDefaultBuilder(args)
31-
.UseStartup<Startup>()
32-
.UseSerilog()
33-
.Build();
30+
return Host.CreateDefaultBuilder(args)
31+
.UseSerilog()
32+
.ConfigureWebHostDefaults(webBuilder =>
33+
{
34+
webBuilder.UseStartup<Startup>();
35+
});
3436
}
3537
}
3638
}
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

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

77
<ItemGroup>
88
<ProjectReference Include="..\..\Constants\Constants.csproj" />
99
</ItemGroup>
10-
10+
1111
<ItemGroup>
12-
<PackageReference Include="IdentityModel.AspNetCore.AccessTokenValidation" Version="1.0.0-preview.3" />
13-
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="4.0.1" />
14-
15-
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
16-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
17-
18-
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
12+
<PackageReference Include="Cnblogs.IdentityServer4.AccessTokenValidation" Version="3.1.0" />
13+
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="6.2.0" />
14+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
15+
16+
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
1917
</ItemGroup>
2018

2119
</Project>

samples/Clients/src/APIs/ResourceBasedApi/Startup.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
using Clients;
1+
using Clients;
22
using Microsoft.AspNetCore.Builder;
33
using Microsoft.Extensions.DependencyInjection;
4-
using System;
5-
using System.IdentityModel.Tokens.Jwt;
6-
using System.Security.Cryptography.X509Certificates;
7-
using System.Text;
8-
using System.Threading.Tasks;
9-
using IdentityModel.AspNetCore.AccessTokenValidation;
10-
using Microsoft.AspNetCore.Http;
11-
using Microsoft.AspNetCore.HttpOverrides;
124

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

3426
// if token does not contain a dot, it is a reference token
35-
options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
27+
// options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
3628
})
3729

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

47-
services.AddScopeTransformation();
39+
// services.AddScopeTransformation();
4840
}
4941

5042
public void Configure(IApplicationBuilder app)
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using System;
2-
using Microsoft.AspNetCore;
31
using Microsoft.AspNetCore.Hosting;
2+
using Microsoft.Extensions.Hosting;
43
using Serilog;
54
using Serilog.Events;
65
using Serilog.Sinks.SystemConsole.Themes;
6+
using System;
77

88
namespace SampleApi
99
{
@@ -13,10 +13,10 @@ public static void Main(string[] args)
1313
{
1414
Console.Title = "Sample API";
1515

16-
BuildWebHost(args).Run();
16+
CreateHostBuilder(args).Build().Run();
1717
}
1818

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

30-
return WebHost.CreateDefaultBuilder(args)
31-
.UseStartup<Startup>()
32-
.UseSerilog()
33-
.Build();
30+
return Host.CreateDefaultBuilder(args)
31+
.UseSerilog()
32+
.ConfigureWebHostDefaults(webBuilder =>
33+
{
34+
webBuilder.UseStartup<Startup>();
35+
});
3436
}
3537
}
3638
}

0 commit comments

Comments
 (0)