Skip to main content

confluent_kafka/common/errors/
authentication_error.rs

1// Copyright 2025 Confluent Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Translated from `org.apache.kafka.common.errors.AuthenticationException`.
16
17use crate::common::error::kafka_error_type;
18use crate::common::protocol::Errors;
19
20kafka_error_type! {
21    /// This error indicates that SASL authentication has failed. On authentication failure,
22    /// clients abort the operation requested and raise one of the subclasses of this error:
23    ///
24    /// - `SaslAuthenticationError` if SASL handshake fails with invalid credentials or any other
25    ///   failure specific to the SASL mechanism used for authentication
26    /// - `UnsupportedSaslMechanismError` if the SASL mechanism requested by the client is not
27    ///   supported on the broker.
28    /// - `IllegalSaslStateError` if an unexpected request is received on during SASL handshake.
29    ///   This could be due to misconfigured security protocol.
30    /// - `SslAuthenticationError` if SSL handshake failed due to any `SSLException`.
31    ///
32    /// # Translation notes
33    ///
34    /// Error code `Errors::InvalidConfig`, inherited from `InvalidConfigurationException`
35    /// (`org.apache.kafka.common.protocol.Errors#forException` walks the superclass chain); that
36    /// code's own class stays `InvalidConfigurationError`.
37    #[doc(alias = "org.apache.kafka.common.errors.AuthenticationException")]
38    AuthenticationError,
39    code: Errors::InvalidConfig,
40    extends: [
41        is_kafka_error,
42        is_api_error,
43        is_invalid_configuration_error,
44        is_authentication_error,
45    ],
46}