Add SASL mechanism option in Kafka (#1525)

*  add SASL mechasnim option in Kafka

* add toggle for authentication in kafka credentials

*  Revery default value

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Ahsan Virani
2021-03-11 14:25:02 +01:00
committed by GitHub
parent 0712334679
commit 71e21c2dae
3 changed files with 58 additions and 2 deletions

View File

@@ -123,10 +123,14 @@ export class KafkaTrigger implements INodeType {
logLevel: logLevel.ERROR,
};
if (credentials.username || credentials.password) {
if (credentials.authentication === true) {
if(!(credentials.username && credentials.password)) {
throw new Error('Username and password are required for authentication');
}
config.sasl = {
username: credentials.username as string,
password: credentials.password as string,
mechanism: credentials.saslMechanism as string,
} as SASLOptions;
}