diff --git a/Server/src/SOR.Admin/Program.cs b/Server/src/SOR.Admin/Program.cs index e4d863c..e1f78f7 100644 --- a/Server/src/SOR.Admin/Program.cs +++ b/Server/src/SOR.Admin/Program.cs @@ -61,6 +61,16 @@ builder.Services options.Authority = keycloakAuthority; options.ClientId = keycloakClientId; options.ClientSecret = builder.Configuration["Keycloak:ClientSecret"]; + // If the public auth domain isn't reachable from inside the cluster (DNS/ + // network policy), set Keycloak__MetadataAddress to the internal k8s service + // URL, e.g. http://keycloak.keycloak.svc.cluster.local:8080/realms/aeternalis + // Authority is still used for issuer validation in token claims. + var metadataAddress = builder.Configuration["Keycloak:MetadataAddress"]; + if (!string.IsNullOrEmpty(metadataAddress)) + { + options.MetadataAddress = metadataAddress; + options.RequireHttpsMetadata = false; // internal URL may be plain HTTP + } options.ResponseType = "code"; options.SaveTokens = true; // Don't call the UserInfo endpoint — that extra pod→Keycloak HTTPS hop diff --git a/Server/src/SOR.Admin/appsettings.json b/Server/src/SOR.Admin/appsettings.json index fa40abd..31e9a90 100644 --- a/Server/src/SOR.Admin/appsettings.json +++ b/Server/src/SOR.Admin/appsettings.json @@ -33,9 +33,14 @@ // - Valid redirect URI: https:///signin-oidc // - Post-logout URI: https:///signout-callback-oidc // - "sor-admin" realm role assigned to any user who should access this panel + // Keycloak:MetadataAddress — optional internal k8s service URL for OIDC discovery. + // Set Keycloak__MetadataAddress if the pod cannot reach the public auth domain. + // e.g. http://keycloak.keycloak.svc.cluster.local:8080/realms/aeternalis + // Authority is still used for JWT issuer validation regardless. "Keycloak": { "Authority": "https://auth.aeternalisgames.com/realms/aeternalis", "ClientId": "sor-admin", - "ClientSecret": "" + "ClientSecret": "", + "MetadataAddress": "" } }