Esempio n. 1
0
        public void DoAuthenticationWithDbTest()
        {
            LdapAuthenticator ldapAuth = new LdapAuthenticator();
            UserVO            expected = ldapAuth.CreateSession("testes.nddigital.local", "matheus.silva", "ndd@123");

            Assert.AreEqual(expected.Logon, "matheus.silva");
        }
Esempio n. 2
0
        public void DoAuthenticationTestWrongDomain()
        {
            LdapAuthenticator ldapAuth = new LdapAuthenticator();
            bool expected = ldapAuth.DoAuthentication("nddigital", "matheus.silva", "ndd@123");

            Assert.AreEqual(expected, false);
        }
Esempio n. 3
0
        public void DoAuthenticationTesWrongPass()
        {
            LdapAuthenticator ldapAuth = new LdapAuthenticator();
            bool expected = ldapAuth.DoAuthentication("testes", "matheus.silva", "ndd");

            Assert.AreEqual(expected, false);
        }
Esempio n. 4
0
        public void DoAuthenticationTestSimpleDomain()
        {
            LdapAuthenticator ldapAuth = new LdapAuthenticator();
            bool expected = ldapAuth.DoAuthentication("testes", "matheus.silva", "ndd@123");

            Assert.AreEqual(expected, true);
        }
Esempio n. 5
0
        public void DoAuthenticationTest()
        {
            LdapAuthenticator ldapAuth = new LdapAuthenticator();
            bool expected = ldapAuth.DoAuthentication("testes.nddigital.local", "matheus.silva", "ndd@123");

            Assert.AreEqual(expected, true);
        }
Esempio n. 6
0
        private static IAuthenticator InitAuthenticator(Settings settings)
        {
            var authenticator = InitLdap(settings, delegate(LdapCredentials creds)
            {
#if DEBUG
                var auth = new DummyAuthenticator();
#else
                var auth = new LdapAuthenticator(creds);
                auth.Connect();
#endif

                return(auth);
            });
            var authenticatorCache = new AuthenticatorCache(authenticator, (int)settings.SECURITY_CACHE_EXPIRATION);

            MasterContainer.AddService <IAuthenticator>(authenticatorCache);
            ProgramOutput.Info("Authenticator initialized, LDAP connection to {0} up.", authenticator.ConnectedServer);

            return(authenticatorCache);
        }