geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [geode] branch release/1.4.0 updated: GEODE-4293: Pulse works correctly when jmx-manager-password-file is set (#1279)
Date Tue, 16 Jan 2018 15:33:00 GMT
This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch release/1.4.0
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/release/1.4.0 by this push:
     new c8f267a  GEODE-4293: Pulse works correctly when jmx-manager-password-file is set
(#1279)
c8f267a is described below

commit c8f267a3b73427ea3a661f8ae960a1d2f2451f1f
Author: Jens Deppe <jdeppe@pivotal.io>
AuthorDate: Fri Jan 12 20:41:37 2018 -0800

    GEODE-4293: Pulse works correctly when jmx-manager-password-file is set (#1279)
    
    (cherry picked from commit 9eb82df1b861033bd9939f205d4f4333e04f0314)
---
 .../tools/pulse/PulseJmxPasswordFileTest.java      | 62 ++++++++++++++++++++++
 .../geode/management/internal/ManagementAgent.java |  9 ++--
 2 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseJmxPasswordFileTest.java
b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseJmxPasswordFileTest.java
new file mode 100644
index 0000000..38544ea
--- /dev/null
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseJmxPasswordFileTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information
regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version
2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain
a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
+ * or implied. See the License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+package org.apache.geode.tools.pulse;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.util.Collections;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.http.HttpResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.rules.HttpClientRule;
+import org.apache.geode.test.junit.rules.LocatorStarterRule;
+
+
+@Category(IntegrationTest.class)
+public class PulseJmxPasswordFileTest {
+  @Rule
+  public LocatorStarterRule locator = new LocatorStarterRule();
+
+  @Rule
+  public HttpClientRule client = new HttpClientRule(locator::getHttpPort);
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Before
+  public void setUp() throws Exception {
+    File passwordFile = temporaryFolder.newFile("password.properties");
+    FileUtils.writeLines(passwordFile, Collections.singleton("user user"));
+    locator.withProperty("jmx-manager-password-file", passwordFile.getAbsolutePath());
+    locator.startLocator();
+  }
+
+  @Test
+  public void testLogin() throws Exception {
+    client.loginToPulseAndVerify("user", "user");
+
+    HttpResponse response = client.post("/pulse/pulseUpdate");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index 668b0b6..bbd5be3 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -213,8 +213,11 @@ public class ManagementAgent {
         if (logger.isDebugEnabled()) {
           logger.debug(message);
         }
-      } else if (securityService.isIntegratedSecurity()) {
-        System.setProperty("spring.profiles.active", "pulse.authentication.gemfire");
+      } else {
+        String pwFile = this.config.getJmxManagerPasswordFile();
+        if (securityService.isIntegratedSecurity() || StringUtils.isNotBlank(pwFile)) {
+          System.setProperty("spring.profiles.active", "pulse.authentication.gemfire");
+        }
       }
 
       // Find developer REST WAR file
@@ -477,7 +480,6 @@ public class ManagementAgent {
       // should take care of that
       MBeanServerWrapper mBeanServerWrapper = new MBeanServerWrapper(this.securityService);
       jmxConnectorServer.setMBeanServerForwarder(mBeanServerWrapper);
-      registerAccessControlMBean();
     } else {
       /* Disable the old authenticator mechanism */
       String pwFile = this.config.getJmxManagerPasswordFile();
@@ -492,6 +494,7 @@ public class ManagementAgent {
         controller.setMBeanServer(mbs);
       }
     }
+    registerAccessControlMBean();
     registerFileUploaderMBean();
 
     jmxConnectorServer.start();

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message