@@ -56,6 +56,13 @@ func NewClient(conns *ConnSet, c *config.Config, netAddressMappingFunc config.Ne
5656 forbiddenApiKeys [int16 (apiKey )] = struct {}{}
5757 }
5858 }
59+ if c .Auth .Local .Enable && passwordAuthenticator == nil {
60+ return nil , errors .New ("Auth.Local.Enable is enabled but passwordAuthenticator is nil" )
61+ }
62+
63+ if c .Auth .Gateway .Client .Enable && tokenProvider == nil {
64+ return nil , errors .New ("Auth.Gateway.Client.Enable is enabled but tokenProvider is nil" )
65+ }
5966
6067 return & Client {conns : conns , config : c , tlsConfig : tlsConfig , tcpConnOptions : tcpConnOptions , stopRun : make (chan struct {}, 1 ),
6168 saslPlainAuth : & SASLPlainAuth {
@@ -66,10 +73,11 @@ func NewClient(conns *ConnSet, c *config.Config, netAddressMappingFunc config.Ne
6673 password : c .Kafka .SASL .Password ,
6774 },
6875 authClient : & AuthClient {
69- enabled : c .Auth .Gateway .Client .Enable ,
70- magic : c .Auth .Gateway .Client .Magic ,
71- method : c .Auth .Gateway .Client .Method ,
72- timeout : c .Auth .Gateway .Client .Timeout ,
76+ enabled : c .Auth .Gateway .Client .Enable ,
77+ magic : c .Auth .Gateway .Client .Magic ,
78+ method : c .Auth .Gateway .Client .Method ,
79+ timeout : c .Auth .Gateway .Client .Timeout ,
80+ tokenProvider : tokenProvider ,
7381 },
7482 processorConfig : ProcessorConfig {
7583 MaxOpenRequests : c .Kafka .MaxOpenRequests ,
0 commit comments