Skip to content
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

Clean up test clients for v7 release #1507

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
125 changes: 55 additions & 70 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
"program": "${workspaceFolder}/hosts/main/bin/Debug/net8.0/Host.Main.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/main",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -54,10 +50,6 @@
"program": "${workspaceFolder}/hosts/AspNetIdentity/bin/Debug/net8.0/Host.AspNetIdentity.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/AspNetIdentity",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -76,10 +68,6 @@
"program": "${workspaceFolder}/hosts/EntityFramework/bin/Debug/net8.0/Host.EntityFramework.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/EntityFramework",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -98,10 +86,6 @@
"program": "${workspaceFolder}/hosts/Configuration/bin/Debug/net8.0/Host.Configuration.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/Configuration",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down Expand Up @@ -196,6 +180,20 @@
"group": "20-clients",
}
},
{
"name": "client: ConsoleClientCredentialsFlowDPoP",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-client-ConsoleClientCredentialsFlowDPoP",
"program": "${workspaceFolder}/clients/src/ConsoleClientCredentialsFlowDPoP/bin/Debug/net8.0/ConsoleClientCredentialsFlowDPoP.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/ConsoleClientCredentialsFlowDPoP",
"console": "externalTerminal",
"presentation": {
"hidden": false,
"group": "20-clients",
}
},
{
"name": "client: ConsoleClientCredentialsFlowPostBody",
"type": "coreclr",
Expand Down Expand Up @@ -442,10 +440,6 @@
"program": "${workspaceFolder}/clients/src/JsOidc/bin/Debug/net8.0/JsOidc.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/JsOidc",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -462,17 +456,14 @@
"program": "${workspaceFolder}/clients/src/MvcAutomaticTokenManagement/bin/Debug/net8.0/MvcAutomaticTokenManagement.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcAutomaticTokenManagement",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"presentation": {
"hidden": false,
"group": "20-clients",
}
},
"console": "externalTerminal"
},
{
"name": "client: MvcCode",
Expand All @@ -482,17 +473,14 @@
"program": "${workspaceFolder}/clients/src/MvcCode/bin/Debug/net8.0/MvcCode.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcCode",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"presentation": {
"hidden": false,
"group": "20-clients",
}
},
"console": "externalTerminal"
},
{
"name": "client: MvcDPoP",
Expand All @@ -502,37 +490,14 @@
"program": "${workspaceFolder}/clients/src/MvcDPoP/bin/Debug/net8.0/MvcDPoP.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcDPoP",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal",
"presentation": {
"hidden": false,
"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",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"presentation": {
"hidden": false,
"group": "20-clients",
}
},
{
"name": "client: MvcJarPar",
Expand All @@ -542,10 +507,7 @@
"program": "${workspaceFolder}/clients/src/MvcJarPar/bin/Debug/net8.0/MvcJarPar.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcJarPar",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"console": "externalTerminal",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -562,10 +524,6 @@
"program": "${workspaceFolder}/clients/src/MvcHybridBackChannel/bin/Debug/net8.0/MvcHybridBackChannel.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcHybridBackChannel",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -582,10 +540,6 @@
"program": "${workspaceFolder}/clients/src/MvcJarJwt/bin/Debug/net8.0/MvcJarJwt.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcJarJwt",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -602,10 +556,23 @@
"program": "${workspaceFolder}/clients/src/MvcJarUriJwt/bin/Debug/net8.0/MvcJarUriJwt.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/MvcJarUriJwt",
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal",
"presentation": {
"hidden": false,
"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"
},
Expand Down Expand Up @@ -650,6 +617,23 @@
"group": "15-apis",
}
},
{
"name": "api: DPoP",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-api-dpop",
"program": "${workspaceFolder}/clients/src/APIs/DPoPApi/bin/Debug/net8.0/DPoPApi.dll",
"args": [],
"cwd": "${workspaceFolder}/clients/src/APIs/DPoPApi",
"console": "externalTerminal",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"presentation": {
"hidden": false,
"group": "15-apis",
}
},
{
"name": "api: Resource Based",
"type": "coreclr",
Expand All @@ -664,7 +648,8 @@
"presentation": {
"hidden": false,
"group": "15-apis",
}
},
"console": "externalTerminal"
},
],
}
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@
],
"problemMatcher": "$msCompile"
},
{
"label": "build-client-ConsoleClientCredentialsFlowDPoP",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/clients/src/ConsoleClientCredentialsFlowDPoP/ConsoleClientCredentialsFlowDPoP.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-client-ConsoleClientCredentialsFlowPostBody",
"type": "process",
Expand Down Expand Up @@ -475,6 +487,18 @@
],
"problemMatcher": "$msCompile"
},
{
"label": "build-api-dpop",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/clients/src/APIs/DPoPApi/DPoPApi.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-api-resourceBased",
"type": "process",
Expand Down
2 changes: 2 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<ItemGroup>
<!--our stuff -->
<PackageReference Update="IdentityModel" Version="6.2.0"/>
<PackageReference Update="Duende.AccessTokenManagement" Version="2.1.0"/>
<PackageReference Update="Duende.AccessTokenManagement.OpenIdConnect" Version="2.1.0"/>

<!--build related-->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
Expand Down
7 changes: 7 additions & 0 deletions Duende.IdentityServer.Clients.sln
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleClientCredentialsFlo
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 Expand Up @@ -217,6 +219,10 @@ Global
{9CAFC6C2-0C6D-4246-A3E1-011AA9CB4240}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CAFC6C2-0C6D-4246-A3E1-011AA9CB4240}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CAFC6C2-0C6D-4246-A3E1-011AA9CB4240}.Release|Any CPU.Build.0 = Release|Any CPU
{DA7F6CEE-3894-4A3F-A0A5-C51F3793C234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA7F6CEE-3894-4A3F-A0A5-C51F3793C234}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA7F6CEE-3894-4A3F-A0A5-C51F3793C234}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA7F6CEE-3894-4A3F-A0A5-C51F3793C234}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -258,6 +264,7 @@ Global
{D3FF035B-354A-45B9-B610-31BF2C13B360} = {D027D36B-262B-450A-B444-5B7893B5142E}
{5864BB85-B0B3-4061-B7BD-98C67651C1B3} = {D027D36B-262B-450A-B444-5B7893B5142E}
{9CAFC6C2-0C6D-4246-A3E1-011AA9CB4240} = {158628D7-8B68-451E-AF22-B64F473C5943}
{DA7F6CEE-3894-4A3F-A0A5-C51F3793C234} = {158628D7-8B68-451E-AF22-B64F473C5943}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BAD78470-3D66-466E-9C17-2A67F0905B18}
Expand Down
12 changes: 5 additions & 7 deletions clients/src/APIs/DPoPApi/DPoP/DPoPProofValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected virtual Task ValidateHeaderAsync(DPoPProofValidatonContext context, DP
return Task.CompletedTask;
}

