Skip to content

Logto#1241

Merged
aaronpowell merged 44 commits into
CommunityToolkit:mainfrom
axies20:Logto
Jun 17, 2026
Merged

Logto#1241
aaronpowell merged 44 commits into
CommunityToolkit:mainfrom
axies20:Logto

Conversation

@axies20

@axies20 axies20 commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Closes #<ISSUE_NUMBER>

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

- Introduced `CommunityToolkit.Aspire.Hosting.Logto` project for integrating Logto with PostgreSQL and Redis.
- Added extension methods for configuring Logto containers, health checks, and resource dependencies.
- Created test projects for validating Logto container configuration and health checks.
- Added example projects under `examples/logto` showcasing Logto integration with PostgreSQL and Redis.
- Updated solution file and package references to include the new Logto project.
- Introduced `CommunityToolkit.Aspire.Hosting.Logto.Client` project for integrating Logto client configuration.
- Added `LogtoClientBuilder` for seamless setup of Logto client services in `IHostApplicationBuilder`.
- Implemented connection string helper for parsing Logto connection strings.
- Updated solution and centralized package references to include the new project.
- Introduced `CommunityToolkit.Aspire.Hosting.Logto.ClientApi` under `examples/logto` to demonstrate Logto client integration.
- Added project configuration files (`Program.cs`, `appsettings.json`, `launchSettings.json`) for application setup.
- Renamed `AddLogtoClient` to `AddLogtoSDKClient` in `LogtoClientBuilder`.
- Updated solution and centralized package references to include the new example project and dependencies.
- Introduced a new test project `CommunityToolkit.Aspire.Hosting.Logto.Client.Tests` for validating Logto client behavior.
- Added integration and unit tests for `LogtoClientBuilder` and `LogtoConnectionStringHelper`.
- Implemented OIDC authentication and JWT bearer support in `LogtoClientBuilder`.
- Extended `Program.cs` in `ClientApi` example with authentication routes (`/me`, `/signin`, `/signout`).
- Updated dependencies and centralized package references for added functionalities.
- Modified project and solution files to include updated references.
- Updated method names from `AddLogtoSDKClient` to `AddLogtoOIDC` for better alignment with OIDC usage.
- Enhanced `AddLogtoOIDC` and `AddLogtoJwtBearer` methods to support additional configuration options.
- Added `Microsoft.Extensions.DependencyInjection.Abstractions` package reference to support service registration.
- Updated tests to reflect the method renaming and new configuration capabilities.
- Extended `Program.cs` in the ClientApi example to include `UseAuthentication` and `UseAuthorization`.
- Improved consistency and readability of XML documentation across updated methods.
- Centralized package references for additional dependencies in `Directory.Packages.props`.
- Changed the `ClientApi` project to `ClientOIDC` for better alignment with OIDC standards.
- Updated method signatures in `LogtoClientBuilder` to use `appIndeficator` instead of `appId` and support multiple audience identifiers.
- Improved XML documentation consistency for updated methods.
- Adjusted solution, project references, and configuration files to reflect the renaming and API changes.
- Introduced `CommunityToolkit.Aspire.Hosting.Logto.ClientJWT` project under `examples/logto` to demonstrate Logto JWT authentication.
- Configured authentication and authorization middleware with Logto's JWT Bearer scheme in `Program.cs`.
- Added example routes (`/secure` and `/tokens`) for testing secured endpoint access and token retrieval.
- Updated `AppHost` to include `ClientJWT` project as a dependency.
- Improved XML documentation for `AddLogtoJwtBearer` methods, including updated parameter descriptions and exception handling.
@github-actions

github-actions Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1241

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1241"

@aaronpowell aaronpowell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and comments but the main thing is that the client project shouldn't have Hosting in the name (or namespace).

Comment thread examples/logto/CommunityToolkit.Aspire.Hosting.Logto.ClientJWT/Program.cs Outdated
Comment thread examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/Program.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs Outdated
Comment thread Directory.Packages.props Outdated
axies20 and others added 9 commits March 30, 2026 14:29
…ommunityToolkit.Aspire.Hosting.Logto.AppHost.csproj

Co-authored-by: Aaron Powell <me@aaron-powell.com>
…kit.Aspire.Hosting.Logto.Client.csproj

Co-authored-by: Aaron Powell <me@aaron-powell.com>
- Upgraded `Aspire.AppHost.Sdk` from `13.0.0` to `13.2.0` in `examples/logto/CommunityToolkit.Aspire.Hosting.Logto.AppHost.csproj`.
- Added `Microsoft.AspNetCore.Authentication.JwtBearer` and `Microsoft.AspNetCore.Authentication.OpenIdConnect` package versions to `Directory.Packages.props`.
…o JWT configuration

- Replaced hardcoded API audience with a `const` string in `Program.cs` for improved readability and maintainability.
…ferences

- Renamed `CommunityToolkit.Aspire.Hosting.Logto.Client` to `CommunityToolkit.Aspire.Logto.Client` for improved namespace consistency.
- Updated all project, namespace, and solution references to reflect the renaming.
- Adjusted example projects (`ClientJWT` and `ClientOIDC`) and `AppHost` references accordingly.
@axies20 axies20 requested a review from aaronpowell April 1, 2026 13:36

@aaronpowell aaronpowell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the test list to include the new test projects

@github-actions github-actions Bot added the Stale label Apr 8, 2026
@github-actions github-actions Bot closed this Apr 10, 2026
@axies20

axies20 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

Something wrong? Can it be reopened?

@ErikEJ ErikEJ reopened this Apr 13, 2026
@github-actions github-actions Bot removed the Stale label Apr 14, 2026
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoTags.cs Outdated
@aaronpowell

Copy link
Copy Markdown
Member

Need to bump the SDK version on the example to match the rest of repo - that'd be why the tests are failing

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Logto integration to the Aspire Community Toolkit, including a hosting resource for running Logto in an AppHost and a client library for configuring OIDC/JWT authentication from configuration/connection strings, along with examples and test coverage.

Changes:

  • Added CommunityToolkit.Aspire.Hosting.Logto container resource + builder extensions (PostgreSQL/Redis wiring, health checks, env-var helpers).
  • Added CommunityToolkit.Aspire.Logto.Client extensions for OIDC and JWT bearer setup, including connection-string endpoint parsing.
  • Added examples, tests, solution/workflow wiring, and central package versions needed for the new projects.
