#[non_exhaustive]pub struct AuthSession<S> {
pub session_id: Uuid,
pub subject: S,
pub created_at: DateTime<Utc>,
pub authenticated_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
}Expand description
An authenticated session, as handed to the app.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.session_id: UuidSession id. Safe to log; key per-session app data by it.
subject: SWho the session belongs to.
created_at: DateTime<Utc>When the session was created.
authenticated_at: DateTime<Utc>When the subject last proved who they are (login or completed step-up).
expires_at: DateTime<Utc>Absolute expiry.
Trait Implementations§
Source§impl<S: Clone> Clone for AuthSession<S>
impl<S: Clone> Clone for AuthSession<S>
Source§impl<S: Debug> Debug for AuthSession<S>
impl<S: Debug> Debug for AuthSession<S>
impl<S: Eq> Eq for AuthSession<S>
Source§impl<A, S> FromRequestParts<A> for AuthSession<S>
Available on crate feature axum only.Extracts the session the GuardLayer authenticated. Without the layer (or for a
bypassed request) it rejects with 401 {"error":"not_authenticated"}.
impl<A, S> FromRequestParts<A> for AuthSession<S>
Available on crate feature
axum only.Extracts the session the GuardLayer authenticated. Without the layer (or for a
bypassed request) it rejects with 401 {"error":"not_authenticated"}.
S must match the guard’s subject type.
Source§impl<S> OperationInput for AuthSession<S>
Available on crate feature aide only.
impl<S> OperationInput for AuthSession<S>
Available on crate feature
aide only.Source§fn operation_input(_: &mut GenContext, operation: &mut Operation)
fn operation_input(_: &mut GenContext, operation: &mut Operation)
Modify the operation. Read more
Source§fn inferred_early_responses(
_: &mut GenContext,
_: &mut Operation,
) -> Vec<(Option<u16>, Response)>
fn inferred_early_responses( _: &mut GenContext, _: &mut Operation, ) -> Vec<(Option<u16>, Response)>
Inferred early responses are used to document early returns for
extractors, guards inside handlers. For example these could represent
JSON parsing errors, authentication failures. Read more
Source§impl<A, S> OptionalFromRequestParts<A> for AuthSession<S>
Available on crate feature axum only.Option<AuthSession<S>>: None when the layer did not authenticate the request, for
handlers that serve both anonymous and signed-in clients.
impl<A, S> OptionalFromRequestParts<A> for AuthSession<S>
Available on crate feature
axum only.Option<AuthSession<S>>: None when the layer did not authenticate the request, for
handlers that serve both anonymous and signed-in clients.
Source§impl<S: PartialEq> PartialEq for AuthSession<S>
impl<S: PartialEq> PartialEq for AuthSession<S>
impl<S: PartialEq> StructuralPartialEq for AuthSession<S>
Auto Trait Implementations§
impl<S> Freeze for AuthSession<S>where
S: Freeze,
impl<S> RefUnwindSafe for AuthSession<S>where
S: RefUnwindSafe,
impl<S> Send for AuthSession<S>where
S: Send,
impl<S> Sync for AuthSession<S>where
S: Sync,
impl<S> Unpin for AuthSession<S>where
S: Unpin,
impl<S> UnsafeUnpin for AuthSession<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for AuthSession<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.
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