diff --git a/internal/serviceadapter/router.go b/internal/serviceadapter/router.go index 9eaeae3..ebced2c 100644 --- a/internal/serviceadapter/router.go +++ b/internal/serviceadapter/router.go @@ -17,8 +17,10 @@ import ( ) // Dispatcher routes X-Service requests to upstreams. -// Acts as a dumb pipe: passes Authorization header through unchanged. -// Each upstream service validates JWTs independently. +// Auth per service: +// SQS: Gateway validates JWT (kmsvc code unverified) +// MinIO, Temporal: Native JWT support (dumb pipe pass-through) +// Memory, IAM: Services validate JWTs themselves type Dispatcher struct { registry *Registry } @@ -89,6 +91,18 @@ func (d *Dispatcher) Dispatch(w http.ResponseWriter, r *http.Request) { return } + // Gateway-level JWT validation for SQS (code unverified in kmsvc) + // MinIO, Temporal, Memory, IAM have native JWT support - pass through + if adapter.Spec.Auth.Required && serviceName == "sqs" { + if r.Header.Get("Authorization") == "" { + p := problem.NewProblem(http.StatusForbidden, "about:blank#forbidden", + "Forbidden", "SQS requires Authorization header") + _ = p.Write(w) + return + } + // TODO: Phase 3 - validate JWT signature against Authentik JWKS for SQS + } + // Detect protocol from upstream URL scheme upstreamURL := adapter.Spec.Upstream.URL if strings.HasPrefix(upstreamURL, "grpc://") { diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml index de0d07d..b3fe2a7 100644 --- a/k8s/configmap.yaml +++ b/k8s/configmap.yaml @@ -44,8 +44,9 @@ data: url: http://management-service.sqs.svc.cluster.local:9090 timeoutSeconds: 30 auth: - required: false - # Note: Services validate their own JWTs. Gateway is dumb pipe. + required: true + # Gateway validates (kmsvc JWT validation code unverified) + # TODO: Phase 3 - validate JWT signature against Authentik JWKS resources: - name: send-message methods: @@ -66,6 +67,8 @@ data: timeoutSeconds: 60 auth: required: false + # Temporal has native JWT support via jwtKeyProvider + # Phase 3: configure and test Temporal JWT validation resources: - name: execute methods: @@ -106,7 +109,8 @@ data: timeoutSeconds: 30 auth: required: false - # MinIO validates bearer tokens independently + # MinIO has native JWT/OIDC support - validates JWTs itself + # Phase 3: load-test MinIO JWT validation resources: - name: list-objects methods: