Skip to main content

RpcInboundAuth

Struct RpcInboundAuth 

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

The daemon’s inbound-auth layer. The accepted state is a single snapshot: registry, resolver/generation, uid roster, and local trust posture are rebuilt and published together or not at all.

Implementations§

Source§

impl RpcInboundAuth

Source

pub fn from_config(config: &Config, pairing: Arc<PairingGuard>) -> Result<Self>

Source

pub fn for_tests(config: &Config) -> Arc<Self> ⓘ

Test-only permissive layer: empty auth config, fresh pairing guard. Local connections resolve through the legacy shared-operator path.

Source

pub fn generation(&self) -> u64

Current authorization generation from the accepted snapshot.

Source

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

Resolve against one coherent accepted snapshot.

Source

pub fn pairing(&self) -> &Arc<PairingGuard> ⓘ

The live pairing authority, for per-operation revocation checks.

Source

pub fn provider_names(&self) -> Vec<String>

The handshake’s advertised provider names.

Source

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

Re-compile policy from the current config: resolver policy, uid roster, and the roster-configured flag move together, and every previously stamped generation becomes stale. Returns the new generation.

The resolver validates and installs FIRST: if the auth sections are invalid it returns the error and nothing here changes — the previous policy, roster, flags, and generation all stay in effect.

Source

pub fn accepted_revision(&self) -> u64

The revision of the configuration the accepted state was built from.

Source

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

Publish an accepted policy built from a configuration that has been persisted as revision.

Takes the same write lock over the accepted state that Self::refresh_from_config takes, so the state and the revision it carries are installed together. A revision that is not newer than the accepted one is refused as a no-op and the current generation is returned, which is what keeps a writer that was slow to publish from reinstalling superseded policy over a newer one.

A persistence that leaves every authorization input as it was (see auth_inputs) records its revision without moving the generation. Nothing the accepted state is compiled from changed, and moving the generation would make every established binding re-resolve over an unrelated edit, which an OIDC binding cannot survive.

Returns the generation in force after the call.

Source

pub fn accepted_at_least( &self, revision: u64, ) -> Result<Arc<AcceptedAuthState>, DenyReason>

The accepted state, but only once it has caught up to revision.

Fail-closed: a consumer that needs to act on a policy it just persisted gets a denial rather than the previous state when the publication has not landed yet.

Source

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

Prove that an auth snapshot can be compiled before a caller persists a config edit. The caller still uses Self::refresh_from_config to publish it after the save boundary.

Source

pub fn revalidate_and_resolve( &self, auth: &ConnectionAuth, ) -> Result<ResolvedPrincipal, DenyReason>

Recheck non-secret local evidence and resolve one newly accepted generation. OIDC changes require initialize because this stage never retains the bearer that could be reverified.

Source

pub fn resolve_current( &self, auth: &ConnectionAuth, ) -> Result<ResolvedPrincipal, DenyReason>

Resolve an established binding against the accepted policy, rechecking its local credential evidence only when its stamped generation is no longer current.

At an unchanged generation that evidence cannot have been invalidated: the OIDC verifiers, the uid roster, and the daemon-uid trust posture change only through a new publication, and the caller checks expiry, the revalidation deadline, and pairing liveness on every operation. This is the rule the dispatcher’s gate applies, and it is what keeps an OIDC binding, whose bearer is never retained, usable until a publication changes the authorization inputs; a config save that leaves them unchanged does not move the generation. After such a change, Self::revalidate_and_resolve applies and an OIDC binding must initialize again.

Source

pub fn credential_is_live( &self, auth: &ConnectionAuth, ) -> Result<(), AuthDenied>

Whether the credential behind auth is still live: not expired, not past its revalidation deadline, and, for a native pairing token, still paired.

Source

pub fn hold_authority(&self) -> AuthorityLease<'_>

Hold the accepted authorization state and the paired-token set still until the returned lease is dropped: no policy publication can install a new state and no pairing can be revoked meanwhile.

A surface that must not let a revocation land between its final authority check and the effect that check guards takes the lease, checks with AuthorityLease::current_grants, performs the effect, then drops it. A publication or revocation that arrives meanwhile completes after the effect, so the effect is ordered before it.

Keep the hold short and synchronous. While a publication or revocation is queued behind it, new readers of the same lock wait too, so do not reach this layer’s other methods on the holding thread; the lease answers from what it holds.

Source§

impl RpcInboundAuth

Source

pub fn current_grants( &self, auth: &ConnectionAuth, ) -> Result<ResolvedGrants, AuthDenied>

The grants auth holds under the accepted policy in force now, not the ones stamped on it at admission: a live credential, a fresh resolution, and a generation that did not move underneath that resolution.

A surface that acts on an admitted binding after a wait calls this at the effect, so a revocation that lands during the wait binds it.

Source

pub async fn authenticate( &self, transport: TransportKind, transport_credential: Credential, auth_token: Option<&str>, auth_provider: Option<&str>, ) -> Result<ConnectionAuth, AuthDenied>

Authenticate one initialize handshake into a ConnectionAuth.

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