/// Performs X.509 authentication for a given stream.
Performs X.509 authentication for a given stream.
Performs X . 509 authentication for a given stream .
pub(super) async fn authenticate_stream(
    conn: &mut Connection,
    credential: &Credential,
    server_api: Option<&ServerApi>,
    server_first: impl Into<Option<Document>>,
) -> Result<()> {
    let server_response = match server_first.into() {
        Some(server_first) => server_first,
        None => send_client_first(conn, credential, server_api)
            .await?
            .auth_response_body("MONGODB-X509")?,
    };
    if server_response.get_str("dbname") != Ok("$external") {
        return Err(Error::authentication_error(
            "MONGODB-X509",
            "Authentication failed",
        ));
    }
    Ok(())
}
pub ( super ) async fn authenticate_stream ( conn : & mut Connection , credential : & Credential , server_api : Option < & ServerApi > , server_first : impl Into < Option < Document > > , ) -> Result < ( ) > { let server_response = match server_first . into ( ) { Some ( server_first ) => server_first , None => send_client_first ( conn , credential , server_api ) . await ? . auth_response_body ( " " ) ? , } ; if server_response . get_str ( " " ) != Ok ( " " ) { return Err ( Error :: authentication_error ( " " , " " , ) ) ; } Ok ( ( ) ) }
Performs X.509 authentication for a given stream.
Performs X . 509 authentication for a given stream .
conn
&mut Connection
credential
&Credential
server_api
Option<&ServerApi>
server_first
impl Into<Option<Document>>