pub struct NewSession<'a> {
pub user_id: Uuid,
pub token_hash: &'a str,
pub csrf_token: &'a str,
pub created_ip: Option<String>,
pub user_agent: Option<String>,
}Expand description
Everything a new session row needs from its caller.
A struct rather than three positional &strs, and that is a security
property rather than a style one: token_hash and csrf_token were
adjacent same-typed parameters, so transposing them at a call site compiled
cleanly and produced a session whose CSRF token is its session token hash
— a value that has already crossed the wire in a cookie. Named fields make
that unwriteable.
It also retires two #[allow(clippy::too_many_arguments)].
Fields§
§user_id: Uuid§token_hash: &'a strHex-encoded SHA-256 of the cookie token. Minted by the caller: this layer holds no RNG and so cannot accidentally reuse one.
csrf_token: &'a str§created_ip: Option<String>Forensics only – see the created_ip column.
user_agent: Option<String>Trait Implementations§
Source§impl<'a> Clone for NewSession<'a>
impl<'a> Clone for NewSession<'a>
Auto Trait Implementations§
impl<'a> Freeze for NewSession<'a>
impl<'a> RefUnwindSafe for NewSession<'a>
impl<'a> Send for NewSession<'a>
impl<'a> Sync for NewSession<'a>
impl<'a> Unpin for NewSession<'a>
impl<'a> UnsafeUnpin for NewSession<'a>
impl<'a> UnwindSafe for NewSession<'a>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more