Skip to content

Commit

Permalink
Merge pull request #1639 from DuendeSoftware/joe/net9-client-cleanup
Browse files Browse the repository at this point in the history
Update OIDC clients to .NET 9
  • Loading branch information
josephdecock authored Nov 25, 2024
2 parents 3c79ee4 + 9a684ca commit 4b7fb9e
Show file tree
Hide file tree
Showing 121 changed files with 42 additions and 79,735 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
4 changes: 0 additions & 4 deletions Duende.IdentityServer.Clients.sln
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleDcrClient", "clients
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleClientCredentialsFlowDPoP", "clients\src\ConsoleClientCredentialsFlowDPoP\ConsoleClientCredentialsFlowDPoP.csproj", "{5864BB85-B0B3-4061-B7BD-98C67651C1B3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MvcPar", "clients\src\MvcPar\MvcPar.csproj", "{9CAFC6C2-0C6D-4246-A3E1-011AA9CB4240}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MvcJarPar", "clients\src\MvcJarPar\MvcJarPar.csproj", "{DA7F6CEE-3894-4A3F-A0A5-C51F3793C234}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
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/MvcJarJwt/MvcJarJwt.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
8 changes: 4 additions & 4 deletions clients/src/MvcJarJwt/OidcEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public override Task AuthorizationCodeReceived(AuthorizationCodeReceivedContext
return Task.CompletedTask;
}

public override Task RedirectToIdentityProvider(RedirectContext context)
public override Task PushAuthorization(PushedAuthorizationContext context)
{
var request = _assertionService.SignAuthorizationRequest(context.ProtocolMessage);
var clientId = context.ProtocolMessage.ClientId;
var redirectUri = context.ProtocolMessage.RedirectUri;


context.ProtocolMessage.Parameters.Clear();
context.ProtocolMessage.ClientId = clientId;
context.ProtocolMessage.RedirectUri = redirectUri;
context.ProtocolMessage.ClientAssertionType = OidcConstants.ClientAssertionTypes.JwtBearer;
context.ProtocolMessage.ClientAssertion = _assertionService.CreateClientToken();
context.ProtocolMessage.SetParameter("request", request);

return Task.CompletedTask;
Expand Down
6 changes: 2 additions & 4 deletions clients/src/MvcJarJwt/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ public static int Main(string[] args)
Console.Title = "MvcJarJwt";

Log.Logger = new LoggerConfiguration()
.MinimumLevel.Warning()
.MinimumLevel.Override("IdentityModel", LogEventLevel.Debug)
.MinimumLevel.Information()
.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)
.MinimumLevel.Override("MvcJarJwt", LogEventLevel.Debug)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}")
Expand Down
2 changes: 2 additions & 0 deletions clients/src/MvcJarJwt/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void ConfigureServices(IServiceCollection services)
NameClaimType = "name",
RoleClaimType = "role"
};

options.DisableTelemetry = true;
});

// add automatic token management
Expand Down
Loading

0 comments on commit 4b7fb9e

Please sign in to comment.