Files
Pulse/internal/api/websocket_auth.go
pulse-triage[bot] c9a6a6278d End dashboard token streams when their authority is withdrawn
Revalidate the admitted token before every websocket data frame, queued flush and idle ping. Share the current-tenant snapshot validator without mutating a returned HTTP request. Keep session, origin, licensing and wanted monitoring reads unchanged; exercise real token deletion, client cleanup and independent subscribers.

Change-source: pulse-maintainer
2026-10-31 20:02:09 +00:00

21 lines
516 B
Go

package api
import (
"net/http"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
)
func monitoringWebSocketAuthorization(cfg *config.Config, req *http.Request) func() bool {
// The socket writer outlives this HTTP request. Give it an immutable
// request copy, not one its returning middleware may still be observing.
revalidate := monitoringTokenSnapshotRevalidator(cfg, req.Clone(req.Context()))
if revalidate == nil {
return nil
}
return func() bool {
_, ok := revalidate()
return ok
}
}