Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEquals()
        public virtual void TestEquals()
        {
            LegacyCredential credential     = LegacyCredential.forPassword("foo");
            LegacyCredential sameCredential = new LegacyCredential(credential.Salt(), credential.PasswordHash());

            assertEquals(credential, sameCredential);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMatchesPassword()
        public virtual void TestMatchesPassword()
        {
            LegacyCredential credential = LegacyCredential.forPassword("foo");

            assertTrue(credential.MatchesPassword("foo"));
            assertFalse(credential.MatchesPassword("fooo"));
            assertFalse(credential.MatchesPassword("fo"));
            assertFalse(credential.MatchesPassword("bar"));
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException, org.neo4j.kernel.api.exceptions.InvalidArgumentsException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            OutsideWorld mock = mock(typeof(OutsideWorld));

            when(mock.FileSystem()).thenReturn(_fileSystem);
            _setDefaultAdmin = new SetDefaultAdminCommand(TestDir.directory("home").toPath(), TestDir.directory("conf").toPath(), mock);
            _config          = _setDefaultAdmin.loadNeo4jConfig();
            UserRepository users = CommunitySecurityModule.getUserRepository(_config, NullLogProvider.Instance, _fileSystem);

            users.create(new User.Builder("jake", LegacyCredential.forPassword("123"))
                         .withRequiredPasswordChange(false).build());
            _adminIniFile = new File(CommunitySecurityModule.getUserRepositoryFile(_config).ParentFile, "admin.ini");
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testInaccessibleCredentials()
        public virtual void TestInaccessibleCredentials()
        {
            LegacyCredential credential = new LegacyCredential(INACCESSIBLE.salt(), INACCESSIBLE.passwordHash());

            //equals
            assertEquals(INACCESSIBLE, credential);
            assertEquals(credential, INACCESSIBLE);
            assertEquals(INACCESSIBLE, INACCESSIBLE);
            assertNotEquals(INACCESSIBLE, LegacyCredential.forPassword(""));
            assertNotEquals(LegacyCredential.forPassword(""), INACCESSIBLE);

            //matchesPassword
            assertFalse(INACCESSIBLE.matchesPassword(StringHelper.NewString(new sbyte[] {})));
            assertFalse(INACCESSIBLE.matchesPassword("foo"));
            assertFalse(INACCESSIBLE.matchesPassword(""));
        }