Replies: 5 comments 5 replies
-
With lots of pain, generating a certificate, and wiring it up appropriately. @DamianEdwards has a sample https://github.com/dotnet/aspire-samples/blob/b741f5e78a86539bc9ab12cd7f4a5afea7aa54c4/samples/Keycloak/Keycloak.AppHost/KeycloakExtensions.cs#L18 |
Beta Was this translation helpful? Give feedback.
-
I have one HTTPS problem left. The Keycloak server (inside the container) needs to call the web applications in the host env (backchannel logout). The host.docker.internal is used for this. Do you now if it is possible to configure this to work with HTTPS in .NET Aspire? This will work in production, but dev would be cool as well :) I am thinking of using ngrok, make a public URL and use this for the backchannel post request, but this is not really practical. Demo project: https://github.com/damienbod/keycloak-backchannel Greetings Damien |
Beta Was this translation helpful? Give feedback.
-
@rufer7 Provided this solution which works: var keycloak = builder.AddKeycloakContainer("keycloak",
userName: userName, password: password, port: 8080)
.WithArgs("--features=preview")
.WithArgs("--spi-connections-http-client-default-disable-trust-manager=true")
.WithDataVolume()
.RunWithHttpsDevCertificate(port: 8081); |
Beta Was this translation helpful? Give feedback.
-
I've setup the Keycloak container to use HTTPS in Aspire using the following extension method
An HTTPS endpoint shows up in the aspire dashboard and that works. In my api project I've set up keycloak like this:
The problem is the Keycloak:AuthServerUrl and the TokenEndpointUrl still return the HTTP endpoint NOT the HTTPS endpoint. How do I get Keycloak to default to the configured HTTPS endpoint instead of HTTP? Or what is the appropriate way to configure that on the api side of things? |
Beta Was this translation helpful? Give feedback.
-
I feel silly. I wasn't even using Microsoft's keycloak aspire package (Aspire.Hosting.Keycloak). I was using a different one (Keycloak.AuthServices.Aspire.Hosting). It looks like the AuthServerUrl is hardcoded to http in the library I'm using. Not sure you can switch it... When I try switching to Aspire.Hosting.Keycloak I have other issues, probably related to the aspire workload. I'll just wait until it gets officially released before I switch over to it. |
Beta Was this translation helpful? Give feedback.
-
I want to run the Keycloak container using HTTPS, not HTTP
Any ideas how to set this up?
Beta Was this translation helpful? Give feedback.
All reactions