Repository navigation
relay joins: token: oidc (a host credential) and reconnects - #1132
Merged
Merged
Conversation
The client half S2 and S5 left out (docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md 6.5.7), stacked on S5. relay: token: credential:NAME, or oidc:NAME for the credential an (oidc-sign-in ...) keeps, and --relay-credential NAME: the token is read from the host's credential store (net_host_access) at every join, for the relay's origin (relay_credential_origin: https://host:port for grpcs:// and wss://, http:// for grpc:// and ws://), which a policy line binds the credential to. A credential the relay refused, or that its renewer says is expiring, is renewed first: an OIDC sign-in refreshes it. The join waits for the credential: attach_relay begins the session, and pump() dials from the frames once the credential holds a token, on a thread of its own so a frame never waits on the network. Until then room-call answers unavailable. Every join reconnects: a link the relay closes is dialed again after 1 s, doubling to 30 s, with the token read again, the shard and the participant id kept. A dial counts once the relay's Hello arrives (replies write through the admission hold). The document sees relay.status and relay.joins under its root. S1's arisrvx_program waited for job.state and could read steps half written (the relay writes a subtree leaf by leaf); it waits for the last leaf now. Tests: RoomRelayLoopbackTest.ARelaySessionJoinsOnceItsCredentialHoldsAToken, RoomRelayLoopbackTest.ARelaySessionRenewsARefusedCredential, arisrvx_auth_credential (a credential through --credential-env and a policy line; host.disconnect, then the client is back and admitted again), and arisrvx_auth_staff now revokes (the hook refuses, so the client stays out).
transfix
added a commit
that referenced
this pull request
Nov 11, 2026
…th token: oidc (#1130) * arisrvx: the authenticate hook and principals (S5) S5 of the scripting-hosts roadmap's application-services cut (docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md 6.5.4 and the S5 row of 10), stacked on S2. Transports: state_transport::set_authenticator takes a state_authenticator (a state_credential of bearer, transport and peer, mapped to a principal id, or "" and why). gRPC calls it in Channel(), WS during the upgrade, on the connection's own thread before it is admitted, in place of the room token; a refusal is the room token's (UNAUTHENTICATED, a refused upgrade), with nothing sent. disconnect_principal closes a principal's connections. valid_bearer_token allows bearers up to 4096 characters, so a JWT fits. The gate: state_inbound_gate::bind takes the claimant's principal; a silent holder's id is taken over only by the same principal (total_principal_refusals), and principal_of names whose a participant is. arisrvx: @host.authenticate (sync or async; a principal dict with a str id, or None) runs on the script loop for each connection, within --auth-timeout (5 s; ServerLink::request waits). The relay keeps each principal by id for its calls' ctx.principal, so role gates check its roles. host.disconnect(principal) closes that principal's connections on the next room step. Calls are limited per principal: --call-concurrency (8 in flight) and --call-rate (a token bucket, off by default), past which a call is answered rate_limited. Clients: a refused join fails at once ("refused this host (unauthenticated...)"), and a connection the relay closes later ends the waiting and later calls unavailable. Not here: the client's token: oidc, which needs a join deferred until the sign-in and a reconnect that refreshes the token. Tests: StateTransportGrpcTest.InboundGateKeysANodeIdToItsPrincipal, StateTransportGrpcTest.AnAuthenticatorAdmitsAndBindsPrincipals, StateTransportWsTest.AnAuthenticatorJudgesTheHandshake, ServerLinkTest.ARequestWaitsForItsAnswerOrItsTimeout, pycvc_ariadne_server, and arisrvx_auth_{staff,user_ws,refuses_wrong,refuses_slow,refuses_raises}. * docs(roadmap): S5 is #1130 * relay joins: token: oidc (a host credential) and reconnects (#1132) * relay joins: token: oidc (a host credential) and reconnects The client half S2 and S5 left out (docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md 6.5.7), stacked on S5. relay: token: credential:NAME, or oidc:NAME for the credential an (oidc-sign-in ...) keeps, and --relay-credential NAME: the token is read from the host's credential store (net_host_access) at every join, for the relay's origin (relay_credential_origin: https://host:port for grpcs:// and wss://, http:// for grpc:// and ws://), which a policy line binds the credential to. A credential the relay refused, or that its renewer says is expiring, is renewed first: an OIDC sign-in refreshes it. The join waits for the credential: attach_relay begins the session, and pump() dials from the frames once the credential holds a token, on a thread of its own so a frame never waits on the network. Until then room-call answers unavailable. Every join reconnects: a link the relay closes is dialed again after 1 s, doubling to 30 s, with the token read again, the shard and the participant id kept. A dial counts once the relay's Hello arrives (replies write through the admission hold). The document sees relay.status and relay.joins under its root. S1's arisrvx_program waited for job.state and could read steps half written (the relay writes a subtree leaf by leaf); it waits for the last leaf now. Tests: RoomRelayLoopbackTest.ARelaySessionJoinsOnceItsCredentialHoldsAToken, RoomRelayLoopbackTest.ARelaySessionRenewsARefusedCredential, arisrvx_auth_credential (a credential through --credential-env and a policy line; host.disconnect, then the client is back and admitted again), and arisrvx_auth_staff now revokes (the hook refuses, so the client stays out). * docs(roadmap): the client join is #1132 * arisrv: the browser build compiles S5's disconnect and the oidc dialer CI's arigl-web job (emscripten, no pthreads) failed on state_transport_ws::disconnect_principal: a browser connection has no abort_io(). A browser accepts no connections, so none has a principal: the browser build returns 0. relay_session's dialer thread would throw there (std::thread in a single-threaded build), so that build dials in the frame, as a token join's dial does at the load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The client half that S2 and S5 left out (docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md §6.5.7):
relay: token: oidcand reconnects. Stacked on #1130 (S5), which is on #1122 (S2): its base isfeat/arisrvx-authenticate.What it adds
token: credential:NAME,oidc:NAME, or--relay-credential NAME.net_host_access) for the relay's origin (relay_credential_origin:https://host:portforgrpcs://andwss://,http://forgrpc://andws://).CredentialStore::token_forreleases a token only where it is bound, hence the policy line.token: oidcis refused with a pointer tooidc:NAME, since a sign-in's credential has no default name.attach_relaybegins the session (relay_session::begin) instead of joining at load.pump()dials once the credential holds a token. The dial runs on a thread of its own, so a frame never waits on the network or a refresh.room-callanswersunavailable.host.disconnect, a network drop) is dialed again after 1 s, doubling to 30 s, with the token read again.relay.status(joined,dialing,waiting for credential NAME (…),lost; dialing again (…)) andrelay.joinsunder its root.arisrvx_programwaited forjob.stateand could readstepshalf written, since the relay writes a subtree leaf by leaf. It failed once here under-j 3. It waits for the last leaf now.Tests
RoomRelayLoopbackTest.ARelaySessionJoinsOnceItsCredentialHoldsAToken:room-callclient, and the status says it is waiting;relay_credential_origin's mapping.RoomRelayLoopbackTest.ARelaySessionRenewsARefusedCredential: a relay with a room token refuses the first token; the redial, after the backoff, hands it back asrejected, and the fresh token joins.arisrvx_auth_credential.ari test --relay-credential relaytokgets its token through--credential-env, bound to the relay's origin by a policy linerelay_pair.pywrites. The hook admits it as alice.host.disconnectcloses the connection, the client dials again, and the hook admits it a second time (relay.joins2).arisrvx_auth_staffnow revokes instead of kicking: the hook refuses alice afterwards, so her client's redials are refused and her calls stayunavailable. With reconnects, a kick alone would let her straight back.Run locally on Windows (static Release, gRPC + WS, pycvc core, wasmtime from cvcpkg):
-j 3;room_relay_integration_test: 21/21;ariadne_host_test: 57/57.Not in this PR
--credential-env(the store'sprovide); the sign-in itself isoidc_host.h's, tested there.wss://.