Kafka ScramAuth
onetl.connection.db_connection.kafka.kafka_scram_auth.KafkaScramAuth
Bases: KafkaAuth, GenericOptions
Connect to Kafka using sasl.mechanism="SCRAM-SHA-256" or sasl.mechanism="SCRAM-SHA-512".
For more details see Kafka Documentation <https://kafka.apache.org/documentation/#security_sasl_scram_clientconfig>_.
.. versionadded:: 0.9.0
Examples
Auth in Kafka with SCRAM-SHA-256 mechanism:
.. code:: python
from onetl.connection import Kafka
auth = Kafka.ScramAuth(
user="me",
password="abc",
digest="SHA-256",
)
Auth in Kafka with SCRAM-SHA-512 mechanism and some custom SASL options passed to Kafka client config:
.. code:: python
from onetl.connection import Kafka
auth = Kafka.ScramAuth.parse(
{
"user": "me",
"password": "abc",
"digest": "SHA-512",
# options with `sasl.login.` prefix are passed to Kafka client config as-is
"sasl.login.class": "com.example.CustomScramLogin",
}
)
Source code in onetl/connection/db_connection/kafka/kafka_scram_auth.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
parse(options)
classmethod
If a parameter inherited from the ReadOptions class was passed, then it will be returned unchanged. If a Dict object was passed it will be converted to ReadOptions.
Otherwise, an exception will be raised
Source code in onetl/impl/generic_options.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |