flv_tls_proxy/
authenticator.rs

1use async_trait::async_trait;
2use fluvio_future::net::TcpStream;
3use fluvio_future::openssl::DefaultServerTlsStream;
4
5/// Abstracts logic to authenticate incoming stream and forward authoization context to target
6#[async_trait]
7pub trait Authenticator: Send + Sync {
8    async fn authenticate(
9        &self,
10        incoming_tls_stream: &DefaultServerTlsStream,
11        target_tcp_stream: &TcpStream,
12    ) -> Result<bool, std::io::Error>;
13}
14
15/// Null implementation where authenticate always returns true
16pub(crate) struct NullAuthenticator;
17
18#[async_trait]
19impl Authenticator for NullAuthenticator {
20    async fn authenticate(
21        &self,
22        _: &DefaultServerTlsStream,
23        _: &TcpStream,
24    ) -> Result<bool, std::io::Error> {
25        Ok(true)
26    }
27}