feat(serviceadapter): enforce JWT auth on X-Service dispatch (#16)
CI / CI (push) Successful in 3m43s

SQS dispatcher hardcoded a JWT validator pointing at authentik.riotpiao.com/application/o/sqs/jwks/ — provider doesn't exist. Every SQS request got 403 regardless of token.

Co-authored-by: poimen <[email protected]>
This commit was merged in pull request #16.
This commit is contained in:
2026-09-08 23:20:31 +00:00
committed by rock
parent 6f7b850193
commit 09318778fa
3 changed files with 370 additions and 104 deletions
+8 -1
View File
@@ -9,6 +9,7 @@ import (
"os/signal"
"syscall"
"forgejo.riotpiao.com/rock/homelab-frontend/internal/auth"
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
"forgejo.riotpiao.com/rock/homelab-frontend/internal/proxy"
"forgejo.riotpiao.com/rock/homelab-frontend/internal/server"
@@ -75,7 +76,13 @@ func main() {
_ = registry.Add(a)
}
log.Printf("%d service adapters loaded", registry.Count())
dispatcher := serviceadapter.NewDispatcher(registry)
// Create shared JWT validator for X-Service auth enforcement
var jwtValidator *auth.Validator
if cfg.Auth.Enabled && cfg.Auth.JWKSURL != "" {
jwtValidator = auth.NewValidator(cfg.Auth.Issuer, cfg.Auth.Audience, cfg.Auth.JWKSURL)
}
dispatcher := serviceadapter.NewDispatcher(registry, jwtValidator)
// Create router that handles health endpoints, X-Service (ServiceAdapter) routing,
// temporal endpoints, and passes others to upstream handler