Skip to main content

PrincipalResolver

Struct PrincipalResolver 

pub struct PrincipalResolver { /* private fields */ }
Expand description

The generation-aware shared resolver. One instance per daemon; the installed ResolverPolicy is swapped (never mutated) when the authorization configuration changes.

Implementations§

Source§

impl PrincipalResolver

Source

pub fn new(policy: ResolverPolicy) -> Self

Install the initial policy at generation 1 (0 is never a valid stamped generation, so an uninitialized consumer can’t look fresh).

Source

pub fn with_generation(policy: ResolverPolicy, generation: u64) -> Self

Install an initial policy at an already-established authorization generation. The inbound RPC state uses this while atomically replacing its whole compiled authentication snapshot.

Source

pub fn from_config(config: &Config) -> Result<Self>

Compile and install from config. Fails — installing nothing — if the auth sections are invalid; see ResolverPolicy::from_config.

Source

pub fn generation(&self) -> u64

The current authorization-policy generation. Consumers compare their stamped ResolvedPrincipal::generation against this before each privileged operation and re-resolve when it moved.

Source

pub fn replace_policy(&self, policy: ResolverPolicy) -> u64

Install a new policy, invalidating every previously stamped generation. Returns the new generation.

Source

pub fn replace_from_config(&self, config: &Config) -> Result<u64>

Re-compile from config and install (see Self::replace_policy) — UNLESS the auth sections are invalid. An invalid replacement is rejected with the validation error: the current policy stays installed and the generation does NOT advance, so established connections keep resolving against the last valid policy until the config is repaired and reloaded. Installation is the boundary: this does not trust the caller to have validated (the boot path deliberately tolerates a semantically invalid config so it can be repaired), and the check is auth-specific so unrelated config errors cannot block an authorization reload.

Source

pub fn resolve( &self, identity: &AuthenticatedIdentity, ) -> Result<ResolvedPrincipal, DenyReason>

Map a provider-verified identity to its canonical principal and the grants the CURRENT policy assigns it. Fail-closed: any gap — unknown roster id, missing mapping, missing profile, provider/alias inconsistency — is a denial, never partial or shared-operator access.

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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