pub struct AudienceReadPolicy { /* private fields */ }Expand description
The shipped ReadPolicy: a lookup over an AudienceGrants map – and, when a
DbAudienceGrantsSource is attached via with_store, a second lookup over that store’s
snapshot – with no identity derivation anywhere. Resolves the readable set:
{ a : "*" ∈ grants[a].read }
∪ { a : "user:<email>" ∈ grants[a].read } if email present
∪ { a : "group:<g>" ∈ grants[a].read for some g ∈ caller.memberships }
∪ { a : selector ∈ store.readers(a) matches caller } if a store is attached
∪ caller.read_audiences // per-key direct grantThere is no self-audience rule – a caller is granted no audience merely for being named
like one: the charset makes an email unrepresentable as an audience name, and keying on
subject instead would let an admin mint themselves read access by naming a key after an
audience.
read_audiences is folded in here but deliberately excluded from
AudienceMintPolicy’s mintable set – a service-account key’s ability to see an audience
must not imply it can stamp new keys with that audience (mint is integrity, read is
confidentiality).
Implementations§
Source§impl AudienceReadPolicy
impl AudienceReadPolicy
Sourcepub fn new(grants: AudienceGrants) -> AudienceReadPolicy
pub fn new(grants: AudienceGrants) -> AudienceReadPolicy
Builds a policy with an explicit static grant map.
Sourcepub fn with_store(
self,
store: Arc<SnapshotSource<AudienceGrantsLoader>>,
) -> AudienceReadPolicy
pub fn with_store( self, store: Arc<SnapshotSource<AudienceGrantsLoader>>, ) -> AudienceReadPolicy
Attaches the DB-backed grant store. A builder method, not a constructor argument, so
new/default keep working unchanged for every caller with no DB pool to back one
(disabled-auth, tests).
Trait Implementations§
Source§impl Clone for AudienceReadPolicy
impl Clone for AudienceReadPolicy
Source§fn clone(&self) -> AudienceReadPolicy
fn clone(&self) -> AudienceReadPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AudienceReadPolicy
impl Debug for AudienceReadPolicy
Source§impl Default for AudienceReadPolicy
impl Default for AudienceReadPolicy
Source§fn default() -> AudienceReadPolicy
fn default() -> AudienceReadPolicy
Source§impl ReadPolicy for AudienceReadPolicy
impl ReadPolicy for AudienceReadPolicy
Source§fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<ReadableAudiences, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
AudienceReadPolicy: 'async_trait,
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<ReadableAudiences, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
AudienceReadPolicy: 'async_trait,
caller’s readable-audience set, or Err if the policy could not be evaluated
(e.g. a backing store outage once a store-backed policy lands).Auto Trait Implementations§
impl !RefUnwindSafe for AudienceReadPolicy
impl !UnwindSafe for AudienceReadPolicy
impl Freeze for AudienceReadPolicy
impl Send for AudienceReadPolicy
impl Sync for AudienceReadPolicy
impl Unpin for AudienceReadPolicy
impl UnsafeUnpin for AudienceReadPolicy
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
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].