Esempio n. 1
0
        public bool TestStardardInitLibraryNoAdmin()
        {
            try
            {
                var authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                    Config.LdapLibrary["LDAPAuthType"]);

                _ldapManagerObj = new LdapManager(null,
                                                  (LDAPAdminMode)Enum.Parse(typeof(LDAPAdminMode), Config.LdapLibrary["LDAPAdminMode"]),
                                                  Config.LdapLibrary["LDAPServer"],
                                                  Config.LdapLibrary["LDAPSearchBaseDN"],
                                                  authType, (LoggerType)Enum.Parse(typeof(LoggerType), Config.LdapLibrary["enableLDAPLibraryLog"]),
                                                  Config.LdapLibrary["LDAPLibraryLogPath"]
                                                  );

                if (!_ldapManagerObj.Equals(null))
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 2
0
        public void testCompleteInitLibrary()
        {
            LdapUser adminUser = new LdapUser(ConfigurationManager.AppSettings["LDAPAdminUserDN"],
                                              ConfigurationManager.AppSettings["LDAPAdminUserCN"],
                                              ConfigurationManager.AppSettings["LDAPAdminUserSN"],
                                              null);

            adminUser.CreateUserAttribute("userPassword", ConfigurationManager.AppSettings["LDAPAdminUserPassword"]);

            AuthType authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                     ConfigurationManager.AppSettings["LDAPAuthType"]);

            LdapManagerObj = new LdapManager(adminUser,
                                             ConfigurationManager.AppSettings["LDAPServer"],
                                             ConfigurationManager.AppSettings["LDAPSearchBaseDN"],
                                             authType,
                                             Convert.ToBoolean(ConfigurationManager.AppSettings["secureSocketLayerFlag"]),
                                             Convert.ToBoolean(ConfigurationManager.AppSettings["transportSocketLayerFlag"]),
                                             Convert.ToBoolean(ConfigurationManager.AppSettings["ClientCertificationFlag"]),
                                             ConfigurationManager.AppSettings["clientCertificatePath"],
                                             Convert.ToBoolean(ConfigurationManager.AppSettings["enableLDAPLibraryLog"]),
                                             ConfigurationManager.AppSettings["LDAPLibraryLogPath"],
                                             ConfigurationManager.AppSettings["LdapUserObjectClass"],
                                             ConfigurationManager.AppSettings["LDAPMatchFieldUsername"]
                                             );

            Assert.IsFalse(LdapManagerObj.Equals(null));
        }
Esempio n. 3
0
        public TestRepository(ILdapManager ldapManagerObj, TestUserRepository testUserRepository)
        {
            _testImplementation = new TestImplementation.TestImplementation(testUserRepository, ldapManagerObj);

            TestList = new Dictionary<TestType, TestMethod>
            {
                {TestType.TestAdminConnection, _testImplementation.TestAdminConnect},
                {TestType.TestCreateUser, _testImplementation.TestCreateUser},
                {TestType.TestDeleteUser, _testImplementation.TestDeleteUser},
                {TestType.TestInitLibrary, _testImplementation.TestCompleteInitLibrary},
                {TestType.TestInitLibraryNoAdmin, _testImplementation.TestStardardInitLibraryNoAdmin},
                {TestType.TestModifyUserDescription, _testImplementation.TestModifyUserAttribute},
                {TestType.TestSearchUsers, _testImplementation.TestSearchUser},
                {TestType.TestStandardInitLibraryNoAdmin, _testImplementation.TestStardardInitLibraryNoAdmin},
                {TestType.TestUserChangePassword, _testImplementation.TestChangeUserPassword},
                {
                    TestType.TestConnectUser, () =>
                    {
                        var testMethod = new TestMethod(_testImplementation.TestUserConnectWithoutWritePermissions);
                        if (_writePermission) testMethod = _testImplementation.TestUserConnect;
                        return testMethod();
                    }
                },
                {
                    TestType.TestSearchUserAndConnect, () =>
                    {
                        var testMethod =
                            new TestMethod(_testImplementation.TestSearchUserAndConnectWithoutWritePermissions);
                        if (_writePermission) testMethod = _testImplementation.TestSearchUserAndConnect;
                        return testMethod();
                    }
                }
            };
        }
