pub struct Request { /* private fields */ }Expand description
A token the peer presented, waiting for an answer.
It arrived on its own AUTH stream, or on one of the peer’s moq-transport requests. Either way the grant it earns is enforced by the session: an AUTH token’s joins the session’s scope, while one that rode on requests admits only those naming it, which end with it.
Dropping it unanswered refuses the token with SessionError::Unauthorized.
Implementations§
Source§impl Request
impl Request
Sourcepub fn token(&self) -> &Bytes
pub fn token(&self) -> &Bytes
The token the peer presented. Empty means the credential its connection already carried, or none.
Sourcepub async fn closed(&self) -> Error
pub async fn closed(&self) -> Error
Wait for the peer to withdraw this unanswered token, end the request it rode on, or close the session.
Sourcepub fn accept(self, grant: Grant) -> Issued
pub fn accept(self, grant: Grant) -> Issued
Grant the token. The grant holds until the returned Issued is revoked
or dropped, or the peer withdraws the token or ends its last naming request.
Revoking an AUTH token’s grant once expires passes is the acceptor’s job; a grant
on a request lapses at expires by itself.
Sourcepub fn reject(self, code: SessionError, reason: impl Into<String>)
pub fn reject(self, code: SessionError, reason: impl Into<String>)
Refuse the token with a session error code and a reason for the peer.
SessionError::Internal, SessionError::TooManyRequests, and
SessionError::Timeout say this side failed to decide, such as with its auth backend
down, so a moq-lite peer presents the token again after a backoff; any other code ends it.