Show a summary per file
File Description
tests/CommunityToolkit.Aspire.Logto.Client.Tests/LogtoConnectionStringHelperTests.cs Unit tests for extracting Logto endpoint from connection strings.
tests/CommunityToolkit.Aspire.Logto.Client.Tests/LogtoClientBuilderTests.cs Unit tests for client builder validation/config resolution.
tests/CommunityToolkit.Aspire.Logto.Client.Tests/LogtoClientBuilderIntegrationTests.cs Integration tests asserting authentication scheme/options registration.
tests/CommunityToolkit.Aspire.Logto.Client.Tests/CommunityToolkit.Aspire.Logto.Client.Tests.csproj Test project for Logto client integration.
tests/CommunityToolkit.Aspire.Hosting.Logto.Tests/ResourceCreationTests.cs Unit tests asserting Logto hosting resource creation + health check annotation.
tests/CommunityToolkit.Aspire.Hosting.Logto.Tests/CommunityToolkit.Aspire.Hosting.Logto.Tests.csproj Test project for Logto hosting integration.
tests/CommunityToolkit.Aspire.Hosting.Logto.Tests/AppHostTest.cs Docker-based integration test verifying Logto container starts and responds.
src/CommunityToolkit.Aspire.Logto.Client/LogtoConnectionStringHelper.cs Helper to parse/validate endpoint from connection strings.
src/CommunityToolkit.Aspire.Logto.Client/LogtoClientBuilder.cs Client extensions to add Logto OIDC + JWT bearer authentication.
src/CommunityToolkit.Aspire.Logto.Client/CommunityToolkit.Aspire.Logto.Client.csproj Logto client library project definition + package refs.
src/CommunityToolkit.Aspire.Hosting.Logto/README.md Hosting integration documentation for Logto.
src/CommunityToolkit.Aspire.Hosting.Logto/LogtoTags.cs Container image registry/name/tag constants for Logto.
src/CommunityToolkit.Aspire.Hosting.Logto/LogtoResource.cs Logto container resource model + connection string expression.
src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs Hosting builder extensions for adding/configuring Logto + Postgres/Redis + health checks.
src/CommunityToolkit.Aspire.Hosting.Logto/CommunityToolkit.Aspire.Hosting.Logto.csproj Hosting integration project definition + NuGet metadata.
examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/Properties/launchSettings.json Launch profiles for OIDC sample.
examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/Program.cs Minimal OIDC client sample using AddLogtoOIDC.
examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/CommunityToolkit.Aspire.Logto.ClientOIDC.csproj OIDC sample project definition.
examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/CommunityToolkit.Aspire.Hosting.Logto.Client.http HTTP scratch file for OIDC sample.
examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/appsettings.json App settings for OIDC sample.
examples/logto/CommunityToolkit.Aspire.Logto.ClientJWT/Properties/launchSettings.json Launch profiles for JWT sample.
examples/logto/CommunityToolkit.Aspire.Logto.ClientJWT/Program.cs Minimal JWT bearer sample using AddLogtoJwtBearer.
examples/logto/CommunityToolkit.Aspire.Logto.ClientJWT/CommunityToolkit.Aspire.Logto.ClientJWT.csproj JWT sample project definition.
examples/logto/CommunityToolkit.Aspire.Logto.ClientJWT/CommunityToolkit.Aspire.Hosting.Logto.ClientJWT.http HTTP scratch file for JWT sample.
examples/logto/CommunityToolkit.Aspire.Logto.ClientJWT/appsettings.json App settings for JWT sample.
examples/logto/CommunityToolkit.Aspire.Hosting.Logto.ServiceDefaults/Extensions.cs ServiceDefaults helpers for the Logto examples (OTel/health/etc.).
examples/logto/CommunityToolkit.Aspire.Hosting.Logto.ServiceDefaults/CommunityToolkit.Aspire.Hosting.Logto.ServiceDefaults.csproj ServiceDefaults project definition for Logto examples.
examples/logto/CommunityToolkit.Aspire.Hosting.Logto.AppHost/Properties/launchSettings.json Launch profiles for Logto AppHost example.
examples/logto/CommunityToolkit.Aspire.Hosting.Logto.AppHost/CommunityToolkit.Aspire.Hosting.Logto.AppHost.csproj AppHost example project definition.
examples/logto/CommunityToolkit.Aspire.Hosting.Logto.AppHost/appsettings.json AppHost example logging configuration.
examples/logto/CommunityToolkit.Aspire.Hosting.Logto.AppHost/AppHost.cs AppHost wiring for Postgres + Redis + Logto + client sample projects.
Directory.Packages.props Central package versions for Logto/auth-related packages.
CommunityToolkit.Aspire.slnx Adds new Logto src/tests/examples projects to the solution.
.github/workflows/tests.yaml Adds new Logto test projects to CI test matrix.

Copilot's findings

Comments suppressed due to low confidence (1)

examples/logto/CommunityToolkit.Aspire.Logto.ClientOIDC/Program.cs:17

  • The sample sets RequireHttpsMetadata = false, which disables HTTPS metadata requirement for OIDC and is unsafe outside local development. If this is intended only for local testing, gate it on builder.Environment.IsDevelopment() (or clearly document it) to reduce the chance of copying insecure defaults into production.
},oidcOptions: opt =>
{
    opt.RequireHttpsMetadata = false;
});
  • Files reviewed: 34/34 changed files
  • Comments generated: 25

Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoResource.cs
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoResource.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoResource.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Logto/LogtoTags.cs Outdated
…ommunityToolkit.Aspire.Hosting.Logto.AppHost.csproj
@aaronpowell

Copy link
Copy Markdown
Member

Updated the SDK version but now we're seeing legit failures on the test run - it looks like the backend service might not be starting on the expected port (tests report Connection refused (localhost:3001)).

Also, Copilot has left a stack of comments, can you do an audit on them to see what is accurate and needs addressing.

@github-actions github-actions Bot added the Stale label Jun 5, 2026
@aaronpowell aaronpowell removed the Stale label Jun 15, 2026
@aaronpowell aaronpowell enabled auto-merge (squash) June 17, 2026 06:43
@aaronpowell aaronpowell merged commit 2d5e9c5 into CommunityToolkit:main Jun 17, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants