pub enum TrustDomainPolicy {
AnyInBundleSet,
AllowList(BTreeSet<TrustDomain>),
LocalOnly(TrustDomain),
}Expand description
Policy for selecting which trust domains to trust during certificate verification.
When SPIFFE federation is configured, the Workload API delivers trust bundles for multiple trust domains. This policy allows you to restrict which of those bundles are actually used during certificate verification.
This is a defense-in-depth mechanism. The primary trust model comes from the bundle set delivered by the SPIFFE Workload API. This policy provides an additional layer of control over which trust domains are accepted.
Default: AnyInBundleSet - use all bundles provided by the Workload API.
§Examples
use spiffe_rustls::{AllowList, AnyInBundleSet, TrustDomainPolicy};
use std::collections::BTreeSet;
// Default: trust any domain in the bundle set
let policy = AnyInBundleSet;
// Restrict to specific trust domains (using re-exported variant)
let mut allowed = BTreeSet::new();
allowed.insert("broker.example".try_into().unwrap());
let policy = AllowList(allowed);
// You can also use the full path if preferred
let policy = TrustDomainPolicy::default();Variants§
AnyInBundleSet
Default: use all trust domain bundles provided by the Workload API.
When SPIFFE federation is configured, the Workload API delivers bundles for multiple trust domains. This policy accepts all of them, allowing the verifier to automatically select the correct bundle based on the peer’s SPIFFE ID. No additional configuration is needed for federation to work.
AllowList(BTreeSet<TrustDomain>)
Restrict to these trust domains only.
Only bundles for these trust domains will be used, even if other bundles are present in the bundle set.
LocalOnly(TrustDomain)
Only trust the specified trust domain.
Only bundles for this trust domain will be used, even if the Workload API provides bundles for other trust domains. This restricts certificate verification to a single trust domain.
Implementations§
Source§impl TrustDomainPolicy
impl TrustDomainPolicy
Sourcepub fn allows(&self, trust_domain: &TrustDomain) -> bool
pub fn allows(&self, trust_domain: &TrustDomain) -> bool
Checks if a trust domain is allowed by this policy.
Trait Implementations§
Source§impl Clone for TrustDomainPolicy
impl Clone for TrustDomainPolicy
Source§fn clone(&self) -> TrustDomainPolicy
fn clone(&self) -> TrustDomainPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TrustDomainPolicy
impl Debug for TrustDomainPolicy
Source§impl Default for TrustDomainPolicy
impl Default for TrustDomainPolicy
Source§fn default() -> TrustDomainPolicy
fn default() -> TrustDomainPolicy
Auto Trait Implementations§
impl Freeze for TrustDomainPolicy
impl RefUnwindSafe for TrustDomainPolicy
impl Send for TrustDomainPolicy
impl Sync for TrustDomainPolicy
impl Unpin for TrustDomainPolicy
impl UnwindSafe for TrustDomainPolicy
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request