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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="AngleSharp" Version="1.1.2" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.5.0" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.5.0" />
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="9.5.0" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.5.2" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.5.2" />
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="9.5.2" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.0" />
<PackageVersion Include="BullsEye" Version="5.0.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
Expand Down
2 changes: 1 addition & 1 deletion bff/hosts/Hosts.AppHost/Hosts.AppHost.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.2" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
5 changes: 4 additions & 1 deletion identity-server/aspire/AppHosts/All/All.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.2" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down Expand Up @@ -58,6 +58,9 @@
<ProjectReference Include="..\..\..\hosts\net9\AspNetIdentity9\Host.AspNetIdentity9.csproj" />
<ProjectReference Include="..\..\..\hosts\net9\EntityFramework9\Host.EntityFramework9.csproj" />
<ProjectReference Include="..\..\..\hosts\net9\Main9\Host.Main9.csproj" />
<ProjectReference Include="..\..\..\hosts\net10\AspNetIdentity10\Host.AspNetIdentity10.csproj" />
<ProjectReference Include="..\..\..\hosts\net10\EntityFramework10\Host.EntityFramework10.csproj" />
<ProjectReference Include="..\..\..\hosts\net10\Main10\Host.Main10.csproj" />
<ProjectReference Include="..\..\..\migrations\AspNetIdentityDb\AspNetIdentityDb.csproj" />
<ProjectReference Include="..\..\..\migrations\IdentityServerDb\IdentityServerDb.csproj" />
<ProjectReference Include="..\..\..\templates\src\IdentityServerAspNetIdentity\IdentityServerAspNetIdentity.csproj" />
Expand Down
48 changes: 47 additions & 1 deletion identity-server/aspire/AppHosts/All/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,25 @@ void ConfigureIdentityServerHosts()
projectRegistry.Add("is-host", hostMain);
}

if (HostIsEnabled(nameof(Projects.Host_Main10)))
{
var hostMain = builder
.AddProject<Projects.Host_Main10>("is-host")
.WithHttpHealthCheck(path: "/.well-known/openid-configuration");

projectRegistry.Add("is-host", hostMain);
}


// These hosts require a database
var dbHosts = new List<string>
{
nameof(Projects.Host_AspNetIdentity8),
nameof(Projects.Host_AspNetIdentity9),
nameof(Projects.Host_AspNetIdentity10),
nameof(Projects.Host_EntityFramework8),
nameof(Projects.Host_EntityFramework9)
nameof(Projects.Host_EntityFramework9),
nameof(Projects.Host_EntityFramework10)
};

if (dbHosts.Any(HostIsEnabled))
Expand Down Expand Up @@ -100,6 +112,23 @@ void ConfigureIdentityServerHosts()
projectRegistry.Add("is-host", hostAspNetIdentity);
}

if (HostIsEnabled(nameof(Projects.Host_AspNetIdentity10)))
{
var hostAspNetIdentity = builder.AddProject<Projects.Host_AspNetIdentity10>(name: "is-host")
.WithHttpHealthCheck(path: "/.well-known/openid-configuration")
.WithReference(identityServerDb, connectionName: "DefaultConnection");

if (appConfig.RunDatabaseMigrations)
{
var aspnetMigration = builder.AddProject<Projects.AspNetIdentityDb>(name: "aspnetidentitydb-migrations")
.WithReference(identityServerDb, connectionName: "DefaultConnection")
.WaitFor(identityServerDb);
hostAspNetIdentity.WaitForCompletion(aspnetMigration);
}

projectRegistry.Add("is-host", hostAspNetIdentity);
}

if (HostIsEnabled(nameof(Projects.Host_EntityFramework8)))
{
var hostEntityFramework = builder.AddProject<Projects.Host_EntityFramework8>(name: "is-host")
Expand Down Expand Up @@ -133,6 +162,23 @@ void ConfigureIdentityServerHosts()

projectRegistry.Add("is-host", hostEntityFramework);
}

if (HostIsEnabled(nameof(Projects.Host_EntityFramework10)))
{
var hostEntityFramework = builder.AddProject<Projects.Host_EntityFramework10>(name: "is-host")
.WithHttpHealthCheck(path: "/.well-known/openid-configuration")
.WithReference(identityServerDb, connectionName: "DefaultConnection");

if (appConfig.RunDatabaseMigrations)
{
var idSrvMigration = builder.AddProject<Projects.IdentityServerDb>(name: "identityserverdb-migrations")
.WithReference(identityServerDb, connectionName: "DefaultConnection")
.WaitFor(identityServerDb);
hostEntityFramework.WaitForCompletion(idSrvMigration);
}

projectRegistry.Add("is-host", hostEntityFramework);
}
}

bool HostIsEnabled(string name) =>
Expand Down
2 changes: 1 addition & 1 deletion identity-server/aspire/AppHosts/All/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
},
"AspireProjectConfiguration": {
"IdentityHost": "Host_Main9",
"IdentityHost": "Host_Main10",
"UseClients": {
"ConsoleCibaClient": false,
"ConsoleClientCredentialsFlow": false,
Expand Down
2 changes: 1 addition & 1 deletion identity-server/aspire/AppHosts/Dev/Dev.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.2" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@

var refresh_token = response.RefreshToken;

while (true)
for (var i = 0; i < 10; i++)
{
response = await RefreshTokenAsync(refresh_token);
response.Show();

Thread.Sleep(5000);
Thread.Sleep(50);

await CallServiceAsync(response.AccessToken);

Expand Down
4 changes: 2 additions & 2 deletions identity-server/clients/src/ConsoleScopesResources/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
new() { Enabled = true, Id = "J", Name = "No scope (resource: resource1)", Scope = "", Resource = "urn:resource1" },
new() { Enabled = true, Id = "K", Name = "No scope (resource: resource3)", Scope = "", Resource = "urn:resource3" },
new() { Enabled = true, Id = "L", Name = "Isolated scope without resource parameter", Scope = "resource3.scope1" },
new() { Enabled = true, Id = "M", Name = "Isolated scope without resource parameter", Scope = "resource3.scope1", Resource = "urn:resource3" },
new() { Enabled = true, Id = "N", Name = "Isolated scope without resource parameter", Scope = "resource3.scope1", Resource = "urn:resource2" }
new() { Enabled = true, Id = "M", Name = "Isolated scope with resource parameter", Scope = "resource3.scope1", Resource = "urn:resource3" },
new() { Enabled = true, Id = "N", Name = "Shared scope with resource parameter", Scope = "shared.scope", Resource = "urn:resource2" }
};

// Execute the planned runs
Expand Down
2 changes: 1 addition & 1 deletion identity-server/hosts/Shared/Configuration/TestClients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Duende.IdentityServer.Hosts.Shared.Configuration;

public static class TestClients
{
public static IEnumerable<Client> Get()
public static List<Client> Get()
{
var clients = new List<Client>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected override async Task<IStepResult> AddClientId(DynamicClientRegistration
var clientId = clientIdParameter.ToString();
if (clientId != null)
{
var existingClient = clientStore.FindClientByIdAsync(clientId);
var existingClient = await clientStore.FindClientByIdAsync(clientId);
if (existingClient is not null)
{
return new DynamicClientRegistrationError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See LICENSE in the project root for license information.

using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.UI;
using Duende.IdentityServer.UI.AspNetIdentity.Models;
using IdentityServerHost.Data;
Expand Down Expand Up @@ -122,6 +123,9 @@ internal static WebApplication ConfigurePipeline(this WebApplication app)
app.MapRazorPages()
.RequireAuthorization();

app.MapDynamicClientRegistration()
.AllowAnonymous();

return app;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.

using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Configuration.RequestProcessing;
using Duende.IdentityServer.Hosts.Shared.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI.AspNetIdentity.Models;

namespace IdentityServerHost;
Expand All @@ -26,6 +29,10 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio
.AddInMemoryClients(TestClients.Get())
.AddAspNetIdentity<ApplicationUser>();

builder.Services.AddIdentityServerConfiguration(opt => { })
.AddInMemoryClientConfigurationStore();
builder.Services.AddTransient<IDynamicClientRegistrationRequestProcessor, CustomClientRegistrationProcessor>();

return builder;
}
}
4 changes: 4 additions & 0 deletions identity-server/hosts/net10/Main10/HostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Globalization;
using System.Security.Claims;
using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI;
using Microsoft.AspNetCore.Mvc.Razor;
Expand Down Expand Up @@ -171,6 +172,9 @@ internal static WebApplication ConfigurePipeline(this WebApplication app)
app.MapRazorPages()
.RequireAuthorization();

app.MapDynamicClientRegistration()
.AllowAnonymous();

return app;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Duende.IdentityModel;
using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Configuration.RequestProcessing;
using Duende.IdentityServer.Hosts.Shared.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Microsoft.AspNetCore.Authentication.Certificate;
Expand Down Expand Up @@ -51,7 +52,7 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio
options.Diagnostics.ChunkSize = 1024 * 1000 - 32; // 1 MB minus some formatting space;
})
.AddServerSideSessions()
.AddInMemoryClients([.. TestClients.Get()])
.AddInMemoryClients(TestClients.Get())
.AddInMemoryIdentityResources(TestResources.IdentityResources)
.AddInMemoryApiResources(TestResources.ApiResources)
.AddInMemoryApiScopes(TestResources.ApiScopes)
Expand Down Expand Up @@ -81,6 +82,7 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio

builder.Services.AddIdentityServerConfiguration(opt => { })
.AddInMemoryClientConfigurationStore();
builder.Services.AddTransient<IDynamicClientRegistrationRequestProcessor, CustomClientRegistrationProcessor>();

builder.Services.AddDistributedMemoryCache();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See LICENSE in the project root for license information.

using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.UI;
using Duende.IdentityServer.UI.AspNetIdentity.Models;
using IdentityServerHost.Data;
Expand Down Expand Up @@ -120,6 +121,9 @@ internal static WebApplication ConfigurePipeline(this WebApplication app)
app.MapRazorPages()
.RequireAuthorization();

app.MapDynamicClientRegistration()
.AllowAnonymous();

return app;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.

using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Configuration.RequestProcessing;
using Duende.IdentityServer.Hosts.Shared.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI.AspNetIdentity.Models;

namespace IdentityServerHost;
Expand All @@ -26,6 +29,10 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio
.AddInMemoryClients(TestClients.Get())
.AddAspNetIdentity<ApplicationUser>();

builder.Services.AddIdentityServerConfiguration(opt => { })
.AddInMemoryClientConfigurationStore();
builder.Services.AddTransient<IDynamicClientRegistrationRequestProcessor, CustomClientRegistrationProcessor>();

return builder;
}
}
4 changes: 4 additions & 0 deletions identity-server/hosts/net8/Main8/HostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Globalization;
using System.Security.Claims;
using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI;
using Microsoft.AspNetCore.Mvc.Razor;
Expand Down Expand Up @@ -171,6 +172,9 @@ internal static WebApplication ConfigurePipeline(this WebApplication app)
app.MapRazorPages()
.RequireAuthorization();

app.MapDynamicClientRegistration()
.AllowAnonymous();

return app;
}
}
4 changes: 3 additions & 1 deletion identity-server/hosts/net8/Main8/IdentityServerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Duende.IdentityModel;
using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Configuration.RequestProcessing;
using Duende.IdentityServer.Hosts.Shared.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Microsoft.AspNetCore.Authentication.Certificate;
Expand Down Expand Up @@ -51,7 +52,7 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio
options.Diagnostics.ChunkSize = 1024 * 1000 - 32; // 1 MB minus some formatting space;
})
.AddServerSideSessions()
.AddInMemoryClients([.. TestClients.Get()])
.AddInMemoryClients(TestClients.Get())
.AddInMemoryIdentityResources(TestResources.IdentityResources)
.AddInMemoryApiResources(TestResources.ApiResources)
.AddInMemoryApiScopes(TestResources.ApiScopes)
Expand Down Expand Up @@ -81,6 +82,7 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio

builder.Services.AddIdentityServerConfiguration(opt => { })
.AddInMemoryClientConfigurationStore();
builder.Services.AddTransient<IDynamicClientRegistrationRequestProcessor, CustomClientRegistrationProcessor>();

builder.Services.AddDistributedMemoryCache();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See LICENSE in the project root for license information.

using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.UI;
using Duende.IdentityServer.UI.AspNetIdentity.Models;
using IdentityServerHost.Data;
Expand Down Expand Up @@ -122,6 +123,9 @@ internal static WebApplication ConfigurePipeline(this WebApplication app)
app.MapRazorPages()
.RequireAuthorization();

app.MapDynamicClientRegistration()
.AllowAnonymous();

return app;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.

using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Configuration.RequestProcessing;
using Duende.IdentityServer.Hosts.Shared.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI.AspNetIdentity.Models;

namespace IdentityServerHost;
Expand All @@ -26,6 +29,10 @@ internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicatio
.AddInMemoryClients(TestClients.Get())
.AddAspNetIdentity<ApplicationUser>();

builder.Services.AddIdentityServerConfiguration(opt => { })
.AddInMemoryClientConfigurationStore();
builder.Services.AddTransient<IDynamicClientRegistrationRequestProcessor, CustomClientRegistrationProcessor>();

return builder;
}
}
4 changes: 4 additions & 0 deletions identity-server/hosts/net9/Main9/HostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Globalization;
using System.Security.Claims;
using Duende.IdentityServer;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI;
using Microsoft.AspNetCore.Mvc.Razor;
Expand Down Expand Up @@ -171,6 +172,9 @@ internal static WebApplication ConfigurePipeline(this WebApplication app)
app.MapRazorPages()
.RequireAuthorization();

app.MapDynamicClientRegistration()
.AllowAnonymous();

return app;
}
}
Loading
Loading