pub struct Identities { /* private fields */ }Expand description
Installs the identity layer. See the module docs.
Order does not matter: the middleware runs in Phase::Call, which is
inside the phase the session plugin uses, so the session is always loaded by
the time the deadlines are checked.
Implementations§
Source§impl Identities
impl Identities
Sourcepub fn login_deadline(self, secs: i64) -> Self
pub fn login_deadline(self, secs: i64) -> Self
End a login secs after it started, however active the visitor is.
§Panics
If secs is not positive. A deadline of zero or less would log every
visitor out on the request after they signed in, which is never the
intent.
Sourcepub fn visit_deadline(self, secs: i64) -> Self
pub fn visit_deadline(self, secs: i64) -> Self
End a login after secs with no requests.
Enabling this makes the layer maintain a last-seen timestamp in the session. It is refreshed at most once per tenth of the deadline, not on every request: the session plugin only re-issues a cookie when the session changed, and touching a timestamp on every request would rewrite the cookie every time and quietly extend the expiry of a session nobody is really using. The cost of that thrift is that the idle timeout is accurate to within a tenth of itself.
§Panics
If secs is not positive.
Sourcepub fn login_url(self, url: impl Into<String>) -> Self
pub fn login_url(self, url: impl Into<String>) -> Self
Send unauthenticated visitors to url instead of answering 401.
Applies to the Authenticated extractor. An API generally wants the
401; a server-rendered application generally wants the redirect.
Trait Implementations§
Source§impl Clone for Identities
impl Clone for Identities
Source§fn clone(&self) -> Identities
fn clone(&self) -> Identities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more