pub struct ServerConfigBuilder { /* private fields */ }Expand description
Builds a rustls::ServerConfig backed by a live SPIFFE X509Source.
The resulting server configuration:
- presents the current SPIFFE X.509 SVID as the server certificate
- requires and validates client certificates (mTLS)
- authorizes the client by SPIFFE ID (URI SAN)
The builder retains an Arc<X509Source>. When the underlying SVID or trust
bundle is rotated by the SPIRE agent, new TLS handshakes automatically use
the updated material.
§Authorization
Client authorization is performed by invoking the provided
AuthorizeSpiffeId hook with the client’s SPIFFE ID extracted from the
certificate’s URI SAN.
Use ServerConfigOptions::allow_any to disable authorization while
retaining full TLS authentication.
Implementations§
Source§impl ServerConfigBuilder
impl ServerConfigBuilder
Sourcepub fn new(source: Arc<X509Source>, opts: ServerConfigOptions) -> Self
pub fn new(source: Arc<X509Source>, opts: ServerConfigOptions) -> Self
Creates a new builder from an X509Source and options.
Sourcepub async fn build(self) -> Result<ServerConfig>
pub async fn build(self) -> Result<ServerConfig>
Builds the rustls::ServerConfig.
Auto Trait Implementations§
impl Freeze for ServerConfigBuilder
impl !RefUnwindSafe for ServerConfigBuilder
impl Send for ServerConfigBuilder
impl Sync for ServerConfigBuilder
impl Unpin for ServerConfigBuilder
impl !UnwindSafe for ServerConfigBuilder
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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
T in a tonic::Request