From 9a684ca73c77ae5c8d708e8ab72acab26a99b1ef Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Fri, 22 Nov 2024 21:38:32 -0600 Subject: [PATCH] Update oidc clients .net 9 --- .vscode/launch.json | 48 ++++--------------- .vscode/tasks.json | 24 ---------- Directory.Build.targets | 6 +-- .../MvcAutomaticTokenManagement.csproj | 2 +- .../MvcAutomaticTokenManagement/Program.cs | 2 +- .../MvcAutomaticTokenManagement/Startup.cs | 2 + clients/src/MvcCode/MvcCode.csproj | 2 +- clients/src/MvcCode/Program.cs | 4 +- clients/src/MvcCode/Startup.cs | 5 +- clients/src/MvcDPoP/MvcDPoP.csproj | 2 +- clients/src/MvcDPoP/Program.cs | 2 +- clients/src/MvcDPoP/Startup.cs | 2 + .../MvcHybridBackChannel.csproj | 2 +- clients/src/MvcHybridBackChannel/Startup.cs | 2 + clients/src/MvcJarUriJwt/MvcJarUriJwt.csproj | 2 +- clients/src/MvcJarUriJwt/Program.cs | 2 +- clients/src/MvcJarUriJwt/Startup.cs | 6 +++ 17 files changed, 33 insertions(+), 82 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 51c879feb..2006f0792 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -525,7 +525,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client-MvcAutomaticTokenManagement", - "program": "${workspaceFolder}/clients/src/MvcAutomaticTokenManagement/bin/Debug/net8.0/MvcAutomaticTokenManagement.dll", + "program": "${workspaceFolder}/clients/src/MvcAutomaticTokenManagement/bin/Debug/net9.0/MvcAutomaticTokenManagement.dll", "args": [], "cwd": "${workspaceFolder}/clients/src/MvcAutomaticTokenManagement", "env": { @@ -542,7 +542,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client-MvcCode", - "program": "${workspaceFolder}/clients/src/MvcCode/bin/Debug/net8.0/MvcCode.dll", + "program": "${workspaceFolder}/clients/src/MvcCode/bin/Debug/net9.0/MvcCode.dll", "args": [], "cwd": "${workspaceFolder}/clients/src/MvcCode", "env": { @@ -559,7 +559,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client-MvcDPoP", - "program": "${workspaceFolder}/clients/src/MvcDPoP/bin/Debug/net8.0/MvcDPoP.dll", + "program": "${workspaceFolder}/clients/src/MvcDPoP/bin/Debug/net9.0/MvcDPoP.dll", "args": [], "cwd": "${workspaceFolder}/clients/src/MvcDPoP", "env": { @@ -571,31 +571,15 @@ "group": "20-clients", }, }, - { - "name": "client: MvcJarPar", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build-client-MvcJarPar", - "program": "${workspaceFolder}/clients/src/MvcJarPar/bin/Debug/net8.0/MvcJarPar.dll", - "args": [], - "cwd": "${workspaceFolder}/clients/src/MvcJarPar", - "console": "externalTerminal", - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "presentation": { - "hidden": false, - "group": "20-clients", - } - }, { "name": "client: MvcHybridBackChannel", "type": "coreclr", "request": "launch", "preLaunchTask": "build-client-MvcHybridBackChannel", - "program": "${workspaceFolder}/clients/src/MvcHybridBackChannel/bin/Debug/net8.0/MvcHybridBackChannel.dll", + "program": "${workspaceFolder}/clients/src/MvcHybridBackChannel/bin/Debug/net9.0/MvcHybridBackChannel.dll", "args": [], "cwd": "${workspaceFolder}/clients/src/MvcHybridBackChannel", + "console": "externalTerminal", "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, @@ -609,9 +593,10 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client-MvcJarJwt", - "program": "${workspaceFolder}/clients/src/MvcJarJwt/bin/Debug/net8.0/MvcJarJwt.dll", + "program": "${workspaceFolder}/clients/src/MvcJarJwt/bin/Debug/net9.0/MvcJarJwt.dll", "args": [], "cwd": "${workspaceFolder}/clients/src/MvcJarJwt", + "console": "externalTerminal", "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, @@ -625,7 +610,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client-MvcJarUriJwt", - "program": "${workspaceFolder}/clients/src/MvcJarUriJwt/bin/Debug/net8.0/MvcJarUriJwt.dll", + "program": "${workspaceFolder}/clients/src/MvcJarUriJwt/bin/Debug/net9.0/MvcJarUriJwt.dll", "args": [], "cwd": "${workspaceFolder}/clients/src/MvcJarUriJwt", "env": { @@ -637,23 +622,6 @@ "group": "20-clients", } }, - { - "name": "client: MvcPar", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build-client-MvcPar", - "program": "${workspaceFolder}/clients/src/MvcPar/bin/Debug/net8.0/MvcPar.dll", - "args": [], - "cwd": "${workspaceFolder}/clients/src/MvcPar", - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "console": "externalTerminal", - "presentation": { - "hidden": false, - "group": "20-clients", - } - }, { "name": "client: WindowsConsoleSystemBrowser", "type": "clr", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a89874bdd..511bb7963 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -399,30 +399,6 @@ ], "problemMatcher": "$msCompile" }, - { - "label": "build-client-MvcPar", - "type": "process", - "command": "dotnet", - "args": [ - "build", - "${workspaceFolder}/clients/src/MvcPar/MvcPar.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "build-client-MvcJarPar", - "type": "process", - "command": "dotnet", - "args": [ - "build", - "${workspaceFolder}/clients/src/MvcJarPar/MvcJarPar.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, { "label": "build-client-MvcHybridBackChannel", "type": "process", diff --git a/Directory.Build.targets b/Directory.Build.targets index 30d9ab9d8..547a4e496 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -16,8 +16,8 @@ - - + + @@ -49,7 +49,7 @@ - + diff --git a/clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj b/clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj index ef9df749d..9bf7f3ba1 100644 --- a/clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj +++ b/clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/clients/src/MvcAutomaticTokenManagement/Program.cs b/clients/src/MvcAutomaticTokenManagement/Program.cs index aa17892ce..3f679873e 100644 --- a/clients/src/MvcAutomaticTokenManagement/Program.cs +++ b/clients/src/MvcAutomaticTokenManagement/Program.cs @@ -14,7 +14,7 @@ public static int Main(string[] args) Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() - .MinimumLevel.Override("IdentityModel", LogEventLevel.Debug) + .MinimumLevel.Override("Duende.IdentityModel", LogEventLevel.Debug) .MinimumLevel.Override("Duende.AccessTokenManagement", LogEventLevel.Debug) .MinimumLevel.Override("System.Net.Http", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information) diff --git a/clients/src/MvcAutomaticTokenManagement/Startup.cs b/clients/src/MvcAutomaticTokenManagement/Startup.cs index c69f52762..ccfd3c5fe 100644 --- a/clients/src/MvcAutomaticTokenManagement/Startup.cs +++ b/clients/src/MvcAutomaticTokenManagement/Startup.cs @@ -74,6 +74,8 @@ public void ConfigureServices(IServiceCollection services) NameClaimType = "name", RoleClaimType = "role" }; + + options.DisableTelemetry = true; }); // add automatic token management diff --git a/clients/src/MvcCode/MvcCode.csproj b/clients/src/MvcCode/MvcCode.csproj index 6350259d5..5a8042fdc 100644 --- a/clients/src/MvcCode/MvcCode.csproj +++ b/clients/src/MvcCode/MvcCode.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 fe28de52-854d-4c0f-a6b5-20f8dea1f70d diff --git a/clients/src/MvcCode/Program.cs b/clients/src/MvcCode/Program.cs index 1261c5cf8..a5b8fbe98 100644 --- a/clients/src/MvcCode/Program.cs +++ b/clients/src/MvcCode/Program.cs @@ -14,9 +14,7 @@ public static void Main(string[] args) Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() - .MinimumLevel.Override("IdentityModel", LogEventLevel.Debug) - .MinimumLevel.Override("System.Net.Http", LogEventLevel.Information) - .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information) + .MinimumLevel.Override("Duende.IdentityModel", LogEventLevel.Debug) .MinimumLevel.Override("MvcCode", LogEventLevel.Debug) .Enrich.FromLogContext() .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}") diff --git a/clients/src/MvcCode/Startup.cs b/clients/src/MvcCode/Startup.cs index 311ad8427..0ad98e11b 100644 --- a/clients/src/MvcCode/Startup.cs +++ b/clients/src/MvcCode/Startup.cs @@ -82,10 +82,7 @@ public void ConfigureServices(IServiceCollection services) RoleClaimType = JwtClaimTypes.Role, }; - options.Events.OnRedirectToIdentityProvider = ctx => - { - return Task.CompletedTask; - }; + options.DisableTelemetry = true; }); // var apiKey = _configuration["HoneyCombApiKey"]; diff --git a/clients/src/MvcDPoP/MvcDPoP.csproj b/clients/src/MvcDPoP/MvcDPoP.csproj index ef9df749d..9bf7f3ba1 100644 --- a/clients/src/MvcDPoP/MvcDPoP.csproj +++ b/clients/src/MvcDPoP/MvcDPoP.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/clients/src/MvcDPoP/Program.cs b/clients/src/MvcDPoP/Program.cs index 637bc61a1..6629bf571 100644 --- a/clients/src/MvcDPoP/Program.cs +++ b/clients/src/MvcDPoP/Program.cs @@ -14,7 +14,7 @@ public static int Main(string[] args) Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() - .MinimumLevel.Override("IdentityModel", LogEventLevel.Debug) + .MinimumLevel.Override("Duende.IdentityModel", LogEventLevel.Debug) .MinimumLevel.Override("Duende.AccessTokenManagement", LogEventLevel.Debug) .MinimumLevel.Override("System.Net.Http", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information) diff --git a/clients/src/MvcDPoP/Startup.cs b/clients/src/MvcDPoP/Startup.cs index 0d4082d3e..59332a5c8 100644 --- a/clients/src/MvcDPoP/Startup.cs +++ b/clients/src/MvcDPoP/Startup.cs @@ -68,6 +68,8 @@ public void ConfigureServices(IServiceCollection services) NameClaimType = "name", RoleClaimType = "role" }; + + options.DisableTelemetry = true; }); services.AddTransient(); diff --git a/clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj b/clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj index 9a62855e3..45f137c54 100644 --- a/clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj +++ b/clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/clients/src/MvcHybridBackChannel/Startup.cs b/clients/src/MvcHybridBackChannel/Startup.cs index a52f2ac0e..ce4879346 100644 --- a/clients/src/MvcHybridBackChannel/Startup.cs +++ b/clients/src/MvcHybridBackChannel/Startup.cs @@ -78,6 +78,8 @@ public void ConfigureServices(IServiceCollection services) NameClaimType = JwtClaimTypes.Name, RoleClaimType = JwtClaimTypes.Role, }; + + options.DisableTelemetry = true; }); // var apiKey = _configuration["HoneyCombApiKey"]; diff --git a/clients/src/MvcJarUriJwt/MvcJarUriJwt.csproj b/clients/src/MvcJarUriJwt/MvcJarUriJwt.csproj index 772ccd9a9..bb7427a2e 100644 --- a/clients/src/MvcJarUriJwt/MvcJarUriJwt.csproj +++ b/clients/src/MvcJarUriJwt/MvcJarUriJwt.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/clients/src/MvcJarUriJwt/Program.cs b/clients/src/MvcJarUriJwt/Program.cs index ff6d9d0b6..fc1a0d383 100644 --- a/clients/src/MvcJarUriJwt/Program.cs +++ b/clients/src/MvcJarUriJwt/Program.cs @@ -14,7 +14,7 @@ public static int Main(string[] args) Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() - .MinimumLevel.Override("IdentityModel", LogEventLevel.Debug) + .MinimumLevel.Override("Duende.IdentityModel", LogEventLevel.Debug) .MinimumLevel.Override("System.Net.Http", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information) .MinimumLevel.Override("MvcJarUriJwt", LogEventLevel.Debug) diff --git a/clients/src/MvcJarUriJwt/Startup.cs b/clients/src/MvcJarUriJwt/Startup.cs index 2d0fc49af..c31e96eb4 100644 --- a/clients/src/MvcJarUriJwt/Startup.cs +++ b/clients/src/MvcJarUriJwt/Startup.cs @@ -6,6 +6,7 @@ using System; using Microsoft.Extensions.Configuration; using Duende.AccessTokenManagement; +using Microsoft.AspNetCore.Authentication.OpenIdConnect; namespace MvcJarUriJwt; @@ -75,6 +76,11 @@ public void ConfigureServices(IServiceCollection services) NameClaimType = "name", RoleClaimType = "role" }; + + // Disable PAR because it is incompatible with sending JAR via request_uri + options.PushedAuthorizationBehavior = PushedAuthorizationBehavior.Disable; + + options.DisableTelemetry = true; }); // add automatic token management