Skip to main content

Module actor

Module actor 

Source
Expand description

The authenticated actor for the current request (#2), and the person that request says it is acting for (#251).

prospero-api’s auth middleware runs each handler inside scope; the fleet emitter reads current when it builds an event, so events a request emits directly carry the token name without threading it through FleetProvider. Tasks spawned with tokio::spawn (the poll loop, watch loops, attach tasks) do not inherit it — their events stay unattributed, which is correct.

current_subject is the second half, and the two are not the same kind of fact. The actor is who prosperod authenticated. The subject is who the client says it is acting for — a multi-user front end like Ariel holds one service token but serves many people. Prosperod cannot authenticate someone else’s user and does not try; it records the claim beside the credential that made it, so an auditor reads “token ariel asserted this was for U123”, never “prosperod verified U123”.

Constants§

MAX_SUBJECT
Longest accepted subject. Bounds what a client can push into every event it causes; ids and handles are far shorter.

Functions§

current
The current actor, or None outside any scope.
current_subject
Who the current request says it is acting for, or None.
scope
Run fut with actor as the current actor.
scope_with_subject
Run fut with both the authenticated actor and the client’s asserted subject in scope.
validate_subject
Validate a client-asserted subject.