|
@@ -84,3 +84,27 @@ func TestCreateWithKeyTab(t *testing.T) {
|
|
|
t.Errorf("Expected error:%s, got:%s.", err, expectedErr)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func TestCreateWithDisablePAFXFAST(t *testing.T) {
|
|
|
+ kerberosConfig, err := krbcfg.NewConfigFromString(testdata.TEST_KRB5CONF)
|
|
|
+ if err != nil {
|
|
|
+ t.Fatal(err)
|
|
|
+ }
|
|
|
+ // Expect to try to create a client with keytab and fails with "o such file or directory" error
|
|
|
+ expectedErr := errors.New("open nonexist.keytab: no such file or directory")
|
|
|
+ clientConfig := NewConfig()
|
|
|
+ clientConfig.Net.SASL.Mechanism = SASLTypeGSSAPI
|
|
|
+ clientConfig.Net.SASL.Enable = true
|
|
|
+ clientConfig.Net.SASL.GSSAPI.ServiceName = "kafka"
|
|
|
+ clientConfig.Net.SASL.GSSAPI.Realm = "EXAMPLE.COM"
|
|
|
+ clientConfig.Net.SASL.GSSAPI.Username = "client"
|
|
|
+ clientConfig.Net.SASL.GSSAPI.AuthType = KRB5_KEYTAB_AUTH
|
|
|
+ clientConfig.Net.SASL.GSSAPI.KeyTabPath = "nonexist.keytab"
|
|
|
+ clientConfig.Net.SASL.GSSAPI.KerberosConfigPath = "/etc/krb5.conf"
|
|
|
+ clientConfig.Net.SASL.GSSAPI.DisablePAFXFAST = true
|
|
|
+
|
|
|
+ _, err = createClient(&clientConfig.Net.SASL.GSSAPI, kerberosConfig)
|
|
|
+ if err.Error() != expectedErr.Error() {
|
|
|
+ t.Errorf("Expected error:%s, got:%s.", err, expectedErr)
|
|
|
+ }
|
|
|
+}
|