diff --git a/IdentityServer/v7/UserInteraction/ProfileService/Api/Api.csproj b/IdentityServer/v7/UserInteraction/ProfileService/Api/Api.csproj
deleted file mode 100644
index 401a52fa..00000000
--- a/IdentityServer/v7/UserInteraction/ProfileService/Api/Api.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net10.0
- enable
-
-
-
-
-
-
-
-
-
-
-
- Shared\Constants.cs
-
-
-
-
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/Api/IdentityController.cs b/IdentityServer/v7/UserInteraction/ProfileService/Api/IdentityController.cs
deleted file mode 100644
index 21b2e6f9..00000000
--- a/IdentityServer/v7/UserInteraction/ProfileService/Api/IdentityController.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Duende Software. All rights reserved.
-// Licensed under the MIT License. See LICENSE in the project root for license information.
-
-using Microsoft.AspNetCore.Mvc;
-
-namespace Api;
-
-[Route("identity")]
-public class IdentityController : ControllerBase
-{
- private readonly ILogger _logger;
-
- public IdentityController(ILogger logger)
- {
- _logger = logger;
- }
-
- // this action simply echoes the claims back to the client
- [HttpGet]
- public ActionResult Get()
- {
- var claims = User.Claims.Select(c => new { c.Type, c.Value });
- _logger.LogInformation("claims: {claims}", claims);
-
- return new JsonResult(claims);
- }
-}
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/Api/Program.cs b/IdentityServer/v7/UserInteraction/ProfileService/Api/Program.cs
deleted file mode 100644
index 7480249f..00000000
--- a/IdentityServer/v7/UserInteraction/ProfileService/Api/Program.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) Duende Software. All rights reserved.
-// Licensed under the MIT License. See LICENSE in the project root for license information.
-
-using Client;
-using Serilog;
-using Serilog.Sinks.SystemConsole.Themes;
-
-Console.Title = "API";
-
-Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Information()
- .Enrich.FromLogContext()
- .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
- .CreateLogger();
-
-var builder = WebApplication.CreateBuilder(args);
-
-builder.Services.AddSerilog();
-builder.Services.AddControllers();
-
-// this API will accept any access token from the authority
-builder.Services.AddAuthentication("token")
- .AddJwtBearer("token", options =>
- {
- options.Authority = Urls.IdentityServer;
- options.TokenValidationParameters.ValidateAudience = false;
-
- options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };
- options.MapInboundClaims = false;
- });
-
-var app = builder.Build();
-
-app.UseRouting();
-app.UseAuthentication();
-app.UseAuthorization();
-
-app.MapControllers().RequireAuthorization();
-
-app.Run();
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/Api/Properties/launchSettings.json b/IdentityServer/v7/UserInteraction/ProfileService/Api/Properties/launchSettings.json
deleted file mode 100644
index eedda964..00000000
--- a/IdentityServer/v7/UserInteraction/ProfileService/Api/Properties/launchSettings.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "profiles": {
- "Api": {
- "commandName": "Project",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "applicationUrl": "https://localhost:5002"
- }
- }
-}
\ No newline at end of file
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/Client/Client.csproj b/IdentityServer/v7/UserInteraction/ProfileService/Client/Client.csproj
index 27b0f887..f0120d11 100644
--- a/IdentityServer/v7/UserInteraction/ProfileService/Client/Client.csproj
+++ b/IdentityServer/v7/UserInteraction/ProfileService/Client/Client.csproj
@@ -18,5 +18,8 @@
Shared\Constants.cs
+
+
+
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/Client/Program.cs b/IdentityServer/v7/UserInteraction/ProfileService/Client/Program.cs
index a6df61d3..f6d6b614 100644
--- a/IdentityServer/v7/UserInteraction/ProfileService/Client/Program.cs
+++ b/IdentityServer/v7/UserInteraction/ProfileService/Client/Program.cs
@@ -9,6 +9,8 @@
var builder = WebApplication.CreateBuilder(args);
+builder.AddServiceDefaults();
+
builder.Services.AddControllersWithViews();
builder.Services.AddHttpClient();
@@ -63,6 +65,8 @@
var app = builder.Build();
+app.MapDefaultEndpoints();
+
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj b/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj
index 7ff6b6d4..c2d7ebdb 100644
--- a/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj
+++ b/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj
@@ -7,7 +7,10 @@
-
+
+
+
+
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/Program.cs b/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/Program.cs
index eb81dc01..07756253 100644
--- a/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/Program.cs
+++ b/IdentityServer/v7/UserInteraction/ProfileService/IdentityServerHost/Program.cs
@@ -4,40 +4,15 @@
using Duende.IdentityServer;
using IdentityServerHost;
using Microsoft.AspNetCore.DataProtection;
-using Serilog;
-using Serilog.Events;
-using Serilog.Sinks.SystemConsole.Themes;
-
-Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Debug()
- .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
- .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
- .MinimumLevel.Override("System", LogEventLevel.Warning)
- .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
- .Enrich.FromLogContext()
- // uncomment to write to Azure diagnostics stream
- //.WriteTo.File(
- // @"D:\home\LogFiles\Application\identityserver.txt",
- // fileSizeLimitBytes: 1_000_000,
- // rollOnFileSizeLimit: true,
- // shared: true,
- // flushToDiskInterval: TimeSpan.FromSeconds(1))
- .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
- .CreateLogger();
var builder = WebApplication.CreateBuilder(args);
-builder.Services.AddSerilog();
+builder.AddServiceDefaults();
builder.Services.AddRazorPages();
var idsvrBuilder = builder.Services.AddIdentityServer(options =>
{
- options.Events.RaiseErrorEvents = true;
- options.Events.RaiseInformationEvents = true;
- options.Events.RaiseFailureEvents = true;
- options.Events.RaiseSuccessEvents = true;
-
// see https://docs.duendesoftware.com/identityserver/fundamentals/resources/
options.EmitStaticAudienceClaim = true;
})
@@ -72,6 +47,8 @@
var app = builder.Build();
+app.MapDefaultEndpoints();
+
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/AppHost.cs b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/AppHost.cs
new file mode 100644
index 00000000..b4594a80
--- /dev/null
+++ b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/AppHost.cs
@@ -0,0 +1,11 @@
+var builder = DistributedApplication.CreateBuilder(args);
+
+var idp = builder.AddProject("identityserverhost");
+
+var api = builder.AddProject("simpleapi");
+
+builder.AddProject("client")
+ .WaitFor(idp)
+ .WaitFor(api);
+
+builder.Build().Run();
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/ProfileService.AppHost.csproj b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/ProfileService.AppHost.csproj
new file mode 100644
index 00000000..967d8ff8
--- /dev/null
+++ b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/ProfileService.AppHost.csproj
@@ -0,0 +1,21 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+ 5c75dcd6-9173-476d-85f7-b7e4eacdf45d
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/Properties/launchSettings.json b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/Properties/launchSettings.json
new file mode 100644
index 00000000..26845a92
--- /dev/null
+++ b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/Properties/launchSettings.json
@@ -0,0 +1,31 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:17047;http://localhost:15290",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "DOTNET_ENVIRONMENT": "Development",
+ "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21174",
+ "ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "https://localhost:23175",
+ "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22123"
+ }
+ },
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:15290",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "DOTNET_ENVIRONMENT": "Development",
+ "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19219",
+ "ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "http://localhost:18148",
+ "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20033"
+ }
+ }
+ }
+}
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.Development.json b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.Development.json
new file mode 100644
index 00000000..0c208ae9
--- /dev/null
+++ b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.json b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.json
new file mode 100644
index 00000000..31c092aa
--- /dev/null
+++ b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning",
+ "Aspire.Hosting.Dcp": "Warning"
+ }
+ }
+}
diff --git a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.sln b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.sln
index d8a679ee..0547d161 100644
--- a/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.sln
+++ b/IdentityServer/v7/UserInteraction/ProfileService/ProfileService.sln
@@ -7,26 +7,82 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServerHost", "Ident
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client\Client.csproj", "{7E6CC06C-13D3-4754-BC55-E224C42F5F78}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "Api\Api.csproj", "{D87B7842-E586-4DC4-95E1-539841AB5FF0}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleApi", "..\..\Apis\SimpleApi\SimpleApi.csproj", "{39063407-1CFA-4AB0-82A4-958BF215758B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfileService.AppHost", "ProfileService.AppHost\ProfileService.AppHost.csproj", "{1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.ServiceDefaults", "..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj", "{0D5D1788-E500-4944-9A72-F46A5E641D47}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0E801369-EC29-497E-9D41-403E4111F672}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E801369-EC29-497E-9D41-403E4111F672}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Debug|x64.Build.0 = Debug|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Debug|x86.Build.0 = Debug|Any CPU
{0E801369-EC29-497E-9D41-403E4111F672}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E801369-EC29-497E-9D41-403E4111F672}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Release|x64.ActiveCfg = Release|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Release|x64.Build.0 = Release|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Release|x86.ActiveCfg = Release|Any CPU
+ {0E801369-EC29-497E-9D41-403E4111F672}.Release|x86.Build.0 = Release|Any CPU
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|x64.Build.0 = Debug|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|x86.Build.0 = Debug|Any CPU
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|Any CPU.Build.0 = Release|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|x64.ActiveCfg = Release|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|x64.Build.0 = Release|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|x86.ActiveCfg = Release|Any CPU
+ {7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|x86.Build.0 = Release|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Debug|x64.Build.0 = Debug|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Debug|x86.Build.0 = Debug|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Release|x64.ActiveCfg = Release|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Release|x64.Build.0 = Release|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Release|x86.ActiveCfg = Release|Any CPU
+ {39063407-1CFA-4AB0-82A4-958BF215758B}.Release|x86.Build.0 = Release|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Debug|x64.Build.0 = Debug|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Debug|x86.Build.0 = Debug|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Release|x64.ActiveCfg = Release|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Release|x64.Build.0 = Release|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Release|x86.ActiveCfg = Release|Any CPU
+ {1DCE85A2-4D3B-4DD0-B582-A3D09DAA8028}.Release|x86.Build.0 = Release|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Debug|x64.Build.0 = Debug|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Debug|x86.Build.0 = Debug|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Release|x64.ActiveCfg = Release|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Release|x64.Build.0 = Release|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Release|x86.ActiveCfg = Release|Any CPU
+ {0D5D1788-E500-4944-9A72-F46A5E641D47}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/Api/Api.csproj b/IdentityServer/v8/UserInteraction/ProfileService/Api/Api.csproj
deleted file mode 100644
index 401a52fa..00000000
--- a/IdentityServer/v8/UserInteraction/ProfileService/Api/Api.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net10.0
- enable
-
-
-
-
-
-
-
-
-
-
-
- Shared\Constants.cs
-
-
-
-
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/Api/IdentityController.cs b/IdentityServer/v8/UserInteraction/ProfileService/Api/IdentityController.cs
deleted file mode 100644
index 21b2e6f9..00000000
--- a/IdentityServer/v8/UserInteraction/ProfileService/Api/IdentityController.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Duende Software. All rights reserved.
-// Licensed under the MIT License. See LICENSE in the project root for license information.
-
-using Microsoft.AspNetCore.Mvc;
-
-namespace Api;
-
-[Route("identity")]
-public class IdentityController : ControllerBase
-{
- private readonly ILogger _logger;
-
- public IdentityController(ILogger logger)
- {
- _logger = logger;
- }
-
- // this action simply echoes the claims back to the client
- [HttpGet]
- public ActionResult Get()
- {
- var claims = User.Claims.Select(c => new { c.Type, c.Value });
- _logger.LogInformation("claims: {claims}", claims);
-
- return new JsonResult(claims);
- }
-}
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/Api/Program.cs b/IdentityServer/v8/UserInteraction/ProfileService/Api/Program.cs
deleted file mode 100644
index 7480249f..00000000
--- a/IdentityServer/v8/UserInteraction/ProfileService/Api/Program.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) Duende Software. All rights reserved.
-// Licensed under the MIT License. See LICENSE in the project root for license information.
-
-using Client;
-using Serilog;
-using Serilog.Sinks.SystemConsole.Themes;
-
-Console.Title = "API";
-
-Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Information()
- .Enrich.FromLogContext()
- .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
- .CreateLogger();
-
-var builder = WebApplication.CreateBuilder(args);
-
-builder.Services.AddSerilog();
-builder.Services.AddControllers();
-
-// this API will accept any access token from the authority
-builder.Services.AddAuthentication("token")
- .AddJwtBearer("token", options =>
- {
- options.Authority = Urls.IdentityServer;
- options.TokenValidationParameters.ValidateAudience = false;
-
- options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };
- options.MapInboundClaims = false;
- });
-
-var app = builder.Build();
-
-app.UseRouting();
-app.UseAuthentication();
-app.UseAuthorization();
-
-app.MapControllers().RequireAuthorization();
-
-app.Run();
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/Api/Properties/launchSettings.json b/IdentityServer/v8/UserInteraction/ProfileService/Api/Properties/launchSettings.json
deleted file mode 100644
index eedda964..00000000
--- a/IdentityServer/v8/UserInteraction/ProfileService/Api/Properties/launchSettings.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "profiles": {
- "Api": {
- "commandName": "Project",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "applicationUrl": "https://localhost:5002"
- }
- }
-}
\ No newline at end of file
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/Client/Client.csproj b/IdentityServer/v8/UserInteraction/ProfileService/Client/Client.csproj
index 27b0f887..f0120d11 100644
--- a/IdentityServer/v8/UserInteraction/ProfileService/Client/Client.csproj
+++ b/IdentityServer/v8/UserInteraction/ProfileService/Client/Client.csproj
@@ -18,5 +18,8 @@
Shared\Constants.cs
+
+
+
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/Client/Program.cs b/IdentityServer/v8/UserInteraction/ProfileService/Client/Program.cs
index a6df61d3..4f21b942 100644
--- a/IdentityServer/v8/UserInteraction/ProfileService/Client/Program.cs
+++ b/IdentityServer/v8/UserInteraction/ProfileService/Client/Program.cs
@@ -9,6 +9,7 @@
var builder = WebApplication.CreateBuilder(args);
+builder.AddServiceDefaults();
builder.Services.AddControllersWithViews();
builder.Services.AddHttpClient();
@@ -70,6 +71,7 @@
app.UseAuthentication();
app.UseAuthorization();
+app.MapDefaultEndpoints();
app.MapDefaultControllerRoute().RequireAuthorization();
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj b/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj
index 7ff6b6d4..c2d7ebdb 100644
--- a/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj
+++ b/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/IdentityServerHost.csproj
@@ -7,7 +7,10 @@
-
+
+
+
+
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/Program.cs b/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/Program.cs
index eb81dc01..17c7a0d7 100644
--- a/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/Program.cs
+++ b/IdentityServer/v8/UserInteraction/ProfileService/IdentityServerHost/Program.cs
@@ -4,40 +4,15 @@
using Duende.IdentityServer;
using IdentityServerHost;
using Microsoft.AspNetCore.DataProtection;
-using Serilog;
-using Serilog.Events;
-using Serilog.Sinks.SystemConsole.Themes;
-
-Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Debug()
- .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
- .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
- .MinimumLevel.Override("System", LogEventLevel.Warning)
- .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
- .Enrich.FromLogContext()
- // uncomment to write to Azure diagnostics stream
- //.WriteTo.File(
- // @"D:\home\LogFiles\Application\identityserver.txt",
- // fileSizeLimitBytes: 1_000_000,
- // rollOnFileSizeLimit: true,
- // shared: true,
- // flushToDiskInterval: TimeSpan.FromSeconds(1))
- .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
- .CreateLogger();
var builder = WebApplication.CreateBuilder(args);
-builder.Services.AddSerilog();
+builder.AddServiceDefaults();
builder.Services.AddRazorPages();
var idsvrBuilder = builder.Services.AddIdentityServer(options =>
{
- options.Events.RaiseErrorEvents = true;
- options.Events.RaiseInformationEvents = true;
- options.Events.RaiseFailureEvents = true;
- options.Events.RaiseSuccessEvents = true;
-
// see https://docs.duendesoftware.com/identityserver/fundamentals/resources/
options.EmitStaticAudienceClaim = true;
})
@@ -81,6 +56,7 @@
app.UseRouting();
app.UseIdentityServer();
+app.MapDefaultEndpoints();
app.UseAuthorization();
app.MapRazorPages();
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/AppHost.cs b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/AppHost.cs
new file mode 100644
index 00000000..b4594a80
--- /dev/null
+++ b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/AppHost.cs
@@ -0,0 +1,11 @@
+var builder = DistributedApplication.CreateBuilder(args);
+
+var idp = builder.AddProject("identityserverhost");
+
+var api = builder.AddProject("simpleapi");
+
+builder.AddProject("client")
+ .WaitFor(idp)
+ .WaitFor(api);
+
+builder.Build().Run();
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/ProfileService.AppHost.csproj b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/ProfileService.AppHost.csproj
new file mode 100644
index 00000000..967d8ff8
--- /dev/null
+++ b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/ProfileService.AppHost.csproj
@@ -0,0 +1,21 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+ 5c75dcd6-9173-476d-85f7-b7e4eacdf45d
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/Properties/launchSettings.json b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/Properties/launchSettings.json
new file mode 100644
index 00000000..26845a92
--- /dev/null
+++ b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/Properties/launchSettings.json
@@ -0,0 +1,31 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:17047;http://localhost:15290",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "DOTNET_ENVIRONMENT": "Development",
+ "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21174",
+ "ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "https://localhost:23175",
+ "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22123"
+ }
+ },
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:15290",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "DOTNET_ENVIRONMENT": "Development",
+ "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19219",
+ "ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "http://localhost:18148",
+ "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20033"
+ }
+ }
+ }
+}
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.Development.json b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.Development.json
new file mode 100644
index 00000000..0c208ae9
--- /dev/null
+++ b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.json b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.json
new file mode 100644
index 00000000..31c092aa
--- /dev/null
+++ b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.AppHost/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning",
+ "Aspire.Hosting.Dcp": "Warning"
+ }
+ }
+}
diff --git a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.sln b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.sln
index d8a679ee..e9bc0076 100644
--- a/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.sln
+++ b/IdentityServer/v8/UserInteraction/ProfileService/ProfileService.sln
@@ -7,7 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServerHost", "Ident
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client\Client.csproj", "{7E6CC06C-13D3-4754-BC55-E224C42F5F78}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "Api\Api.csproj", "{D87B7842-E586-4DC4-95E1-539841AB5FF0}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleApi", "..\..\Apis\SimpleApi\SimpleApi.csproj", "{5CF39E20-FAC2-4AD4-821E-D339546F205E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfileService.AppHost", "ProfileService.AppHost\ProfileService.AppHost.csproj", "{A55F3C32-881C-483D-985B-E6EFA28FD0A0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.ServiceDefaults", "..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj", "{F919D00F-BFC0-4FD0-93EF-5D2C116C3E86}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,10 +27,18 @@ Global
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E6CC06C-13D3-4754-BC55-E224C42F5F78}.Release|Any CPU.Build.0 = Release|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D87B7842-E586-4DC4-95E1-539841AB5FF0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5CF39E20-FAC2-4AD4-821E-D339546F205E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5CF39E20-FAC2-4AD4-821E-D339546F205E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5CF39E20-FAC2-4AD4-821E-D339546F205E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5CF39E20-FAC2-4AD4-821E-D339546F205E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A55F3C32-881C-483D-985B-E6EFA28FD0A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A55F3C32-881C-483D-985B-E6EFA28FD0A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A55F3C32-881C-483D-985B-E6EFA28FD0A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A55F3C32-881C-483D-985B-E6EFA28FD0A0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F919D00F-BFC0-4FD0-93EF-5D2C116C3E86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F919D00F-BFC0-4FD0-93EF-5D2C116C3E86}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F919D00F-BFC0-4FD0-93EF-5D2C116C3E86}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F919D00F-BFC0-4FD0-93EF-5D2C116C3E86}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE