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
20 changes: 5 additions & 15 deletions IdentityServer/v7/Apis/ResourceBasedApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
// Copyright (c) Duende Software. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ResourceBasedApi;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;

Console.Title = "Resource based API";
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("System", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.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.AddServiceDefaults();

builder.Services.AddControllers();

builder.Services.AddCors();
Expand Down Expand Up @@ -51,6 +39,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 @@ -2,13 +2,16 @@

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<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>

<!-- Constants and helpers -->
Expand Down
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");

builder.AddProject<Projects.SimpleApi>("simple-api")
.WaitFor(idp);

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

builder.Build().Run();
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\src\IdentityServerHost.csproj" />
<ProjectReference Include="..\src\Client.csproj" />
<ProjectReference Include="..\..\..\Apis\SimpleApi\SimpleApi.csproj" />
</ItemGroup>

</Project>
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:17050;http://localhost:15293",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21177",
"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "https://localhost:23178",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22126"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15293",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19222",
"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "http://localhost:18151",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20036"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
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"
}
}
}
32 changes: 16 additions & 16 deletions IdentityServer/v7/Basics/ClientCredentials/ClientCredentials.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityServerHost", "..\..
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleApi", "..\..\Apis\SimpleApi\SimpleApi.csproj", "{2538D8F8-8265-4C96-9888-DA03306C1CC2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientCredentials.AppHost", "ClientCredentials.AppHost\ClientCredentials.AppHost.csproj", "{62431B35-40B5-43B9-B4B7-BF730DEAA56D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -18,9 +20,6 @@ Global
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand All @@ -34,18 +33,6 @@ Global
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Release|x64.Build.0 = Release|Any CPU
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Release|x86.ActiveCfg = Release|Any CPU
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Release|x86.Build.0 = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x64.ActiveCfg = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x64.Build.0 = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x86.ActiveCfg = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x86.Build.0 = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|Any CPU.Build.0 = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x64.ActiveCfg = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x64.Build.0 = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x86.ActiveCfg = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x86.Build.0 = Release|Any CPU
{62EB4A12-0868-4770-A63C-14FA07F0BF5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62EB4A12-0868-4770-A63C-14FA07F0BF5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62EB4A12-0868-4770-A63C-14FA07F0BF5C}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand All @@ -70,7 +57,20 @@ Global
{2538D8F8-8265-4C96-9888-DA03306C1CC2}.Release|x64.Build.0 = Release|Any CPU
{2538D8F8-8265-4C96-9888-DA03306C1CC2}.Release|x86.ActiveCfg = Release|Any CPU
{2538D8F8-8265-4C96-9888-DA03306C1CC2}.Release|x86.Build.0 = Release|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Debug|x64.ActiveCfg = Debug|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Debug|x64.Build.0 = Debug|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Debug|x86.ActiveCfg = Debug|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Debug|x86.Build.0 = Debug|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Release|Any CPU.Build.0 = Release|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Release|x64.ActiveCfg = Release|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Release|x64.Build.0 = Release|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Release|x86.ActiveCfg = Release|Any CPU
{62431B35-40B5-43B9-B4B7-BF730DEAA56D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
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");

builder.AddProject<Projects.ResourceBasedApi>("resource-based-api")
.WaitFor(idp);

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

builder.Build().Run();
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\src\IdentityServerHost.csproj" />
<ProjectReference Include="..\src\Client.csproj" />
<ProjectReference Include="..\..\..\Apis\ResourceBasedApi\ResourceBasedApi.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15235",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:21135",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:22135"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17235;http://localhost:15235",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21135",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22135"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.DistributedApplication": "Information"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.DistributedApplication": "Information"
}
}
}
32 changes: 16 additions & 16 deletions IdentityServer/v7/Basics/Introspection/Introspection.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityServerHost", "..\..
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceBasedApi", "..\..\Apis\ResourceBasedApi\ResourceBasedApi.csproj", "{47794C35-D331-44C8-B54C-A8EFC6D15147}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Introspection.AppHost", "Introspection.AppHost\Introspection.AppHost.csproj", "{66086001-58EF-499D-933C-0AB86778BB94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -18,9 +20,6 @@ Global
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand All @@ -34,18 +33,6 @@ Global
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Release|x64.Build.0 = Release|Any CPU
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Release|x86.ActiveCfg = Release|Any CPU
{231602F3-72FC-4D10-9BB8-90FCCF662DF6}.Release|x86.Build.0 = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x64.ActiveCfg = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x64.Build.0 = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x86.ActiveCfg = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Debug|x86.Build.0 = Debug|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|Any CPU.Build.0 = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x64.ActiveCfg = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x64.Build.0 = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x86.ActiveCfg = Release|Any CPU
{1F49E1C3-B9BC-42EC-881E-AF42D358EAF5}.Release|x86.Build.0 = Release|Any CPU
{6257F3CF-8198-4861-9080-8C9FA8230BD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6257F3CF-8198-4861-9080-8C9FA8230BD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6257F3CF-8198-4861-9080-8C9FA8230BD5}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand All @@ -70,7 +57,20 @@ Global
{47794C35-D331-44C8-B54C-A8EFC6D15147}.Release|x64.Build.0 = Release|Any CPU
{47794C35-D331-44C8-B54C-A8EFC6D15147}.Release|x86.ActiveCfg = Release|Any CPU
{47794C35-D331-44C8-B54C-A8EFC6D15147}.Release|x86.Build.0 = Release|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Debug|x64.ActiveCfg = Debug|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Debug|x64.Build.0 = Debug|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Debug|x86.ActiveCfg = Debug|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Debug|x86.Build.0 = Debug|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Release|Any CPU.Build.0 = Release|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Release|x64.ActiveCfg = Release|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Release|x64.Build.0 = Release|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Release|x86.ActiveCfg = Release|Any CPU
{66086001-58EF-499D-933C-0AB86778BB94}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
20 changes: 5 additions & 15 deletions IdentityServer/v8/Apis/ResourceBasedApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
// Copyright (c) Duende Software. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ResourceBasedApi;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;

Console.Title = "Resource based API";
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("System", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.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.AddServiceDefaults();

builder.Services.AddControllers();

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

var app = builder.Build();

app.MapDefaultEndpoints();

app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
Expand Down
Loading
Loading