diff --git a/.gitignore b/.gitignore index d2211d0..504f734 100644 --- a/.gitignore +++ b/.gitignore @@ -201,7 +201,7 @@ docs/_build/ tools/ # Visual Studio Code workspace options -.vscode +.vscode/settings.json # IdentityServer temp files identityserver4_log.txt diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..dfa7310 --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f418e86 --- /dev/null +++ b/.vscode/tasks.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/samples/BlazorServer/Program.cs b/samples/BlazorServer/Program.cs index e7afc44..d7e28b0 100644 --- a/samples/BlazorServer/Program.cs +++ b/samples/BlazorServer/Program.cs @@ -1,6 +1,7 @@ using BlazorServer; using Serilog; using Serilog.Events; +using Serilog.Sinks.SystemConsole.Themes; Log.Logger = new LoggerConfiguration() .WriteTo.Console() @@ -8,18 +9,17 @@ 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 diff --git a/samples/Web/Program.cs b/samples/Web/Program.cs index 2f53d26..60ff8ec 100644 --- a/samples/Web/Program.cs +++ b/samples/Web/Program.cs @@ -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 diff --git a/samples/Web/Startup.cs b/samples/Web/Startup.cs index cc7ef7b..fa2ee45 100755 --- a/samples/Web/Startup.cs +++ b/samples/Web/Startup.cs @@ -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; @@ -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/" : diff --git a/samples/WebJarJwt/ClientAssertionService.cs b/samples/WebJarJwt/ClientAssertionService.cs index 7b8b936..2ebdf5a 100644 --- a/samples/WebJarJwt/ClientAssertionService.cs +++ b/samples/WebJarJwt/ClientAssertionService.cs @@ -17,7 +17,6 @@ namespace WebJarJwt; public class ClientAssertionService : IClientAssertionService { - private readonly IOptionsSnapshot _options; private readonly IOpenIdConnectConfigurationService _configurationService; private static string RsaKey = @@ -39,10 +38,8 @@ public class ClientAssertionService : IClientAssertionService private static SigningCredentials Credential = new(new JsonWebKey(RsaKey), "RS256"); public ClientAssertionService( - IOptionsSnapshot options, IOpenIdConnectConfigurationService configurationService) { - _options = options; _configurationService = configurationService; } diff --git a/samples/WebJarJwt/Program.cs b/samples/WebJarJwt/Program.cs index 2636f8c..11a64aa 100644 --- a/samples/WebJarJwt/Program.cs +++ b/samples/WebJarJwt/Program.cs @@ -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 diff --git a/samples/Worker/ClientAssertionService.cs b/samples/Worker/ClientAssertionService.cs index 6507920..45f8895 100644 --- a/samples/Worker/ClientAssertionService.cs +++ b/samples/Worker/ClientAssertionService.cs @@ -15,7 +15,7 @@ namespace WorkerService; public class ClientAssertionService : IClientAssertionService { - private readonly IOptionsSnapshot _options; + private readonly IOptionsMonitor _options; private static string RsaKey = """ @@ -35,7 +35,7 @@ public class ClientAssertionService : IClientAssertionService private static SigningCredentials Credential = new (new JsonWebKey(RsaKey), "RS256"); - public ClientAssertionService(IOptionsSnapshot options) + public ClientAssertionService(IOptionsMonitor options) { _options = options; } diff --git a/samples/WorkerDI/ClientAssertionService.cs b/samples/WorkerDI/ClientAssertionService.cs index 8b55778..676dcae 100644 --- a/samples/WorkerDI/ClientAssertionService.cs +++ b/samples/WorkerDI/ClientAssertionService.cs @@ -15,7 +15,7 @@ namespace WorkerService; public class ClientAssertionService : IClientAssertionService { - private readonly IOptionsSnapshot _options; + private readonly IOptionsMonitor _options; private static string RsaKey = """ @@ -35,7 +35,7 @@ public class ClientAssertionService : IClientAssertionService private static SigningCredentials Credential = new (new JsonWebKey(RsaKey), "RS256"); - public ClientAssertionService(IOptionsSnapshot options) + public ClientAssertionService(IOptionsMonitor options) { _options = options; } diff --git a/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj b/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj index 2cfe6c0..cc934c5 100644 --- a/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj +++ b/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj @@ -11,7 +11,7 @@ - +