@@ -151,6 +151,72 @@ describe('generateKafkaAuthObject', () => {
151151 'sasl.password' : 'testpassword' ,
152152 } ,
153153 } ,
154+ // SCRAM authentication
155+ {
156+ description : 'SCRAM-SHA-256 authentication with credentials file' ,
157+ valid : true ,
158+ input : {
159+ type : 'scram' ,
160+ protocol : 'SASL_SSL' ,
161+ mechanism : 'SHA-256' ,
162+ credentialsFile : 'credentials.json' ,
163+ } ,
164+ expected : {
165+ 'security.protocol' : 'SASL_SSL' ,
166+ 'sasl.mechanisms' : 'SCRAM-SHA-256' ,
167+ 'sasl.username' : 'testuser' ,
168+ 'sasl.password' : 'testpassword' ,
169+ } ,
170+ } ,
171+ {
172+ description : 'SCRAM-SHA-512 authentication with inline credentials' ,
173+ valid : true ,
174+ input : {
175+ type : 'scram' ,
176+ protocol : 'SASL_PLAINTEXT' ,
177+ mechanism : 'SHA-512' ,
178+ username : 'testuser' ,
179+ password : 'testpassword' ,
180+ } ,
181+ expected : {
182+ 'security.protocol' : 'SASL_PLAINTEXT' ,
183+ 'sasl.mechanisms' : 'SCRAM-SHA-512' ,
184+ 'sasl.username' : 'testuser' ,
185+ 'sasl.password' : 'testpassword' ,
186+ } ,
187+ } ,
188+ {
189+ description : 'SCRAM authentication with missing credentials file' ,
190+ valid : false ,
191+ input : {
192+ type : 'scram' ,
193+ protocol : 'SASL_PLAINTEXT' ,
194+ mechanism : 'SHA-256' ,
195+ credentialsFile : 'nonexistent.json' ,
196+ } ,
197+ } ,
198+ {
199+ description : 'SCRAM authentication with unsupported protocol' ,
200+ valid : false ,
201+ input : {
202+ type : 'scram' ,
203+ protocol : 'UNSUPPORTED_PROTOCOL' ,
204+ mechanism : 'SHA-256' ,
205+ username : 'testuser' ,
206+ password : 'testpassword' ,
207+ } ,
208+ } ,
209+ {
210+ description : 'SCRAM authentication with unsupported mechanism' ,
211+ valid : false ,
212+ input : {
213+ type : 'scram' ,
214+ protocol : 'SASL_PLAINTEXT' ,
215+ mechanism : 'SHA-1' ,
216+ username : 'testuser' ,
217+ password : 'testpassword' ,
218+ } ,
219+ } ,
154220 {
155221 description : 'Basic authentication with missing credentials file' ,
156222 valid : false ,
0 commit comments