CZERTAINLY / CZERTAINLY-Helm-Charts

CZERTAINLY - Helm Charts
https://www.czertainly.com
MIT License
4 stars 2 forks source link

hostName change is not correctly propagated into Keycloak #194

Open semik opened 3 months ago

semik commented 3 months ago

Describe the bug

After changing hostName in values file, the new value is not correctly propagated to Keycloak.

To Reproduce Steps to reproduce the behavior:

  1. Install CZERTAINLY with some hostname, for example czertainly11.local.
  2. Check everything is working including login with Keycloak.
  3. Change hostname to some new value, redeploy using helm.
  4. Try to login with username / password, ie. using Keycloak and see error Invalid parameter: redirect_uri. In logs of Keycloak is error message 2024-08-01 07:37:50,362 WARN [org.keycloak.events] (executor-thread-3) type="LOGIN_ERROR", realmId="1595e715-e7d0-417a-8df5-77bbdde4e8d8", clientId="kong", userId="null", ipAddress="192.168.1.12", error="invalid_redirect_uri", redirect_uri="https://czertainly-big.local/login/"

Expected behavior

I think it should be able to change hostname with change in values files for all components of CZERTAINLY.

Screenshots Screenshot at 2024-08-01 09-47-40 Screenshot at 2024-08-01 09-47-48

Additional context

During startup Keycloak print in logs:

2024-08-01 07:27:08,410 INFO  [org.keycloak.exportimport.singlefile.SingleFileImportProvider] (main) Full importing from file /opt/keycloak/bin/../data/import/czertainly_realm.json
2024-08-01 07:27:09,306 INFO  [org.keycloak.exportimport.util.ImportUtils] (main) Realm 'CZERTAINLY' already exists. Import skipped
2024-08-01 07:27:09,318 INFO  [org.keycloak.exportimport.dir.DirImportProvider] (main) Importing from directory /opt/keycloak/bin/../data/import

I underand this that any change in in czertanly_realm.json is ignored after initial import.

Note on screenshot that all URLs have changed, except of the one for kong client. I think that instead of "rootUrl" : "https://{{ required "Hostname must be provided: .Values.czertainly.hostName" $hostName }}", we should use "rootUrl" : "${authBaseUrl}", which is used for example with clientID account-console.

I can test it and when prove be right I can prepare PR for this change. But not right now. If you agree, please assign me this issue and I will proceed.