Skip to main content

AuthenticatedCaller

Struct AuthenticatedCaller 

Source
pub struct AuthenticatedCaller {
    pub key_id: String,
    pub scopes: Vec<Scope>,
    pub tenant: Tenant,
}
Expand description

Populated by the FromRequestParts implementation, which validates either an API key (aa_…) or a JWT bearer token.

Fields§

§key_id: String

The API key ID or JWT subject that identifies this caller.

§scopes: Vec<Scope>

Scopes granted to this caller.

§tenant: Tenant

The tenant this caller is confined to for per-tenant data (AAASM-3139).

Implementations§

Source§

impl AuthenticatedCaller

Source

pub fn can_access_team(&self, team: &str) -> bool

Whether this caller may see data for team without a separate admin gate.

AAASM-3139: an admin sees every tenant; a tenant-scoped caller sees only its own team. A caller with no team scope (and no admin) sees no per-tenant data.

Source

pub fn can_access_org(&self, org: &str) -> bool

Whether this caller may see data for org without a separate admin gate.

AAASM-3483: the org-tier analogue of Self::can_access_team, used by the topology and audit-log surfaces. An admin sees every org; a tenant-scoped caller sees only its own org. A caller with no org scope (and no admin) sees no per-org data.

Source

pub fn storage_tenant_org(&self) -> Option<&str>

The verified tenant org that scopes this caller’s storage access, if any.

AAASM-3596: this is the single, honest source for the app.tenant_id GUC the storage layer’s Row-Level Security filters on (AAASM-3595). It is taken only from Self::tenant — the verified JWT org_id claim or the authenticated API-key entry — and never from a request Query, header, or body. A client cannot redirect it by sending a different ?org_id / X-Org-Id, because nothing here reads request input.

Returns None for a caller with no tenant scope (an admin / cross-tenant caller). Such a caller must run the storage connection with NO app.tenant_id GUC — i.e. via a dedicated RLS-bypass admin DB role — and must never synthesize a tenant from a client-chosen value. Feeding a None here into the GUC seam yields a fail-closed (zero-row) connection, not a full-table read.

Trait Implementations§

Source§

impl Clone for AuthenticatedCaller

Source§

fn clone(&self) -> AuthenticatedCaller

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AuthenticatedCaller

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> FromRequestParts<S> for AuthenticatedCaller
where S: Send + Sync,

Source§

type Rejection = AuthError

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§

async fn from_request_parts( parts: &mut Parts, _state: &S, ) -> Result<Self, Self::Rejection>

Perform the extraction.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<S, T> FromRequest<S, ViaParts> for T
where S: Send + Sync, T: FromRequestParts<S>,

Source§

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>>

Perform the extraction.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more