pub struct CompanyContext {
pub company_id: Uuid,
pub branch_id: Option<Uuid>,
pub user_id: String,
}Expand description
The company + subject proven by a validated access token.
Populated by company_auth and read by guarded handlers via the FromRequestParts impl below.
Every field here is derived from a signed claim — none of it is client-supplied request data.
Fields§
§company_id: UuidThe company the caller is acting for. Proven by the token signature; required.
branch_id: Option<Uuid>The branch within the company, when the deployment models an org tree.
user_id: StringThe authenticated principal (the token’s sub).
Trait Implementations§
Source§impl Clone for CompanyContext
impl Clone for CompanyContext
Source§fn clone(&self) -> CompanyContext
fn clone(&self) -> CompanyContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompanyContext
impl Debug for CompanyContext
Source§impl<S> FromRequestParts<S> for CompanyContext
Extractor: pull the CompanyContext the middleware inserted (401 if the route was reached without
it — a wiring error, since the middleware rejects unauthenticated requests first).
impl<S> FromRequestParts<S> for CompanyContext
Extractor: pull the CompanyContext the middleware inserted (401 if the route was reached without
it — a wiring error, since the middleware rejects unauthenticated requests first).
Source§type Rejection = Response<Body>
type Rejection = Response<Body>
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_parts<'life0, 'life1, 'async_trait>(
parts: &'life0 mut Parts,
_state: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<CompanyContext, <CompanyContext as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CompanyContext: 'async_trait,
fn from_request_parts<'life0, 'life1, 'async_trait>(
parts: &'life0 mut Parts,
_state: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<CompanyContext, <CompanyContext as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CompanyContext: 'async_trait,
Perform the extraction.
Auto Trait Implementations§
impl Freeze for CompanyContext
impl RefUnwindSafe for CompanyContext
impl Send for CompanyContext
impl Sync for CompanyContext
impl Unpin for CompanyContext
impl UnsafeUnpin for CompanyContext
impl UnwindSafe for CompanyContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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