Authenticate sockets by header or one-time ticket instead of ?token=

This commit is contained in:
2026-10-07 08:58:22 +02:00
parent 094fed7cea
commit ed8aee2387
21 changed files with 336 additions and 44 deletions
+3 -5
View File
@@ -1059,11 +1059,9 @@ def test_a_duration_reads_the_way_an_age_does() -> None:
def test_the_dashboard_subscribes_where_the_browser_does() -> None:
"""The same socket, and the token where a handshake can carry it."""
"""The same socket, with the token kept out of its URL."""
from fluksio.sdk.stream import socket_url
assert socket_url("http://127.0.0.1:8000", "abc") == (
"ws://127.0.0.1:8000/api/v1/flows/ws?token=abc"
)
assert socket_url("http://127.0.0.1:8000") == "ws://127.0.0.1:8000/api/v1/flows/ws"
# TLS on the one side is TLS on the other.
assert socket_url("https://engine.example.com", "t").startswith("wss://")
assert socket_url("https://engine.example.com").startswith("wss://")