コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLogPassword() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotLogPassword()
        {
            _database = _databaseBuilder.setConfig(log_queries, Settings.TRUE).setConfig(logs_directory, _logsDirectory.Path).setConfig(GraphDatabaseSettings.auth_enabled, Settings.TRUE).newGraphDatabase();
            GraphDatabaseFacade facade = ( GraphDatabaseFacade )this._database;

            EnterpriseAuthManager  authManager = facade.DependencyResolver.resolveDependency(typeof(EnterpriseAuthManager));
            EnterpriseLoginContext neo         = authManager.Login(AuthToken.newBasicAuthToken("neo4j", "neo4j"));

            string query = "CALL dbms.security.changePassword('abc123')";

            try
            {
                using (InternalTransaction tx = facade.BeginTransaction(KernelTransaction.Type.@explicit, neo))
                {
                    Result res = facade.Execute(tx, query, VirtualValues.EMPTY_MAP);
                    res.Close();
                    tx.Success();
                }
            }
            finally
            {
                facade.Shutdown();
            }

            IList <string> logLines = ReadAllLines(_logFilename);

            assertEquals(1, logLines.Count);
            assertThat(logLines[0], containsString("CALL dbms.security.changePassword(******)"));
            assertThat(logLines[0], not(containsString("abc123")));
            assertThat(logLines[0], containsString(neo.Subject().username()));
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: AbstractRESTInteraction(java.util.Map<String,String> config) throws java.io.IOException
        internal AbstractRESTInteraction(IDictionary <string, string> config)
        {
            CommunityServerBuilder builder = EnterpriseServerBuilder.serverOnRandomPorts();

            builder = builder.WithProperty((new BoltConnector("bolt")).type.name(), "BOLT").withProperty((new BoltConnector("bolt")).enabled.name(), "true").withProperty((new BoltConnector("bolt")).encryption_level.name(), OPTIONAL.name()).withProperty(LegacySslPolicyConfig.tls_key_file.name(), NeoInteractionLevel.tempPath("key", ".key")).withProperty(LegacySslPolicyConfig.tls_certificate_file.name(), NeoInteractionLevel.tempPath("cert", ".cert")).withProperty(GraphDatabaseSettings.auth_enabled.name(), Convert.ToString(true));

            foreach (KeyValuePair <string, string> entry in config.SetOfKeyValuePairs())
            {
                builder = builder.WithProperty(entry.Key, entry.Value);
            }
            this.Server = builder.Build();
            this.Server.start();
            _authManager           = this.Server.DependencyResolver.resolveDependency(typeof(EnterpriseAuthManager));
            _connectorPortRegister = Server.DependencyResolver.resolveDependency(typeof(ConnectorPortRegister));
        }