using DigitalData.Core.DTO; using System.DirectoryServices; namespace DigitalData.Core.Abstractions.Application { public interface IDirectorySearchService { public string ServerName { get; } public string Root { get; } string SearchRootPath { get; } Dictionary CustomSearchFilters { get; } /// /// Creates the connections to the server and returns a Boolean value that specifies /// whether the specified username and password are valid. /// /// The username that is validated on the server. See the Remarks section /// for more information on the format of userName. /// The password that is validated on the server. /// True if the credentials are valid; otherwise, false. bool ValidateCredentials(string userName, string password); /// /// Creates the connections to the server asynchronously and returns a Boolean value that specifies /// whether the specified username and password are valid. /// /// The username that is validated on the server. See the Remarks section /// for more information on the format of userName. /// The password that is validated on the server. /// True if the credentials are valid; otherwise, false. Task ValidateCredentialsAsync(string userName, string password); /// /// Finds all directory entries matching the specified filter. /// /// The search root. /// The search filter. /// The search scope. /// The size limit. /// The properties to load. /// A containing the results. DataResult> FindAll(DirectoryEntry searchRoot, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties); /// /// Finds all directory entries matching the specified filter asynchronously. /// /// The search root. /// The search filter. /// The search scope. /// The size limit. /// The properties to load. /// A containing the results. Task>> FindAllAsync(DirectoryEntry searchRoot, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties); /// /// Finds all directory entries matching the specified filter, using the user cache. /// /// The username. /// The search filter. /// The search scope. /// The size limit. /// The properties to load. /// A containing the results. DataResult> FindAllByUserCache(string username, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties); /// /// Finds all directory entries matching the specified filter asynchronously, using the user cache. /// /// The username. /// The search filter. /// The search scope. /// The size limit. /// The properties to load. /// A containing the results. Task>> FindAllByUserCacheAsync(string username, string filter, SearchScope searchScope = SearchScope.Subtree, int sizeLimit = 5000, params string[] properties); /// /// Sets the search root in the cache. /// /// The directory entry username. /// The directory entry password. void SetSearchRootCache(string username, string password); /// /// Gets the search root from the cache. /// /// The directory entry username. /// The cached if found; otherwise, null. DirectoryEntry? GetSearchRootCache(string username); } }