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:
parent
d5638c7c14
commit
5d900f082f
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue