pub struct AuthContext {
pub subject: String,
pub email: Option<String>,
pub issuer: String,
pub audience: Option<String>,
pub expires_at: Option<DateTime<Utc>>,
pub auth_type: AuthType,
pub allow_delegation: bool,
pub bound_audience: Option<String>,
pub read_audiences: Vec<String>,
pub memberships: Arc<[String]>,
}Expand description
Authentication context containing user identity and metadata
Fields§
§subject: StringUnique subject identifier (e.g., user ID, service account ID)
email: Option<String>Email address (if available)
issuer: StringIssuer (for OIDC) or “api_key” for API key auth
audience: Option<String>Audience that was matched during token validation
- For OIDC access tokens: API audience (e.g., “https://api.example.com”)
- For OIDC ID tokens: client ID
- For API key auth: None
expires_at: Option<DateTime<Utc>>Token expiration time (if applicable)
auth_type: AuthTypeAuthentication type
allow_delegation: boolWhether this authentication allows user delegation (acting on behalf of others)
- OIDC user tokens: false (user cannot impersonate others)
- Analytics API keys/service accounts: true (can act on behalf of users)
- Ingestion API keys: false — a write credential is not a delegating service account, and
it can never reach the gRPC path this flag governs anyway (
ingestion_api_keysnever crossesflight_sql_service_impl.rs)
bound_audience: Option<String>The write audience an ingestion key is immutably bound to. Some(..) for every ingestion
API key (the ingestion_api_keys.audience column is NOT NULL as of migration v6);
None for every other principal kind. Write-side only; never consulted by ReadPolicy.
read_audiences: Vec<String>The set of audiences an analytics service-account key is granted read access to. Empty for
every principal today — no analytics key provider populates it yet. Read-side only; folded
into AudienceReadPolicy::resolve’s union but never into AudienceMintPolicy’s mintable
set (a read grant confers no mint authority).
memberships: Arc<[String]>The caller’s resolved, transitive local-group membership – filled by
crate::membership::MembershipProvider from a crate::groups::GroupGraph snapshot,
after the inner provider authenticates the request. Empty until a
MembershipProvider fills it (disabled-auth and maintenance contexts set this to
Arc::from([ADMINS_GROUP.to_string()]) directly instead). AudienceReadPolicy/
AudienceMintPolicy match each entry against group:<name> grant-map selectors via
crate::policy::caller_selectors/selector_matches.
Implementations§
Source§impl AuthContext
impl AuthContext
Sourcepub fn is_admin(&self) -> bool
pub fn is_admin(&self) -> bool
true iff memberships contains ADMINS_GROUP – a method, not a field, so no
construction site can set it inconsistently with memberships.
Trait Implementations§
Source§impl Clone for AuthContext
impl Clone for AuthContext
Source§fn clone(&self) -> AuthContext
fn clone(&self) -> AuthContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AuthContext
impl RefUnwindSafe for AuthContext
impl Send for AuthContext
impl Sync for AuthContext
impl Unpin for AuthContext
impl UnsafeUnpin for AuthContext
impl UnwindSafe for AuthContext
Blanket Implementations§
impl<T> Allocation for T
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
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,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].