mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
feat: support token query parameter for WebSocket authentication
Allows WebSocket connections to authenticate via ?token= query parameter when headers cannot be sent (browser WebSocket limitations).
This commit is contained in:
@@ -283,6 +283,12 @@ func CheckAuth(cfg *config.Config, w http.ResponseWriter, r *http.Request) bool
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check query parameter (for WebSocket connections that can't send headers)
|
||||
if queryToken := r.URL.Query().Get("token"); queryToken != "" {
|
||||
if validateToken(queryToken) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check session cookie (for WebSocket and UI)
|
||||
|
||||
Reference in New Issue
Block a user