/// <summary> /// LDAP library constructior where all the class variables are initialized /// The variables not specified in definition will be set at default values. /// </summary> /// <param name="adminUser">Admin user</param> /// <param name="adminMode">Admin User</param> /// <param name="ldapServer">LDAP Server with port</param> /// <param name="ldapSearchBaseDn">Base DN where start the search.</param> /// <param name="authType"></param> /// <param name="loggerType">Mode to log</param> /// <param name="logPath">Path of the logger File</param> public LdapManager(ILdapUser adminUser, LDAPAdminMode adminMode, string ldapServer, string ldapSearchBaseDn, AuthType authType, LoggerType loggerType, string logPath ) { _configRepository = LdapConfigRepositoryFactory.GetConfigRepository(); try { _configRepository.BasicLdapConfig(adminUser,adminMode, ldapServer, ldapSearchBaseDn, authType, loggerType, logPath); _logger = LoggerFactory.GetLogger(_configRepository.GetWriteLogFlag(), _configRepository.GetLogPath()); } catch (ArgumentNullException) { _ldapCurrentState = LdapState.LdapLibraryInitError; throw; } _adminModeChecker = new LdapAdminModeChecker(_configRepository); CommonInitOperations(); _ldapCurrentState = LdapState.LdapLibraryInitSuccess; }
/// <summary> /// LDAP library constructior where all the class variables are initialized /// The variables not specified in definition will be set at default values. /// </summary> /// <param name="adminUser">Admin user</param> /// <param name="adminMode">Admin User</param> /// <param name="ldapServer">LDAP Server with port</param> /// <param name="ldapSearchBaseDn">Base DN where start the search.</param> /// <param name="authType"></param> /// <param name="loggerType">Mode to log</param> /// <param name="logPath">Path of the logger File</param> public LdapManager(ILdapUser adminUser, LDAPAdminMode adminMode, string ldapServer, string ldapSearchBaseDn, AuthType authType, LoggerType loggerType, string logPath ) { _configRepository = LdapConfigRepositoryFactory.GetConfigRepository(); try { _configRepository.BasicLdapConfig(adminUser, adminMode, ldapServer, ldapSearchBaseDn, authType, loggerType, logPath); _logger = LoggerFactory.GetLogger(_configRepository.GetWriteLogFlag(), _configRepository.GetLogPath()); } catch (ArgumentNullException) { _ldapCurrentState = LdapState.LdapLibraryInitError; throw; } _adminModeChecker = new LdapAdminModeChecker(_configRepository); CommonInitOperations(); _ldapCurrentState = LdapState.LdapLibraryInitSuccess; }
/// <summary> /// More detailed contructor that user the default constructor and the addictionalLDAPInformation method /// </summary> public LdapManager(ILdapUser adminUser, LDAPAdminMode adminMode, string ldapServer, string ldapSearchBaseDn, AuthType authType, bool secureSocketLayerFlag, bool transportSocketLayerFlag, bool clientCertificateFlag, string clientCertificatePath, LoggerType loggerType, string logPath, string userObjectClass, string matchFieldUsername, TimeSpan connectionTimeout) : this(adminUser, adminMode, ldapServer, ldapSearchBaseDn, authType, loggerType, logPath) { try { _configRepository.AdditionalLdapConfig(secureSocketLayerFlag, transportSocketLayerFlag, clientCertificateFlag, clientCertificatePath, userObjectClass, matchFieldUsername, connectionTimeout); } catch (ArgumentNullException e) { _ldapCurrentState = LdapState.LdapLibraryInitError; _logger.Write(_logger.BuildLogMessage(e.Message, _ldapCurrentState)); throw; } CommonInitOperations(); _ldapCurrentState = LdapState.LdapLibraryInitSuccess; _logger.Write(_logger.BuildLogMessage("", _ldapCurrentState)); }
public bool ChangeUserPassword(ILdapUser user, string newPwd) { _ldapCurrentState = _manageLdapUser.ChangeUserPassword(user, newPwd); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
public bool SearchUsers(List<string> otherReturnedAttributes, string[] searchedUsers, out List<ILdapUser> searchResult) { _ldapCurrentState = _manageLdapUser.SearchUsers(otherReturnedAttributes, searchedUsers, out searchResult); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
public bool DeleteUser(ILdapUser user) { _ldapCurrentState = _manageLdapUser.DeleteUser(user); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
public bool ModifyUserAttribute(DirectoryAttributeOperation operationType, ILdapUser user, string attributeName, string attributeValue) { _ldapCurrentState = _manageLdapUser.ModifyUserAttribute(operationType, user, attributeName, attributeValue); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
/// <summary> /// Convert the state to a boolean /// </summary> /// <param name="state">Input State</param> /// <returns> /// TRUE - success state /// FALSE - error state /// </returns> public static bool ToBoolean(LdapState state) { return state == LdapState.LdapConnectionSuccess || state == LdapState.LdapLibraryInitSuccess || state == LdapState.LdapUserManipulatorSuccess; }
public bool CreateUser(ILdapUser newUser) { _ldapCurrentState = _manageLdapUser.CreateUser(newUser); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
public bool CreateUser(ILdapUser newUser) { _ldapCurrentState = _manageLdapUser.CreateUser(newUser); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public string BuildLogMessage(string message, LdapState state) { return String.Format("{0} - {1}", DateTime.Now.ToString(DateFormat, CultureInfo.InvariantCulture), _ldapErrors[state](message)); }
public bool Connect(NetworkCredential credential) { _ldapCurrentState = _connector.Connect(credential); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public bool Connect() { _ldapCurrentState = _connector.Connect(); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
public bool Connect() { _ldapCurrentState = _connector.Connect(); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public bool SearchAllNodes(IList <string> otherReturnedAttributes, out IList <ILdapUser> searchResult) { _ldapCurrentState = _searcher.SearchAllNodes(otherReturnedAttributes, out searchResult); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public bool ChangeUserPassword(ILdapUser user, string newPwd) { _ldapCurrentState = _manageLdapUser.ChangeUserPassword(user, newPwd); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public bool ModifyUserAttribute(DirectoryAttributeOperation operationType, ILdapUser user, string attributeName, string attributeValue) { _ldapCurrentState = _manageLdapUser.ModifyUserAttribute(operationType, user, attributeName, attributeValue); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public bool DeleteUser(ILdapUser user) { _ldapCurrentState = _manageLdapUser.DeleteUser(user); return(LdapStateUtils.ToBoolean(_ldapCurrentState)); }
public bool Connect(NetworkCredential credential) { _ldapCurrentState = _connector.Connect(credential); return LdapStateUtils.ToBoolean(_ldapCurrentState); }
public string BuildLogMessage(string message, LdapState state) { return(String.Format("{0} - {1}", DateTime.Now.ToString(DateFormat, CultureInfo.InvariantCulture), _ldapErrors[state](message))); }
/// <summary> /// More detailed contructor that user the default constructor and the addictionalLDAPInformation method /// </summary> public LdapManager(ILdapUser adminUser, LDAPAdminMode adminMode,string ldapServer,string ldapSearchBaseDn,AuthType authType,bool secureSocketLayerFlag,bool transportSocketLayerFlag,bool clientCertificateFlag,string clientCertificatePath,LoggerType loggerType,string logPath,string userObjectClass,string matchFieldUsername) : this(adminUser, adminMode, ldapServer, ldapSearchBaseDn, authType, loggerType, logPath) { try { _configRepository.AdditionalLdapConfig(secureSocketLayerFlag, transportSocketLayerFlag, clientCertificateFlag, clientCertificatePath, userObjectClass, matchFieldUsername); } catch (ArgumentNullException e) { _ldapCurrentState = LdapState.LdapLibraryInitError; _logger.Write(_logger.BuildLogMessage(e.Message, _ldapCurrentState)); throw; } CommonInitOperations(); _ldapCurrentState = LdapState.LdapLibraryInitSuccess; _logger.Write(_logger.BuildLogMessage("", _ldapCurrentState)); }
/// <summary> /// Convert the state to a boolean /// </summary> /// <param name="state">Input State</param> /// <returns> /// TRUE - success state /// FALSE - error state /// </returns> public static bool ToBoolean(LdapState state) { return(state == LdapState.LdapConnectionSuccess || state == LdapState.LdapLibraryInitSuccess || state == LdapState.LdapUserManipulatorSuccess); }