You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: authenticator.rs
    path of file: ./repos/fluvio/crates/fluvio-auth/src/x509
    
    the code of the file until where you have to start completion: use std::{collections::HashMap, path::Path};
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
use fluvio_future::net::AsConnectionFd;

use tracing::{debug, trace};
use x509_parser::{certificate::X509Certificate, parse_x509_certificate};
use async_trait::async_trait;

use fluvio_future::{net::TcpStream, openssl::DefaultServerTlsStream};
use fluvio_protocol::api::{RequestMessage, ResponseMessage};
use flv_tls_proxy::authenticator::Authenticator;

use super::request::Auth
    
    fn principal_from_tls_stream(tls_stream: &DefaultServerTlsStream) -> Result<String, IoError> {
        trace!("tls_stream {:?}", tls_stream);

        let peer_certificate = tls_stream.peer_certificate();

        trace!("peer_certificate {:?}", peer_certificate);

        let client_certificate = tls_stream.peer_certificate().ok_or(IoErrorKind::NotFound)?;

        trace!("client_certificate {:?}", tls_stream);

        let principal = Self::principal_from_raw_certificate(
            &client_certificate
                .to_der()
                .map_err(|err| err.into_io_error())?,
        )?;

        Ok(principal)
    }