if (!token.TryGetHeaderValue<IDictionary<string, object>>(JwtClaimTypes.JsonWebKey, out var jwkValues))
if (!token.TryGetHeaderValue<JsonElement>(JwtClaimTypes.JsonWebKey, out var jwkValues))
{
result.IsError = true;
result.ErrorDescription = "Invalid 'jwk' value.";
Expand Down Expand Up @@ -169,7 +169,7 @@ protected virtual Task ValidateHeaderAsync(DPoPProofValidatonContext context, DP
/// <summary>
/// Validates the signature.
/// </summary>
protected virtual Task ValidateSignatureAsync(DPoPProofValidatonContext context, DPoPProofValidatonResult result)
protected virtual async Task ValidateSignatureAsync(DPoPProofValidatonContext context, DPoPProofValidatonResult result)
{
TokenValidationResult tokenValidationResult;

Expand All @@ -185,27 +185,25 @@ protected virtual Task ValidateSignatureAsync(DPoPProofValidatonContext context,
};

var handler = new JsonWebTokenHandler();
tokenValidationResult = handler.ValidateToken(context.ProofToken, tvp);
tokenValidationResult = await handler.ValidateTokenAsync(context.ProofToken, tvp);
}
catch (Exception ex)
{
Logger.LogDebug("Error parsing DPoP token: {error}", ex.Message);
result.IsError = true;
result.ErrorDescription = "Invalid signature on DPoP token.";
return Task.CompletedTask;
return;
}

if (tokenValidationResult.Exception != null)
{
Logger.LogDebug("Error parsing DPoP token: {error}", tokenValidationResult.Exception.Message);
result.IsError = true;
result.ErrorDescription = "Invalid signature on DPoP token.";
return Task.CompletedTask;
return;
}

result.Payload = tokenValidationResult.Claims;

return Task.CompletedTask;
}

/// <summary>
Expand Down
9 changes: 3 additions & 6 deletions clients/src/APIs/DPoPApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;

namespace DPoPApi
{
Expand All @@ -19,12 +18,10 @@ public static void Main(string[] args)
public static IHost BuildWebHost(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.MinimumLevel.Information()
.MinimumLevel.Override("DPoPApi", LogEventLevel.Debug)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}")
.CreateLogger();

return Host.CreateDefaultBuilder(args)
Expand Down
Loading