Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _manager = new BasicAuthManager(new InMemoryUserRepository(), new BasicPasswordPolicy(), Clocks.systemClock(), new InMemoryUserRepository(), Config.defaults());
            _manager.init();
            _manager.start();
            _manager.newUser("johan", password("bar"), false);
            _context = _manager.login(authToken("johan", "bar")).authorize(s => - 1, GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldClearPasswordOnLogin() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldClearPasswordOnLogin()
        {
            // Given
            when(_authStrategy.authenticate(any(), any())).thenReturn(AuthenticationResult.SUCCESS);

            _manager.start();
            _manager.newUser("jake", Password("abc123"), true);
            sbyte[] password = password("abc123");
            IDictionary <string, object> authToken = AuthToken.newBasicAuthToken("jake", password);

            // When
            _manager.login(authToken);

            // Then
            assertThat(password, equalTo(ClearedPasswordWithSameLenghtAs("abc123")));
            assertThat(authToken[Org.Neo4j.Kernel.api.security.AuthToken_Fields.CREDENTIALS], equalTo(ClearedPasswordWithSameLenghtAs("abc123")));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.internal.kernel.api.security.LoginContext login(String username, String password) throws org.neo4j.kernel.api.security.exception.InvalidAuthTokenException
        private LoginContext Login(string username, string password)
        {
            return(_authManager.login(newBasicAuthToken(username, password)));
        }