pub struct Sessions<'a> { /* private fields */ }Expand description
Session mode: the credentials the proxy accepts and where their taint is read.
Implementations§
Source§impl<'a> Sessions<'a>
impl<'a> Sessions<'a>
Sourcepub fn new(credentials: Vec<Credential>, taint: &'a dyn TaintLookup) -> Self
pub fn new(credentials: Vec<Credential>, taint: &'a dyn TaintLookup) -> Self
Accept credentials; look each session’s taint up in taint.
Sourcepub fn issued(issued: &'a dyn Verify, taint: &'a dyn TaintLookup) -> Self
pub fn issued(issued: &'a dyn Verify, taint: &'a dyn TaintLookup) -> Self
Accept the credentials issued verifies; look each session’s taint up
in taint (the standalone proxy, ADR-044).
Sourcepub fn serving_without_credential(self) -> Self
pub fn serving_without_credential(self) -> Self
Also serve requests that carry no credential, with no session: no taint applies to them, and they share one holder’s half of the connections. A wrong or malformed credential is still refused.
Sourcepub fn serves_without_credential(&self) -> bool
pub fn serves_without_credential(&self) -> bool
Whether a request without any credential is served.
Sourcepub fn verify<T: AsRef<[u8]>>(&self, headers: &[T]) -> Result<String, AuthError>
pub fn verify<T: AsRef<[u8]>>(&self, headers: &[T]) -> Result<String, AuthError>
The session that headers (every Proxy-Authorization value of the
request) authenticate. Every credential is compared in full, in time
that does not depend on where a guess first differs.
Sourcepub fn taint(&self, session: &str) -> Result<Taint, String>
pub fn taint(&self, session: &str) -> Result<Taint, String>
The taint of session, from the lookup.
Sourcepub fn taint_within(
&self,
session: &str,
max_age: Duration,
) -> Result<Taint, String>
pub fn taint_within( &self, session: &str, max_age: Duration, ) -> Result<Taint, String>
The taint of session as looked up at most max_age ago and with no
event recorded since (TaintLookup::version), else looked up again;
always looked up again while there is no version to compare.
Each open connection of a session is checked against its taint every so
often; this keeps that to one lookup per new event, at most one per
max_age, for the whole session. A new connection uses Self::taint.