pub async fn outbound_sasl<S>(
stream: &mut S,
creds: &SaslCredentials,
server_name: &str,
client_id: &str,
frame_max: ClientFrameMax,
) -> Result<SaslSession, OutboundSaslError>Expand description
Run the outbound SASL handshake to completion over stream.
This function sends ApiVersions v0, then SaslHandshake with the
mechanism in creds at the version that the broker lists, then drives the
mechanism-specific SaslAuthenticate round-trips, as Kafka’s
SaslClientAuthenticator does. The requests use Kafka’s reserved SASL
correlation ids. server_name
is the broker’s canonical hostname. Only the GSSAPI path uses it, to build
the target SPN (service_name/server_name). The function returns once the
broker has accepted the credentials. The same stream is then usable for
normal Kafka RPCs.
§Errors
Returns OutboundSaslError on I/O failure, codec failure, or a
non-zero broker SASL error code.