pub struct Session { /* private fields */ }Expand description
Changes reach the cookie only once the handler’s outcome has committed.
Implementations§
Source§impl Session
impl Session
Sourcepub fn sign_in<A: Area>(
&self,
right: SignInRight,
principal: Id<PrincipalRecord<A>>,
) -> Result<Uuid>
pub fn sign_in<A: Area>( &self, right: SignInRight, principal: Id<PrincipalRecord<A>>, ) -> Result<Uuid>
Issues a fresh cookie, so no session value from before signing in stays valid; whether
the principal may enter the area is the caller’s to check. An action without a
SignInRight cannot sign anyone in:
ⓘ
fn sign_in_anyone<A: Area>(session: &Session, anyone: sofie_db::Id<PrincipalRecord<A>>) {
let _ = session.sign_in::<A>(anyone);
}Sourcepub fn resume<A: Area>(
&self,
right: SignInRight,
session: Uuid,
principal: Id<PrincipalRecord<A>>,
issued_at: Timestamp,
)
pub fn resume<A: Area>( &self, right: SignInRight, session: Uuid, principal: Id<PrincipalRecord<A>>, issued_at: Timestamp, )
Under the session’s own id and first sign-in, so a recent sign-in check does not trust it anew.
pub fn current(&self) -> Option<Uuid>
Sourcepub fn user_agent(&self) -> Option<Cow<'_, str>>
pub fn user_agent(&self) -> Option<Cow<'_, str>>
As the client sent it: untrusted, for showing a session’s device to its owner.
Sourcepub fn origin(&self) -> Option<&str>
pub fn origin(&self) -> Option<&str>
The Origin the browser sent, when it names the host the request was sent to.
pub fn sign_out(&self)
Sourcepub fn begin_flow(&self) -> Result<String>
pub fn begin_flow(&self) -> Result<String>
Ties a flow through another site, such as an OAuth sign-in, to this browser: the
returned value goes into the flow’s state, and flow reads it back on return.
pub fn flow(&self) -> Option<&str>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more