@@ -380,6 +380,48 @@ Y_UNIT_TEST_SUITE(TGRpcLdapAuthentication) {
380
380
ldapServer.Stop ();
381
381
}
382
382
383
+ Y_UNIT_TEST (LdapAuthWithEmptyPassword) {
384
+ TString login = " ldapUser" ;
385
+ TString password = " " ;
386
+
387
+ LdapMock::TLdapMockResponses responses;
388
+ responses.BindResponses .push_back ({{{.Login = " cn=robouser,dc=search,dc=yandex,dc=net" , .Password = " robouserPassword" }}, {.Status = LdapMock::EStatus::SUCCESS}});
389
+
390
+ LdapMock::TSearchRequestInfo fetchUserSearchRequestInfo {
391
+ {
392
+ .BaseDn = " dc=search,dc=yandex,dc=net" ,
393
+ .Scope = 2 ,
394
+ .DerefAliases = 0 ,
395
+ .Filter = {.Type = LdapMock::EFilterType::LDAP_FILTER_EQUALITY, .Attribute = " uid" , .Value = login},
396
+ .Attributes = {" 1.1" }
397
+ }
398
+ };
399
+
400
+ std::vector<LdapMock::TSearchEntry> fetchUserSearchResponseEntries {
401
+ {
402
+ .Dn = " uid=" + login + " ,dc=search,dc=yandex,dc=net"
403
+ }
404
+ };
405
+
406
+ LdapMock::TSearchResponseInfo fetchUserSearchResponseInfo {
407
+ .ResponseEntries = fetchUserSearchResponseEntries,
408
+ .ResponseDone = {.Status = LdapMock::EStatus::SUCCESS}
409
+ };
410
+ responses.SearchResponses .push_back ({fetchUserSearchRequestInfo, fetchUserSearchResponseInfo});
411
+
412
+ TLoginClientConnection loginConnection (InitLdapSettings);
413
+ LdapMock::TLdapSimpleServer ldapServer (loginConnection.GetLdapPort (), responses);
414
+
415
+ auto factory = CreateLoginCredentialsProviderFactory ({.User = login + " @ldap" , .Password = password});
416
+ auto loginProvider = factory->CreateProvider (loginConnection.GetCoreFacility ());
417
+ TStringBuilder expectedErrorMessage;
418
+ expectedErrorMessage << " LDAP login failed. Empty password" ;
419
+ UNIT_ASSERT_EXCEPTION_CONTAINS (loginProvider->GetAuthInfo (), yexception, expectedErrorMessage);
420
+
421
+ loginConnection.Stop ();
422
+ ldapServer.Stop ();
423
+ }
424
+
383
425
Y_UNIT_TEST (LdapAuthSetIncorrectDomain) {
384
426
TString login = " ldapuser" ;
385
427
TString password = " ldapUserPassword" ;
0 commit comments