Skip to content
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
4 changes: 3 additions & 1 deletion IdentityServer/v7/PAT/Api/Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<ItemGroup>
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
</ItemGroup>

<PackageReference Include="Serilog.AspNetCore" />
<ItemGroup>
<ProjectReference Include="..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj" />
</ItemGroup>
</Project>
14 changes: 4 additions & 10 deletions IdentityServer/v7/PAT/Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Api;
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.AddServiceDefaults();

builder.Services.AddControllers();

builder.Services.AddCors();
Expand Down Expand Up @@ -45,6 +37,8 @@

var app = builder.Build();

app.MapDefaultEndpoints();

app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

<ItemGroup>
<PackageReference Include="Duende.IdentityServer" />
<PackageReference Include="Serilog.AspNetCore" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj" />
</ItemGroup>

</Project>
30 changes: 3 additions & 27 deletions IdentityServer/v7/PAT/IdentityServerHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,13 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using IdentityServerHost;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;

Console.Title = "IdentityServerHost";

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\IdentityServerHost.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;
})
.AddTestUsers(TestUsers.Users);

Expand All @@ -46,6 +20,8 @@

var app = builder.Build();

app.MapDefaultEndpoints();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand Down
11 changes: 11 additions & 0 deletions IdentityServer/v7/PAT/PAT.AppHost/AppHost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var builder = DistributedApplication.CreateBuilder(args);

var idp = builder.AddProject<Projects.IdentityServerHost>("identityserverhost");

var api = builder.AddProject<Projects.Api>("api");

builder.AddProject<Projects.Client>("client")
.WaitFor(idp)
.WaitFor(api);

builder.Build().Run();
20 changes: 20 additions & 0 deletions IdentityServer/v7/PAT/PAT.AppHost/PAT.AppHost.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Aspire.AppHost.Sdk/13.2.2">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\IdentityServerHost\IdentityServerHost.csproj" />
<ProjectReference Include="..\Client\Client.csproj" />
<ProjectReference Include="..\Api\Api.csproj" />
</ItemGroup>

</Project>
31 changes: 31 additions & 0 deletions IdentityServer/v7/PAT/PAT.AppHost/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17049;http://localhost:15292",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21176",
"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "https://localhost:23177",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22125"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15292",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19221",
"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "http://localhost:18150",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20035"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions IdentityServer/v7/PAT/PAT.AppHost/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}
34 changes: 31 additions & 3 deletions IdentityServer/v7/PAT/PAT.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "Api\Api.csproj", "{0
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{859F825A-ED53-42D5-B7AD-1287E47CBA8B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PAT.AppHost", "PAT.AppHost\PAT.AppHost.csproj", "{5FAC1976-CFD3-4255-816D-04678E1622CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.ServiceDefaults", "..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj", "{9C546155-C3B2-4D0C-B0AD-FD663F21546A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -18,9 +22,6 @@ Global
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ECFF0234-BC1C-441B-9CF7-72208DDE2D45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECFF0234-BC1C-441B-9CF7-72208DDE2D45}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand Down Expand Up @@ -58,5 +59,32 @@ Global
{859F825A-ED53-42D5-B7AD-1287E47CBA8B}.Release|x64.Build.0 = Release|Any CPU
{859F825A-ED53-42D5-B7AD-1287E47CBA8B}.Release|x86.ActiveCfg = Release|Any CPU
{859F825A-ED53-42D5-B7AD-1287E47CBA8B}.Release|x86.Build.0 = Release|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Debug|x64.ActiveCfg = Debug|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Debug|x64.Build.0 = Debug|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Debug|x86.ActiveCfg = Debug|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Debug|x86.Build.0 = Debug|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Release|Any CPU.Build.0 = Release|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Release|x64.ActiveCfg = Release|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Release|x64.Build.0 = Release|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Release|x86.ActiveCfg = Release|Any CPU
{5FAC1976-CFD3-4255-816D-04678E1622CA}.Release|x86.Build.0 = Release|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Debug|x64.Build.0 = Debug|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Debug|x86.Build.0 = Debug|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Release|Any CPU.Build.0 = Release|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Release|x64.ActiveCfg = Release|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Release|x64.Build.0 = Release|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Release|x86.ActiveCfg = Release|Any CPU
{9C546155-C3B2-4D0C-B0AD-FD663F21546A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion IdentityServer/v8/PAT/Api/Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<ItemGroup>
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
</ItemGroup>

<PackageReference Include="Serilog.AspNetCore" />
<ItemGroup>
<ProjectReference Include="..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj" />
</ItemGroup>
</Project>
14 changes: 4 additions & 10 deletions IdentityServer/v8/PAT/Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Api;
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.AddServiceDefaults();

builder.Services.AddControllers();

builder.Services.AddCors();
Expand Down Expand Up @@ -45,6 +37,8 @@

var app = builder.Build();

app.MapDefaultEndpoints();

app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

<ItemGroup>
<PackageReference Include="Duende.IdentityServer" />
<PackageReference Include="Serilog.AspNetCore" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj" />
</ItemGroup>

</Project>
30 changes: 3 additions & 27 deletions IdentityServer/v8/PAT/IdentityServerHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,13 @@

using IdentityServerHost;
using Microsoft.AspNetCore.DataProtection;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;

Console.Title = "IdentityServerHost";

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\IdentityServerHost.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;
})
.AddTestUsers(TestUsers.Users);

Expand All @@ -52,6 +26,8 @@

var app = builder.Build();

app.MapDefaultEndpoints();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand Down
11 changes: 11 additions & 0 deletions IdentityServer/v8/PAT/PAT.AppHost/AppHost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var builder = DistributedApplication.CreateBuilder(args);

var idp = builder.AddProject<Projects.IdentityServerHost>("identityserverhost");

var api = builder.AddProject<Projects.Api>("api");

builder.AddProject<Projects.Client>("client")
.WaitFor(idp)
.WaitFor(api);

builder.Build().Run();
20 changes: 20 additions & 0 deletions IdentityServer/v8/PAT/PAT.AppHost/PAT.AppHost.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Aspire.AppHost.Sdk/13.2.2">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\IdentityServerHost\IdentityServerHost.csproj" />
<ProjectReference Include="..\Client\Client.csproj" />
<ProjectReference Include="..\Api\Api.csproj" />
</ItemGroup>

</Project>
Loading
Loading