Skip to content

Commit

Permalink
Update oidc clients .net 9
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdecock committed Nov 23, 2024
1 parent 8141915 commit 9a684ca
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 82 deletions.
48 changes: 8 additions & 40 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand All @@ -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": {
Expand All @@ -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"
},
Expand All @@ -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"
},
Expand All @@ -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": {
Expand All @@ -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",
Expand Down
24 changes: 0 additions & 24 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<ItemGroup>
<!--our stuff -->
<PackageReference Update="Duende.IdentityModel" Version="7.0.0"/>
<PackageReference Update="Duende.AccessTokenManagement" Version="2.1.0"/>
<PackageReference Update="Duende.AccessTokenManagement.OpenIdConnect" Version="2.1.0"/>
<PackageReference Update="Duende.AccessTokenManagement" Version="3.1.0-preview.1"/>
<PackageReference Update="Duende.AccessTokenManagement.OpenIdConnect" Version="3.1.0-preview.1"/>

<!--build related-->
<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="All"/>
Expand Down Expand Up @@ -49,7 +49,7 @@
<PackageReference Update="Microsoft.IdentityModel.JsonWebTokens" Version="$(WilsonVersion)"/>
<PackageReference Update="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(WilsonVersion)"/>
<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="$(WilsonVersion)"/>
<PackageReference Update="Serilog.AspNetCore" Version="8.0.2"/>
<PackageReference Update="Serilog.AspNetCore" Version="8.0.3"/>

<!--microsoft asp.net core -->
<PackageReference Update="Microsoft.AspNetCore.DataProtection.Abstractions" Version="$(FrameworkVersion)"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion clients/src/MvcAutomaticTokenManagement/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions clients/src/MvcAutomaticTokenManagement/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public void ConfigureServices(IServiceCollection services)
NameClaimType = "name",
RoleClaimType = "role"
};

options.DisableTelemetry = true;
});

// add automatic token management
Expand Down
2 changes: 1 addition & 1 deletion clients/src/MvcCode/MvcCode.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<UserSecretsId>fe28de52-854d-4c0f-a6b5-20f8dea1f70d</UserSecretsId>
</PropertyGroup>

Expand Down
4 changes: 1 addition & 3 deletions clients/src/MvcCode/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
5 changes: 1 addition & 4 deletions clients/src/MvcCode/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down
2 changes: 1 addition & 1 deletion clients/src/MvcDPoP/MvcDPoP.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion clients/src/MvcDPoP/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions clients/src/MvcDPoP/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public void ConfigureServices(IServiceCollection services)
NameClaimType = "name",
RoleClaimType = "role"
};

options.DisableTelemetry = true;
});

services.AddTransient<IDPoPProofService, CustomProofService>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions clients/src/MvcHybridBackChannel/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public void ConfigureServices(IServiceCollection services)
NameClaimType = JwtClaimTypes.Name,
RoleClaimType = JwtClaimTypes.Role,
};

options.DisableTelemetry = true;
});

// var apiKey = _configuration["HoneyCombApiKey"];
Expand Down
2 changes: 1 addition & 1 deletion clients/src/MvcJarUriJwt/MvcJarUriJwt.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion clients/src/MvcJarUriJwt/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions clients/src/MvcJarUriJwt/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System;
using Microsoft.Extensions.Configuration;
using Duende.AccessTokenManagement;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;

namespace MvcJarUriJwt;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9a684ca

Please sign in to comment.