-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Infrastructure: Per-IdP ALB listener rules
Epic: Multi-IdP Authentication (#150)
Blocked by: Landing page sub-task (for full E2E testing, but can be developed in parallel)
Summary
Create separate ALB listener rules for each identity provider so that /login/okta triggers Okta OIDC and /login/entra triggers Entra ID OIDC. Resolve the /api/* route auth strategy since ALB only supports one OIDC config per listener rule.
Current State
Both ALB listener rules in alb-internal.tf use the same local.oidc_options:
- Priority 1:
/login*→authenticate-oidc(Okta) → redirect/ - Priority 2:
/api/*→authenticate-oidc(Okta) → forward to API
local.oidc_options is a single JSON secret decoded in locals.tf.
Requirements
Secrets Manager
- Add a second secret for Entra ID OIDC configuration (same JSON structure as
ztmf_va_trust_provider) - Add
data.aws_secretsmanager_secret_versionfor Entra ID secret - Add
local.oidc_options_entra(or similar) inlocals.tf
ALB Listener Rules
- Replace single
/login*rule with two provider-specific rules:/login/okta*→authenticate-oidc(Okta config) → redirect//login/entra*→authenticate-oidc(Entra config) → redirect/
- Decide and implement
/api/*auth strategy (see options below)
API Route Auth Strategy
ALB can only have one authenticate-oidc action per rule. For /api/* we need to handle tokens from either IdP. Options:
Option A — ALB per IdP: Separate paths (/api/okta/*, /api/entra/*). Adds frontend routing complexity.
Option B — Move API auth to backend (recommended):
- Change
/api/*ruleon_unauthenticated_requestto"allow" - Backend validates JWT from either IdP based on
issclaim - ALB still handles OIDC login dance on
/login/*paths
Option C — CloudFront + Lambda@Edge: Cookie-based routing to different ALB rules. High complexity.
- Team decides on approach
- Implement chosen approach
Terraform Variables
- Add Entra ID secret ARN/name to
tfvars/dev.tfvarsandtfvars/prod.tfvars - Parameterize provider-specific values
Files to Modify
infrastructure/locals.tf— addoidc_options_entrainfrastructure/alb-internal.tf— new listener rules, modify API ruleinfrastructure/secrets.tf— add Entra ID secret data sourceinfrastructure/tfvars/dev.tfvars— Entra ID secret referenceinfrastructure/tfvars/prod.tfvars— Entra ID secret reference
Acceptance Criteria
-
/login/oktatriggers Okta OIDC flow and redirects to/on success -
/login/entratriggers Entra ID OIDC flow and redirects to/on success -
/api/*requests authenticated by either IdP are forwarded to the backend -
terraform planshows clean, expected changes - Existing Okta-only users experience no disruption
- tflint passes with no errors