feat(api): align legacy /api/* handlers with ResolveSpec auth method
Some checks failed
CI / Test (1.22) (push) Failing after -30m39s
CI / Test (1.23) (push) Failing after -30m34s
CI / Lint (push) Failing after -30m34s
CI / Build (push) Failing after -30m39s

This commit is contained in:
2026-03-05 01:35:36 +02:00
parent aaf6ad473a
commit c190a417b3

View File

@@ -80,6 +80,15 @@ func NewServer(cfg *config.Config, db *bun.DB, wh WhatsHookedInterface) (*Server
}
restheadspec.RegisterSecurityHooks(handler, securityList)
// Ensure legacy /api/* handlers use the same ResolveSpec auth method.
// This keeps JWT + phase1 auth behavior aligned across /api and /api/v1.
wh.Handlers().WithAuthConfig(&handlers.AuthConfig{
Validator: func(r *http.Request) bool {
_, err := secProvider.Authenticate(r)
return err == nil
},
})
// Create router
router := mux.NewRouter()