@@ -364,6 +364,46 @@ Y_UNIT_TEST_SUITE(TGRpcLdapAuthentication) {
364364 ldapServer.Stop ();
365365 }
366366
367+ Y_UNIT_TEST (LdapAuthWithEmptyPassword) {
368+ TString login = " ldapUser" ;
369+ TString password = " " ;
370+
371+ LdapMock::TLdapMockResponses responses;
372+ responses.BindResponses .push_back ({{{.Login = " cn=robouser,dc=search,dc=yandex,dc=net" , .Password = " robouserPassword" }}, {.Status = LdapMock::EStatus::SUCCESS}});
373+
374+ LdapMock::TSearchRequestInfo fetchUserSearchRequestInfo {
375+ {
376+ .BaseDn = " dc=search,dc=yandex,dc=net" ,
377+ .Scope = 2 ,
378+ .DerefAliases = 0 ,
379+ .Filter = {.Type = LdapMock::EFilterType::LDAP_FILTER_EQUALITY, .Attribute = " uid" , .Value = login},
380+ .Attributes = {" 1.1" }
381+ }
382+ };
383+
384+ std::vector<LdapMock::TSearchEntry> fetchUserSearchResponseEntries {
385+ {
386+ .Dn = " uid=" + login + " ,dc=search,dc=yandex,dc=net"
387+ }
388+ };
389+
390+ LdapMock::TSearchResponseInfo fetchUserSearchResponseInfo {
391+ .ResponseEntries = fetchUserSearchResponseEntries,
392+ .ResponseDone = {.Status = LdapMock::EStatus::SUCCESS}
393+ };
394+ responses.SearchResponses .push_back ({fetchUserSearchRequestInfo, fetchUserSearchResponseInfo});
395+
396+ TLoginClientConnection loginConnection (InitLdapSettings);
397+ LdapMock::TLdapSimpleServer ldapServer (loginConnection.GetLdapPort (), responses);
398+
399+ auto factory = CreateLoginCredentialsProviderFactory ({.User = login + " @ldap" , .Password = password});
400+ auto loginProvider = factory->CreateProvider (loginConnection.GetCoreFacility ());
401+ UNIT_ASSERT_EXCEPTION_CONTAINS (loginProvider->GetAuthInfo (), yexception, " User is unauthorized in LDAP server. Empty password" );
402+
403+ loginConnection.Stop ();
404+ ldapServer.Stop ();
405+ }
406+
367407 Y_UNIT_TEST (LdapAuthSetIncorrectDomain) {
368408 TString login = " ldapuser" ;
369409 TString password = " ldapUserPassword" ;
0 commit comments