Ejemplo n.º 1
0
 public LdapConnector(ILdapAdminModeChecker adminModeChecker, ILdapConfigRepository configRepository, ILogger logger)
 {
     _adminModeChecker = adminModeChecker;
     _configRepository = configRepository;
     _logger = logger;
     _observers = new List<ILdapConnectionObserver>();
 }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Purge the connection and the object reference in the class
 /// </summary>
 public void Dispose()
 {
     _configRepository = null;
     _logger = null;
     _adminModeChecker = null;
     _observers = null;
     _ldapConnection.Dispose();
 }
Ejemplo n.º 4
0
 public static ILdapConnector GetLdapConnector(ILdapAdminModeChecker adminModeChecker,ILdapConfigRepository configRepository, ILogger logger)
 {
     if (adminModeChecker.IsAnonymousMode()) return new AnonymousLdapConnector(configRepository,logger);
     if (adminModeChecker.IsNoAdminMode()) return new NoAdminLdapConnector(configRepository, logger);
     return new AdminLdapConnector(configRepository, logger);
 }
Ejemplo n.º 5
0
 public static ILdapConnector GetLdapConnector(ILdapAdminModeChecker adminModeChecker,
     ILdapConfigRepository configRepository, ILogger logger)
 {
     return new LdapConnector(adminModeChecker, configRepository, logger);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Call the dispose method of his fields and set to null the reference fo the others
 /// </summary>
 public void Dispose()
 {
     _manageLdapUser.Dispose();
     _connector.Dispose();
     _configRepository = null;
     _logger = null;
     _adminModeChecker = null;
 }