public void SearchFilterBuilderAll() { string searchFilterExpected = "(objectClass=*)"; string searchFilter = LdapFilterBuilder.GetSearchFilter(); Assert.AreEqual(searchFilterExpected, searchFilter); }
public void SearchFilterBuilderOnlyObjectClass() { string searchFilterExpected = String.Format("(objectClass={0})", ObjectClass); string searchFilter = LdapFilterBuilder.GetSearchFilter(ObjectClass); Assert.AreEqual(searchFilterExpected, searchFilter); }
public LdapState SearchUsers(IList <string> otherReturnedAttributes, string[] searchedUsers, out IList <ILdapUser> searchResult) { searchResult = new List <ILdapUser>(); otherReturnedAttributes = otherReturnedAttributes == null?_baseAttributes.ToList() : _baseAttributes.Union(otherReturnedAttributes).ToList(); try { //Foreach all the credential,for everyone do the search and add user results to the out parameter searchResult = searchedUsers.Select( users => (SearchResponse)_ldapConnection.SendRequest( LdapRequestBuilder.GetSearchUserRequest(_configRepository.GetSearchBaseDn(), LdapFilterBuilder.GetSearchFilter(_configRepository.GetUserObjectClass(), _configRepository.GetMatchFieldName(), users), otherReturnedAttributes) )) .Aggregate(searchResult, (current, searchReturn) => current.Concat(LdapUserUtils.ConvertToLdapUsers(searchReturn)).ToList()); } catch (Exception e) { _logger.Write(_logger.BuildLogMessage(e.Message, LdapState.LdapSearchUserError)); return(LdapState.LdapSearchUserError); } if (searchResult.Count == 0) { _logger.Write(_logger.BuildLogMessage("Search Operation with NO RESULTS", LdapState.LdapSearchUserError)); return(LdapState.LdapSearchUserError); } _logger.Write(_logger.BuildLogMessage("Search Operation Success", LdapState.LdapUserManipulatorSuccess)); return(LdapState.LdapUserManipulatorSuccess); }
public void SearchFilterBuilderObjectClassAndFieldName() { string searchFilterExpected = String.Format("(&(objectClass={0})({1}={2}))", ObjectClass, FieldUsername, UserCn); string searchFilter = LdapFilterBuilder.GetSearchFilter(ObjectClass, FieldUsername, UserCn); Assert.AreEqual(searchFilterExpected, searchFilter); }
public LdapState SearchAllNodes(IList <string> otherReturnedAttributes, out IList <ILdapUser> searchResult) { return(BaseLdapSearch(otherReturnedAttributes, out searchResult, LdapFilterBuilder.GetSearchFilter())); }
public LdapState SearchUsers(IList <string> otherReturnedAttributes, out IList <ILdapUser> searchResult) { return(BaseLdapSearch(otherReturnedAttributes, out searchResult, LdapFilterBuilder.GetSearchFilter(_configRepository.GetUserObjectClass()))); }