feat(api): align legacy /api/* handlers with ResolveSpec auth method
This commit is contained in:
@@ -80,6 +80,15 @@ func NewServer(cfg *config.Config, db *bun.DB, wh WhatsHookedInterface) (*Server
|
|||||||
}
|
}
|
||||||
restheadspec.RegisterSecurityHooks(handler, securityList)
|
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
|
// Create router
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user