mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-03 11:55:14 +02:00
fix: WebSocket auth handshake overwriting explicit workspace (#965)
The auth-ok response includes the token's bound workspace, and AsyncSocketClient was unconditionally adopting it — clobbering any workspace the caller explicitly requested via the constructor.
This commit is contained in:
parent
c460f62c87
commit
9e0c848057
1 changed files with 3 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ class AsyncSocketClient:
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.token = token
|
self.token = token
|
||||||
self.workspace = workspace
|
self.workspace = workspace
|
||||||
|
self._workspace_explicit = workspace != "default"
|
||||||
self._request_counter = 0
|
self._request_counter = 0
|
||||||
self._socket = None
|
self._socket = None
|
||||||
self._connect_cm = None
|
self._connect_cm = None
|
||||||
|
|
@ -92,7 +93,8 @@ class AsyncSocketClient:
|
||||||
)
|
)
|
||||||
|
|
||||||
if resp.get("type") == "auth-ok":
|
if resp.get("type") == "auth-ok":
|
||||||
self.workspace = resp.get("workspace", self.workspace)
|
if not self._workspace_explicit:
|
||||||
|
self.workspace = resp.get("workspace", self.workspace)
|
||||||
elif resp.get("type") == "auth-failed":
|
elif resp.get("type") == "auth-failed":
|
||||||
await self._socket.close()
|
await self._socket.close()
|
||||||
raise ProtocolException(
|
raise ProtocolException(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue