Class SaslExtensions
java.lang.Object
org.apache.kafka.common.security.auth.SaslExtensions
A simple immutable value object class holding customizable SASL extensions.
Note on object identity and equality:
SaslExtensions
intentionally
overrides the standard equals(Object)
and hashCode()
methods calling their
respective Object.equals(Object)
and Object.hashCode()
implementations. In so
doing, it provides equality only via reference identity and will not base equality on
the underlying values of its extentions map
.
The reason for this approach to equality is based off of the manner in which
credentials are stored in a Subject
. SaslExtensions
are added to and
removed from a Subject
via its public credentials
.
The public credentials are stored in a Set
in the Subject
, so object equality
therefore becomes a concern. With shallow, reference-based equality, distinct
SaslExtensions
instances with the same map values can be considered unique. This is
critical to operations like token refresh.
See KAFKA-14062 for more detail.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SaslExtensions
empty()
Creates an "empty" instance indicating no SASL extensions.final boolean
Implements equals using the reference comparison implementation fromObject.equals(Object)
.final int
hashCode()
ImplementshashCode
using the native implementation fromObject.hashCode()
.map()
Returns an immutable map of the extension names and their valuestoString()
-
Constructor Details
-
SaslExtensions
-
-
Method Details
-
map
Returns an immutable map of the extension names and their values -
empty
Creates an "empty" instance indicating no SASL extensions. Do not cache the result of this method call for use by multipleSubject
s as the references need to be unique. See the class-level documentation for details.- Returns:
- Unique, but empty,
SaslExtensions
instance
-
equals
Implements equals using the reference comparison implementation fromObject.equals(Object)
. See the class-level documentation for details. -
hashCode
public final int hashCode()ImplementshashCode
using the native implementation fromObject.hashCode()
. See the class-level documentation for details. -
toString
-