Skip to content

Commit 129cdde

Browse files
committed
Normalize OIDC issuers without trailing slash
1 parent 8d8897c commit 129cdde

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Top-level commands:
131131
| `--manage-domain` | domain | no | `manage.<domain>` when `--domain` is set, otherwise `manage.<dashed-public-ip>.traefik.me` | Overrides the Cockpit domain. |
132132
| `--lxd-domain` | domain | no | `lxd.<domain>` when `--domain` is set, otherwise `lxd.<dashed-public-ip>.traefik.me` | Overrides the LXD domain. |
133133
| `--idp` | `local` or `oidc` | yes in non-interactive mode; no in interactive mode | prompted in interactive mode | Selects whether Terrarium uses self-hosted ZITADEL (`local`) or an external OIDC issuer (`oidc`). |
134-
| `--oidc` | issuer URL | yes when `--idp=oidc`; no otherwise | derived from `https://<auth-domain>/` when `--idp=local` | Sets the OIDC issuer URL. |
134+
| `--oidc` | issuer URL | yes when `--idp=oidc`; no otherwise | derived from `https://<auth-domain>` when `--idp=local` | Sets the OIDC issuer URL. |
135135
| `--oidc-client` | client ID | yes when `--idp=oidc`; no otherwise | none | Sets the external OIDC client ID. |
136136
| `--oidc-secret` | client secret | yes when `--idp=oidc`; no otherwise | none | Sets the external OIDC client secret. |
137137
| `--auth-domain` | domain | no | `auth.<domain>` when `--domain` is set and self-hosted ZITADEL is enabled, otherwise `auth.<dashed-public-ip>.traefik.me` | Overrides the ZITADEL auth domain. |

ansible/site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
terrarium_lxd_domain: "{{ ('lxd.' ~ terrarium_root_domain) if terrarium_root_domain else ('lxd.' ~ (terrarium_public_ip | replace('.', '-')) ~ '.traefik.me') }}"
1717
terrarium_idp_mode: oidc
1818
terrarium_auth_domain: "{{ (('auth.' ~ terrarium_root_domain) if terrarium_root_domain else ('auth.' ~ (terrarium_public_ip | replace('.', '-')) ~ '.traefik.me')) if terrarium_idp_mode == 'local' else '' }}"
19-
terrarium_oidc_issuer: "{{ ('https://' ~ terrarium_auth_domain ~ '/') if terrarium_idp_mode == 'local' else '' }}"
19+
terrarium_oidc_issuer: "{{ ('https://' ~ terrarium_auth_domain) if terrarium_idp_mode == 'local' else '' }}"
2020
terrarium_oidc_client_id: ""
2121
terrarium_oidc_client_secret: ""
2222
terrarium_zitadel_admin_email: "{{ terrarium_email }}"

scripts/terrarium-install.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ export function normalizeOidcIssuer(value: string, fieldName: string): string {
9292
if (!["http:", "https:"].includes(parsed.protocol)) {
9393
fail(`${fieldName} must use http or https`);
9494
}
95-
return parsed.toString().endsWith("/") ? parsed.toString() : `${parsed.toString()}/`;
95+
if (parsed.pathname === "/") {
96+
parsed.pathname = "";
97+
}
98+
const normalized = parsed.toString();
99+
return normalized.endsWith("/") ? normalized.slice(0, -1) : normalized;
96100
}
97101

98102
function requireRoot(): void {

scripts/terrarium-zitadel-sync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export async function idpSyncCmd(configPath = DEFAULT_CONFIG_PATH): Promise<void
222222
const outputs = readJsonFile<Record<string, { value?: string }>>(outputsPath, {});
223223
const lxdClientId = outputs.lxd_client_id?.value ?? "";
224224
if (lxdClientId && existsSync("/snap/bin/lxc")) {
225-
const issuer = configString(config, "terrarium_oidc_issuer") || `https://${authDomain}/`;
225+
const issuer = configString(config, "terrarium_oidc_issuer") || `https://${authDomain}`;
226226
await runText(["/snap/bin/lxc", "config", "set", "oidc.issuer", issuer], PREFIX);
227227
await runText(["/snap/bin/lxc", "config", "set", "oidc.client.id", lxdClientId], PREFIX);
228228
}

0 commit comments

Comments
 (0)