Fix Keycloak HTTPS primary endpoint#17058
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| { | ||
| private const string DefaultAdmin = "admin"; | ||
| internal const string PrimaryEndpointName = "tcp"; | ||
| internal const string PrimaryEndpointName = "http"; |
There was a problem hiding this comment.
This changes the endpoint name to "http" to better match our service discovery URL behavior (and make the HTTPS scheme update behave reliably).
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17058Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17058" |
There was a problem hiding this comment.
Pull request overview
This PR changes Keycloak’s HTTPS handling so the existing primary endpoint is switched to HTTPS when certificate support is enabled, instead of adding a separate HTTPS endpoint. This aligns the configured host port with the endpoint used by clients and helps avoid token issuer mismatches after AppHost restarts.
Changes:
- Switches the Keycloak primary endpoint name constant to the existing
"http"endpoint. - Updates HTTPS certificate handling to mutate the primary endpoint to HTTPS on target port
8443. - Adds a unit test covering primary endpoint mutation and
KC_HTTPS_PORTconfiguration.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Aspire.Hosting.Keycloak/KeycloakResource.cs |
Updates the internal primary endpoint name used by Keycloak configuration. |
src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs |
Changes run-mode HTTPS setup to mutate the primary endpoint and configure Keycloak’s HTTPS port. |
tests/Aspire.Hosting.Keycloak.Tests/KeycloakResourceBuilderTests.cs |
Adds coverage for HTTPS primary endpoint behavior when a certificate annotation is present. |
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
|
/backport to release/13.3 |
|
Started backporting to |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Update the primary Keycloak endpoint to HTTPS rather than simply adding a second HTTPS endpoint when the dev certificate is enabled. This is a breaking change, but fixes an issue where the Keycloak HTTPS endpoint isn't stable leading to previously issued tokens to become invalid on restart.
Fixes #16979
Checklist
<remarks />and<code />elements on your triple slash comments?