Esempio n. 4
0
        public bool TestCompleteInitLibraryNoAdmin()
        {
            try
            {
                var authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                    Config.LdapLibrary["LDAPAuthType"]);

                _ldapManagerObj = new LdapManager(null,
                                                  (LDAPAdminMode)Enum.Parse(typeof(LDAPAdminMode), Config.LdapLibrary["LDAPAdminMode"]),
                                                  Config.LdapLibrary["LDAPServer"],
                                                  Config.LdapLibrary["LDAPSearchBaseDN"],
                                                  authType,
                                                  Convert.ToBoolean(Config.LdapLibrary["secureSocketLayerFlag"]),
                                                  Convert.ToBoolean(Config.LdapLibrary["transportSocketLayerFlag"]),
                                                  Convert.ToBoolean(Config.LdapLibrary["ClientCertificationFlag"]),
                                                  Config.LdapLibrary["clientCertificatePath"],
                                                  (LoggerType)Enum.Parse(typeof(LoggerType), Config.LdapLibrary["enableLDAPLibraryLog"]),
                                                  Config.LdapLibrary["LDAPLibraryLogPath"],
                                                  Config.LdapLibrary["LDAPUserObjectClass"],
                                                  Config.LdapLibrary["LDAPMatchFieldUsername"],
                                                  TimeSpan.Parse(Config.LdapLibrary["LDAPConnectionTimeout"])
                                                  );

                if (!_ldapManagerObj.Equals(null))
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 5
0
        public void testCompleteInitLibrary()
        {

            LdapUser adminUser = new LdapUser(ConfigurationManager.AppSettings["LDAPAdminUserDN"],
                                                ConfigurationManager.AppSettings["LDAPAdminUserCN"],
                                                ConfigurationManager.AppSettings["LDAPAdminUserSN"],
                                                null);
            adminUser.CreateUserAttribute("userPassword", ConfigurationManager.AppSettings["LDAPAdminUserPassword"]);

            AuthType authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                        ConfigurationManager.AppSettings["LDAPAuthType"]);

            LdapManagerObj = new LdapManager(adminUser,
                                                ConfigurationManager.AppSettings["LDAPServer"],
                                                ConfigurationManager.AppSettings["LDAPSearchBaseDN"],
                                                authType,
                                                Convert.ToBoolean(ConfigurationManager.AppSettings["secureSocketLayerFlag"]),
                                                Convert.ToBoolean(ConfigurationManager.AppSettings["transportSocketLayerFlag"]),
                                                Convert.ToBoolean(ConfigurationManager.AppSettings["ClientCertificationFlag"]),
                                                ConfigurationManager.AppSettings["clientCertificatePath"],
                                                Convert.ToBoolean(ConfigurationManager.AppSettings["enableLDAPLibraryLog"]),
                                                ConfigurationManager.AppSettings["LDAPLibraryLogPath"],
                                                ConfigurationManager.AppSettings["LdapUserObjectClass"],
                                                ConfigurationManager.AppSettings["LDAPMatchFieldUsername"]
                                                );

            Assert.IsFalse(LdapManagerObj.Equals(null));
        }
Esempio n. 6
0
        public void TestStandardInitLibrary()
        {
            _ldapManagerObj = new LdapManager(AdminUser, AdminMode,
                                              LdapServer,
                                              LdapSearchBaseDn,
                                              LdapAuthType, EnableLdapLibraryLog, LdapLibraryLogPath
                                              );

            Assert.IsFalse(_ldapManagerObj.Equals(null));
        }
Esempio n. 7
0
        public void testStardardInitLibraryNoAdmin()
        {
            AuthType authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                     ConfigurationManager.AppSettings["LDAPAuthType"]);

            LdapManagerObj = new LdapManager(null,
                                             ConfigurationManager.AppSettings["LDAPServer"],
                                             ConfigurationManager.AppSettings["LDAPSearchBaseDN"],
                                             authType
                                             );

            Assert.IsFalse(LdapManagerObj.Equals(null));
        }
Esempio n. 8
0
        public void testStardardInitLibraryNoAdmin()
        {
            AuthType authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                       ConfigurationManager.AppSettings["LDAPAuthType"]);

            LdapManagerObj = new LdapManager(null,
                                                    ConfigurationManager.AppSettings["LDAPServer"],
                                                    ConfigurationManager.AppSettings["LDAPSearchBaseDN"],
                                                    authType
                                                    );

            Assert.IsFalse(LdapManagerObj.Equals(null));

        }
Esempio n. 9
0
 public void TestCompleteInitLibraryNoAdmin_SearchBaseDN_Null()
 {
     _ldapManagerObj = new LdapManager(null, LDAPAdminMode.NoAdmin,
                                       LdapServer,
                                       "",
                                       LdapAuthType,
                                       SecureSocketLayerFlag,
                                       TransportSocketLayerFlag,
                                       ClientCertificationFlag,
                                       ClientCertificatePath,
                                       EnableLdapLibraryLog,
                                       LdapLibraryLogPath,
                                       LdapUserObjectClass,
                                       LdapMatchFieldUsername,
                                       connectionTimeout
                                       );
 }
Esempio n. 10
0
 public void TestCompleteInitLibraryNoLogPath_None()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode,
                                       LdapServer,
                                       LdapSearchBaseDn,
                                       LdapAuthType,
                                       SecureSocketLayerFlag,
                                       TransportSocketLayerFlag,
                                       ClientCertificationFlag,
                                       ClientCertificatePath,
                                       LoggerType.None,
                                       "",
                                       LdapUserObjectClass,
                                       LdapMatchFieldUsername,
                                       connectionTimeout
                                       );
 }
Esempio n. 11
0
 public void TestCompleteInitLibraryNoServer()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode,
                                       "",
                                       LdapSearchBaseDn,
                                       LdapAuthType,
                                       SecureSocketLayerFlag,
                                       TransportSocketLayerFlag,
                                       ClientCertificationFlag,
                                       ClientCertificatePath,
                                       EnableLdapLibraryLog,
                                       LdapLibraryLogPath,
                                       LdapUserObjectClass,
                                       LdapMatchFieldUsername,
                                       connectionTimeout
                                       );
     Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1), "LDAP LIBRARY INIT ERROR: ");
 }
        public void TestCompleteInitLibrary()
        {
            _ldapManagerObj = new LdapManager(null,AdminMode,
                LdapServer,
                LdapSearchBaseDn,
                LdapAuthType,
                SecureSocketLayerFlag,
                TransportSocketLayerFlag,
                ClientCertificationFlag,
                ClientCertificatePath,
                EnableLdapLibraryLog,
                LdapLibraryLogPath,
                LdapUserObjectClass,
                LdapMatchFieldUsername
                );

            Assert.IsFalse(_ldapManagerObj.Equals(null));
            Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1), "LDAP LIBRARY INIT SUCCESS");
        }
        public TestRepository(ILdapManager ldapManagerObj, TestUserRepository testUserRepository)
        {
            _testImplementation = new TestImplementation.TestImplementation(testUserRepository, ldapManagerObj);

            TestList = new Dictionary <TestType, TestMethod>
            {
                { TestType.TestAdminConnection, _testImplementation.TestAdminConnect },
                { TestType.TestCreateUser, _testImplementation.TestCreateUser },
                { TestType.TestDeleteUser, _testImplementation.TestDeleteUser },
                { TestType.TestInitLibrary, _testImplementation.TestCompleteInitLibrary },
                { TestType.TestInitLibraryNoAdmin, _testImplementation.TestStardardInitLibraryNoAdmin },
                { TestType.TestModifyUserDescription, _testImplementation.TestModifyUserAttribute },
                { TestType.TestSearchUsers, _testImplementation.TestSearchUser },
                { TestType.TestStandardInitLibraryNoAdmin, _testImplementation.TestStardardInitLibraryNoAdmin },
                { TestType.TestUserChangePassword, _testImplementation.TestChangeUserPassword },
                {
                    TestType.TestConnectUser, () =>
                    {
                        var testMethod = new TestMethod(_testImplementation.TestUserConnectWithoutWritePermissions);
                        if (_writePermission)
                        {
                            testMethod = _testImplementation.TestUserConnect;
                        }
                        return(testMethod());
                    }
                },
                {
                    TestType.TestSearchUserAndConnect, () =>
                    {
                        var testMethod =
                            new TestMethod(_testImplementation.TestSearchUserAndConnectWithoutWritePermissions);
                        if (_writePermission)
                        {
                            testMethod = _testImplementation.TestSearchUserAndConnect;
                        }
                        return(testMethod());
                    }
                },
                { TestType.TestSearchUsersNoFilter, _testImplementation.TestSearchUserNoFilter },
                { TestType.TestSearchAllNodes, _testImplementation.TestSearchAllNodes }
            };
        }
Esempio n. 14
0
        public void testStandardInitLibrary()
        {
            LdapUser adminUser = new LdapUser(ConfigurationManager.AppSettings["LDAPAdminUserDN"],
                                              ConfigurationManager.AppSettings["LDAPAdminUserCN"],
                                              ConfigurationManager.AppSettings["LDAPAdminUserSN"],
                                              null);

            adminUser.CreateUserAttribute("userPassword", ConfigurationManager.AppSettings["LDAPAdminUserPassword"]);


            AuthType authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                     ConfigurationManager.AppSettings["LDAPAuthType"]);

            LdapManagerObj = new LdapManager(adminUser,
                                             ConfigurationManager.AppSettings["LDAPServer"],
                                             ConfigurationManager.AppSettings["LDAPSearchBaseDN"],
                                             authType
                                             );

            Assert.IsFalse(LdapManagerObj.Equals(null));
        }
Esempio n. 15
0
        public bool TestCompleteInitLibrary()
        {
            try
            {
                var adminUser = new LdapUser(Config.LdapLibrary["LDAPAdminUserDN"],
                    Config.LdapLibrary["LDAPAdminUserCN"],
                    Config.LdapLibrary["LDAPAdminUserSN"],
                    null);
                adminUser.CreateUserAttribute("userPassword", Config.LdapLibrary["LDAPAdminUserPassword"]);

                var authType = (AuthType) Enum.Parse(typeof (AuthType),
                    Config.LdapLibrary["LDAPAuthType"]);

                _ldapManagerObj = new LdapManager(adminUser,
                    (LDAPAdminMode) Enum.Parse(typeof (LDAPAdminMode),Config.LdapLibrary["LDAPAdminMode"]),
                    Config.LdapLibrary["LDAPServer"],
                    Config.LdapLibrary["LDAPSearchBaseDN"],
                    authType,
                    Convert.ToBoolean(Config.LdapLibrary["secureSocketLayerFlag"]),
                    Convert.ToBoolean(Config.LdapLibrary["transportSocketLayerFlag"]),
                    Convert.ToBoolean(Config.LdapLibrary["ClientCertificationFlag"]),
                    Config.LdapLibrary["clientCertificatePath"],
                    (LoggerType) Enum.Parse(typeof (LoggerType), Config.LdapLibrary["enableLDAPLibraryLog"]),
                    Config.LdapLibrary["LDAPLibraryLogPath"],
                    Config.LdapLibrary["LDAPUserObjectClass"],
                    Config.LdapLibrary["LDAPMatchFieldUsername"]
                    );

                if (!_ldapManagerObj.Equals(null))
                    return true;
                return false;
            }
            catch (Exception)
            {
                return false;
            }
        }
Esempio n. 16
0
 public void TestStandardInitLibraryEventViewerLogNoPath()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode, LdapServer, LdapSearchBaseDn, LdapAuthType,
                                       LoggerType.EventViewer, null);
     Assert.IsFalse(_ldapManagerObj.Equals(null));
 }
Esempio n. 17
0
        public void testStandardInitLibrary()
        {

            LdapUser adminUser = new LdapUser(ConfigurationManager.AppSettings["LDAPAdminUserDN"],
                                                 ConfigurationManager.AppSettings["LDAPAdminUserCN"],
                                                 ConfigurationManager.AppSettings["LDAPAdminUserSN"],
                                                 null);
            adminUser.CreateUserAttribute("userPassword", ConfigurationManager.AppSettings["LDAPAdminUserPassword"]);


            AuthType authType = (AuthType)Enum.Parse(typeof(AuthType),
                                                        ConfigurationManager.AppSettings["LDAPAuthType"]);

            LdapManagerObj = new LdapManager(adminUser,
                                                ConfigurationManager.AppSettings["LDAPServer"],
                                                ConfigurationManager.AppSettings["LDAPSearchBaseDN"],
                                                authType
                                                );

            Assert.IsFalse(LdapManagerObj.Equals(null));
        }
Esempio n. 18
0
 public LdapManager_Tests()
 {
     _ldapManager = GetRequiredService <ILdapManager>();
 }
Esempio n. 19
0
 public TestImplementation(TestUserRepository userRepository, ILdapManager ldapManagerObj)
 {
     _userRepository = userRepository;
     _ldapManagerObj = ldapManagerObj;
 }
Esempio n. 20
0
        public TestRunner(ILdapManager lm)
        {
            UserRepository = new TestUserRepository();

            _testRepo = new TestRepository(lm, UserRepository);
        }
 public void TestStandardInitLibraryNologPath_File()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode, LdapServer, LdapSearchBaseDn, LdapAuthType,
         EnableLdapLibraryLog, null);
     Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1), "LDAP LIBRARY INIT ERROR: ");
 }
 public void TestStandardInitLibraryNologPath_None()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode, LdapServer, LdapSearchBaseDn, LdapAuthType,
         LoggerType.None, null);
 }
 public void TestCompleteInitLibraryNoAdmin_SearchBaseDN_Null()
 {
     _ldapManagerObj = new LdapManager(null, LDAPAdminMode.NoAdmin,
         LdapServer,
         "",
         LdapAuthType,
         SecureSocketLayerFlag,
         TransportSocketLayerFlag,
         ClientCertificationFlag,
         ClientCertificatePath,
         EnableLdapLibraryLog,
         LdapLibraryLogPath,
         LdapUserObjectClass,
         LdapMatchFieldUsername
         );
 }
 public void TestStandardInitLibraryEventViewerLogNoPath()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode, LdapServer, LdapSearchBaseDn, LdapAuthType,
         LoggerType.EventViewer, null);
     Assert.IsFalse(_ldapManagerObj.Equals(null));
 }
 public void TestCompleteInitLibraryNoUserClass()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode,
         LdapServer,
         LdapSearchBaseDn,
         LdapAuthType,
         SecureSocketLayerFlag,
         TransportSocketLayerFlag,
         ClientCertificationFlag,
         ClientCertificatePath,
         EnableLdapLibraryLog,
         LdapLibraryLogPath,
         "",
         LdapMatchFieldUsername
         );
     Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1), "LDAP LIBRARY INIT ERROR: ");
 }
 public void TestCompleteInitLibraryNoLogPath_None()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode,
         LdapServer,
         LdapSearchBaseDn,
         LdapAuthType,
         SecureSocketLayerFlag,
         TransportSocketLayerFlag,
         ClientCertificationFlag,
         ClientCertificatePath,
         LoggerType.None,
         "",
         LdapUserObjectClass,
         LdapMatchFieldUsername
         );
 }
Esempio n. 27
0
        public bool TestStardardInitLibraryNoAdmin()
        {
            try
            {
                var authType = (AuthType) Enum.Parse(typeof (AuthType),
                    Config.LdapLibrary["LDAPAuthType"]);

                _ldapManagerObj = new LdapManager(null,
                    (LDAPAdminMode)Enum.Parse(typeof(LDAPAdminMode), Config.LdapLibrary["LDAPAdminMode"]),
                    Config.LdapLibrary["LDAPServer"],
                    Config.LdapLibrary["LDAPSearchBaseDN"],
                    authType, (LoggerType) Enum.Parse(typeof (LoggerType), Config.LdapLibrary["enableLDAPLibraryLog"]),
                    Config.LdapLibrary["LDAPLibraryLogPath"]
                    );

                if (!_ldapManagerObj.Equals(null))
                    return true;
                return false;
            }
            catch (Exception)
            {
                return false;
            }
        }
Esempio n. 28
0
 public TestImplementation(TestUserRepository userRepository, ILdapManager ldapManagerObj)
 {
     _userRepository = userRepository;
     _ldapManagerObj = ldapManagerObj;
 }
        public void TestStandardInitLibrary()
        {
            _ldapManagerObj = new LdapManager(null, AdminMode,
                LdapServer,
                LdapSearchBaseDn,
                LdapAuthType, EnableLdapLibraryLog, LdapLibraryLogPath
                );

            Assert.IsFalse(_ldapManagerObj.Equals(null));
        }
Esempio n. 30
0
 public Authenticate_Tests()
 {
     // ReSharper disable once VirtualMemberCallInConstructor
     _testData    = GetRequiredService <LdapTestData>();
     _ldapManager = GetRequiredService <ILdapManager>();
 }
Esempio n. 31
0
 public void TestStandardInitLibraryNologPath_File()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode, LdapServer, LdapSearchBaseDn, LdapAuthType,
                                       EnableLdapLibraryLog, null);
     Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1), "LDAP LIBRARY INIT ERROR: ");
 }
Esempio n. 32
0
        public TestRunner(ILdapManager lm)
        {
            UserRepository = new TestUserRepository();

            _testRepo = new TestRepository(lm, UserRepository);
        }
Esempio n. 33
0
 public void TestStandardInitLibraryNologPath_None()
 {
     _ldapManagerObj = new LdapManager(AdminUser, AdminMode, LdapServer, LdapSearchBaseDn, LdapAuthType,
                                       LoggerType.None, null);
 }