Skip to content

Commit

Permalink
Merge pull request #93 from DuendeSoftware/joe/identity-model
Browse files Browse the repository at this point in the history
Update IdentityModel to v7.0.0
  • Loading branch information
josephdecock authored Apr 19, 2024
2 parents 438c54d + 35edb17 commit f460785
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ docs/_build/
tools/

# Visual Studio Code workspace options
.vscode
.vscode/settings.json

# IdentityServer temp files
identityserver4_log.txt
Expand Down
74 changes: 74 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "BlazorServer",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-blazorServer",
"program": "${workspaceFolder}/samples/BlazorServer/bin/Debug/net8.0/BlazorServer.dll",
"args": [],
"cwd": "${workspaceFolder}/samples/BlazorServer",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal"
},
{
"name": "Web",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-web",
"program": "${workspaceFolder}/samples/Web/bin/Debug/net8.0/Web.dll",
"args": [],
"cwd": "${workspaceFolder}/samples/Web",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal"
},
{
"name": "WebJarJwt",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-webJarJwt",
"program": "${workspaceFolder}/samples/WebJarJwt/bin/Debug/net8.0/WebJarJwt.dll",
"args": [],
"cwd": "${workspaceFolder}/samples/WebJarJwt",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal"
},
{
"name": "Worker",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-worker",
"program": "${workspaceFolder}/samples/Worker/bin/Debug/net8.0/Worker.dll",
"args": [],
"cwd": "${workspaceFolder}/samples/Worker",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal"
},
{
"name": "WorkerDI",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-workerDI",
"program": "${workspaceFolder}/samples/WorkerDI/bin/Debug/net8.0/WorkerDI.dll",
"args": [],
"cwd": "${workspaceFolder}/samples/WorkerDI",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal"
}

]
}
77 changes: 77 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-web",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/samples/Web/Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-blazorServer",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/samples/BlazorServer/BlazorServer.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-webJarJwt",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/samples/WebJarJwt/WebJarJwt.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-worker",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/samples/Worker/Worker.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-workerDI",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/samples/WorkerDI/WorkerDI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
14 changes: 7 additions & 7 deletions samples/BlazorServer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
using BlazorServer;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;

Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.CreateBootstrapLogger();

Log.Information("Starting up");

Console.Title = "BlazorServer (Sample)";

try
{
var builder = WebApplication.CreateBuilder(args);

builder.Host.UseSerilog((ctx, lc) => lc
.MinimumLevel.Debug()
.WriteTo.Console(
outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
theme: AnsiConsoleTheme.Code)
.MinimumLevel.Information()
.MinimumLevel.Override("Duende", LogEventLevel.Verbose)
.MinimumLevel.Override("System", LogEventLevel.Error)
.MinimumLevel.Override("Microsoft", LogEventLevel.Error)
.MinimumLevel.Override("System.Net.Http", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}")
.Enrich.FromLogContext());

var app = builder
Expand Down
9 changes: 2 additions & 7 deletions samples/Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@

builder.Host.UseSerilog((ctx, lc) => lc
.WriteTo.Console(
outputTemplate:
"[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
theme: AnsiConsoleTheme.Code)
.MinimumLevel.Debug()
.MinimumLevel.Information()
.MinimumLevel.Override("Duende", LogEventLevel.Verbose)
.MinimumLevel.Override("System", LogEventLevel.Error)
.MinimumLevel.Override("Microsoft", LogEventLevel.Error)
.MinimumLevel.Override("System.Net.Http", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext());

var app = builder
Expand Down
5 changes: 2 additions & 3 deletions samples/Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Security.Cryptography;
using System.Text.Json;
using System.Threading.Tasks;
using Duende.AccessTokenManagement.OpenIdConnect;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
Expand All @@ -19,8 +18,8 @@ public static class Startup
{
public const bool UseDPoP = true;

public const string BaseUrl = "https://localhost:5001";
//public const string BaseUrl = "https://demo.duendesoftware.com";
// public const string BaseUrl = "https://localhost:5001";
public const string BaseUrl = "https://demo.duendesoftware.com";

public const string ApiBaseUrl = UseDPoP ?
$"{BaseUrl}/api/dpop/" :
Expand Down
3 changes: 0 additions & 3 deletions samples/WebJarJwt/ClientAssertionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace WebJarJwt;

public class ClientAssertionService : IClientAssertionService
{
private readonly IOptionsSnapshot<ClientCredentialsClient> _options;
private readonly IOpenIdConnectConfigurationService _configurationService;

private static string RsaKey =
Expand All @@ -39,10 +38,8 @@ public class ClientAssertionService : IClientAssertionService
private static SigningCredentials Credential = new(new JsonWebKey(RsaKey), "RS256");

public ClientAssertionService(
IOptionsSnapshot<ClientCredentialsClient> options,
IOpenIdConnectConfigurationService configurationService)
{
_options = options;
_configurationService = configurationService;
}

Expand Down
11 changes: 4 additions & 7 deletions samples/WebJarJwt/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@

Log.Information("Host.Main Starting up");

Console.Title = "WebJarJwt (Sample)";

try
{
var builder = WebApplication.CreateBuilder(args);

builder.Host.UseSerilog((ctx, lc) => lc
.WriteTo.Console(
outputTemplate:
"[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
theme: AnsiConsoleTheme.Code)
.MinimumLevel.Debug()
.MinimumLevel.Information()
.MinimumLevel.Override("Duende", LogEventLevel.Verbose)
.MinimumLevel.Override("System", LogEventLevel.Error)
.MinimumLevel.Override("Microsoft", LogEventLevel.Error)
.MinimumLevel.Override("System.Net.Http", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext());

var app = builder
Expand Down
4 changes: 2 additions & 2 deletions samples/Worker/ClientAssertionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace WorkerService;

public class ClientAssertionService : IClientAssertionService
{
private readonly IOptionsSnapshot<ClientCredentialsClient> _options;
private readonly IOptionsMonitor<ClientCredentialsClient> _options;

private static string RsaKey =
"""
Expand All @@ -35,7 +35,7 @@ public class ClientAssertionService : IClientAssertionService

private static SigningCredentials Credential = new (new JsonWebKey(RsaKey), "RS256");

public ClientAssertionService(IOptionsSnapshot<ClientCredentialsClient> options)
public ClientAssertionService(IOptionsMonitor<ClientCredentialsClient> options)
{
_options = options;
}
Expand Down
4 changes: 2 additions & 2 deletions samples/WorkerDI/ClientAssertionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace WorkerService;

public class ClientAssertionService : IClientAssertionService
{
private readonly IOptionsSnapshot<ClientCredentialsClient> _options;
private readonly IOptionsMonitor<ClientCredentialsClient> _options;

private static string RsaKey =
"""
Expand All @@ -35,7 +35,7 @@ public class ClientAssertionService : IClientAssertionService

private static SigningCredentials Credential = new (new JsonWebKey(RsaKey), "RS256");

public ClientAssertionService(IOptionsSnapshot<ClientCredentialsClient> options)
public ClientAssertionService(IOptionsMonitor<ClientCredentialsClient> options)
{
_options = options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


<ItemGroup>
<PackageReference Include="IdentityModel" Version="6.2.0" />
<PackageReference Include="IdentityModel" Version="7.0.0" />

<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
Expand Down

0 comments on commit f460785

Please sign in to comment.