[
https://issues.apache.org/jira/browse/GEODE-4293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324962#comment-16324962
]
ASF GitHub Bot commented on GEODE-4293:
---------------------------------------
jdeppe-pivotal closed pull request #1279: GEODE-4293: Pulse works correctly
when jmx-manager-password-file is set
URL: https://github.com/apache/geode/pull/1279
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 0000000000..38544ea2f7
--- /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 ab5b9f71a6..13d3490a83 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 @@ private void startHttpService(boolean isServer) {
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 synchronized void start() throws IOException {
// 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 synchronized void start() throws IOException {
controller.setMBeanServer(mbs);
}
}
+ registerAccessControlMBean();
registerFileUploaderMBean();
jmxConnectorServer.start();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> When jmx-manager-password-file is used Pulse may not work
> ---------------------------------------------------------
>
> Key: GEODE-4293
> URL: https://issues.apache.org/jira/browse/GEODE-4293
> Project: Geode
> Issue Type: Bug
> Components: pulse
> Reporter: Jens Deppe
> Assignee: Jens Deppe
> Labels: pull-request-available
>
> When {{jmx-manager-password-file}} is used to enable security for JMX
> connections (using the old security model) embedded Pulse connections do not
> work.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)