summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2013-04-26 16:53:46 +0000
committerAlex Rudyy <orudyy@apache.org>2013-04-26 16:53:46 +0000
commit327d76b59565ece44018864787dfad695fcda50a (patch)
tree7ac922f114ef28a4418f97c73e72dbf241d719c9
parent64ab8be9c34528ef71ca5c58ff075ed57a48c9e0 (diff)
downloadqpid-python-327d76b59565ece44018864787dfad695fcda50a.tar.gz
QPID-4777: Add UI to view and edit web management configuration
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1476288 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js96
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js7
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js170
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js84
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html48
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html28
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html33
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java2
-rw-r--r--qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java5
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java26
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java59
-rw-r--r--qpid/java/build.xml2
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java5
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java69
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java60
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java3
22 files changed, 673 insertions, 59 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
index 2fc54482a4..60ec7717cb 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
@@ -138,15 +138,11 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
put(PluginFactory.PLUGIN_TYPE, String.class);
}});
- private final Broker _broker;
-
private Server _server;
public HttpManagement(UUID id, Broker broker, Map<String, Object> attributes)
{
- super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker.getTaskExecutor());
- _broker = broker;
- addParent(Broker.class, broker);
+ super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker);
}
@Override
@@ -169,7 +165,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
{
CurrentActor.get().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME));
- Collection<Port> httpPorts = getHttpPorts(_broker.getPorts());
+ Collection<Port> httpPorts = getHttpPorts(getBroker().getPorts());
_server = createServer(httpPorts);
try
{
@@ -195,7 +191,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
}
catch (Exception e)
{
- throw new RuntimeException("Failed to stop http management on port " + getHttpPorts(_broker.getPorts()));
+ throw new RuntimeException("Failed to stop http management on port " + getHttpPorts(getBroker().getPorts()));
}
}
@@ -203,12 +199,6 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
}
/** Added for testing purposes */
- Broker getBroker()
- {
- return _broker;
- }
-
- /** Added for testing purposes */
int getSessionTimeout()
{
return (Integer)getAttribute(TIME_OUT);
@@ -272,7 +262,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
server.setHandler(root);
// set servlet context attributes for broker and configuration
- root.getServletContext().setAttribute(HttpManagementUtil.ATTR_BROKER, _broker);
+ root.getServletContext().setAttribute(HttpManagementUtil.ATTR_BROKER, getBroker());
root.getServletContext().setAttribute(HttpManagementUtil.ATTR_MANAGEMENT_CONFIGURATION, this);
FilterHolder restAuthorizationFilter = new FilterHolder(new ForbiddingAuthorisationFilter());
@@ -297,6 +287,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
addRestServlet(root, "session", VirtualHost.class, Connection.class, Session.class);
addRestServlet(root, "keystore", KeyStore.class);
addRestServlet(root, "truststore", TrustStore.class);
+ addRestServlet(root, "plugin", Plugin.class);
root.addServlet(new ServletHolder(new StructureServlet()), "/rest/structure");
root.addServlet(new ServletHolder(new MessageServlet()), "/rest/message/*");
@@ -438,7 +429,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
@Override
public SubjectCreator getSubjectCreator(SocketAddress localAddress)
{
- return _broker.getSubjectCreator(localAddress);
+ return getBroker().getSubjectCreator(localAddress);
}
}
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js
new file mode 100644
index 0000000000..b398683110
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js
@@ -0,0 +1,96 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/parser",
+ "dojo/query",
+ "dojo/_base/connect",
+ "qpid/common/properties",
+ "qpid/common/updater",
+ "qpid/common/util",
+ "dijit/registry",
+ "dojo/_base/event",
+ "dojo/domReady!"],
+ function (xhr, parser, query, connect, properties, updater, util, registry, event) {
+
+ function Plugin(name, parent, controller) {
+ this.name = name;
+ this.controller = controller;
+ this.modelObj = { type: "plugin", name: name };
+ if(parent) {
+ this.modelObj.parent = {};
+ this.modelObj.parent[ parent.type] = parent;
+ }
+ }
+
+ Plugin.prototype.getTitle = function() {
+ return "Plugin: " + this.name ;
+ };
+
+ Plugin.prototype.open = function(contentPane) {
+ var that = this;
+ this.contentPane = contentPane;
+ xhr.get({url: "showPlugin.html",
+ sync: true,
+ load: function(data) {
+ contentPane.containerNode.innerHTML = data;
+ parser.parse(contentPane.containerNode);
+
+ that.pluginUpdater = new PluginUpdater(contentPane.containerNode, that.modelObj, that.controller);
+ }});
+ };
+
+ Plugin.prototype.close = function() {
+ updater.remove( this.pluginUpdater );
+ };
+
+ function PluginUpdater(node, pluginObject, controller)
+ {
+ this.controller = controller;
+ this.name = query(".name", node)[0];
+ this.type = query(".type", node)[0];
+ this.query = "rest/plugin/"+encodeURIComponent(pluginObject.name);
+
+ var that = this;
+
+ xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+ .then(function(data)
+ {
+ that.pluginData = data[0];
+
+ that.updateHeader();
+
+ require(["qpid/management/plugin/"+ that.pluginData.pluginType.toLowerCase().replace('-','')],
+ function(SpecificPlugin) {
+ that.details = new SpecificPlugin(query(".pluginDetails", node)[0], pluginObject, controller);
+ });
+
+ });
+
+ }
+
+ PluginUpdater.prototype.updateHeader = function()
+ {
+ this.name.innerHTML = this.pluginData[ "name" ];
+ this.type.innerHTML = this.pluginData[ "pluginType" ];
+ };
+
+ return Plugin;
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
index cd18a0c4b6..28e4445e08 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
@@ -33,16 +33,19 @@ define(["dojo/dom",
"qpid/management/TrustStore",
"qpid/management/AccessControlProvider",
"qpid/management/Port",
+ "qpid/management/Plugin",
"dojo/ready",
"dojo/domReady!"],
- function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, ready) {
+ function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider,
+ GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, ready) {
var controller = {};
var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange,
queue: Queue, connection: Connection,
authenticationprovider: AuthProvider, groupprovider: GroupProvider,
group: Group, keystore: KeyStore, truststore: TrustStore,
- accesscontrolprovider: AccessControlProvider, port: Port};
+ accesscontrolprovider: AccessControlProvider, port: Port,
+ plugin: Plugin};
var tabDiv = dom.byId("managedViews");
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js
new file mode 100644
index 0000000000..9baf6a2b15
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js
@@ -0,0 +1,170 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/parser",
+ "dojo/query",
+ "dojo/dom-construct",
+ "dojo/_base/connect",
+ "dojo/_base/window",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dijit/registry",
+ "qpid/common/util",
+ "qpid/common/properties",
+ "qpid/common/updater",
+ "dijit/form/Button",
+ "dijit/form/ValidationTextBox",
+ "dijit/form/CheckBox",
+ "dijit/form/NumberSpinner",
+ "dojo/domReady!"],
+ function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, updater) {
+
+ function ManagementHttp(containerNode, pluginObject, controller) {
+ var node = construct.create("div", null, containerNode, "last");
+ var that = this;
+ this.name = pluginObject.name;
+ xhr.get({
+ url: "plugin/showManagementHttp.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ that.managementHttpUpdater= new ManagementHttpUpdater(node, pluginObject, controller);
+ that.managementHttpUpdater.update(true);
+ updater.add( that.managementHttpUpdater);
+
+ var editButton = query(".editPluginButton", node)[0];
+ connect.connect(registry.byNode(editButton), "onClick", function(evt){ that.edit(); });
+ }});
+ }
+
+ ManagementHttp.prototype.close = function() {
+ updater.remove( this.managementHttpUpdater );
+ };
+
+ ManagementHttp.prototype.edit = function() {
+ var widgetFactories = [{
+ name: "name",
+ createWidget: function(plugin) {
+ return new dijit.form.ValidationTextBox({
+ required: true,
+ value: plugin.name,
+ disabled: true,
+ label: "Name:",
+ regexp: "^[\x20-\x2e\x30-\x7F]{1,255}$",
+ name: "name"});
+ }
+ }, {
+ name: "httpBasicAuthenticationEnabled",
+ createWidget: function(plugin) {
+ return new dijit.form.CheckBox({
+ required: false,
+ checked: plugin.httpBasicAuthenticationEnabled,
+ label: "HTTP Basic Authentication Enabled:",
+ name: "httpBasicAuthenticationEnabled"});
+ }
+ }, {
+ name: "httpsBasicAuthenticationEnabled",
+ createWidget: function(plugin) {
+ return new dijit.form.CheckBox({
+ required: false,
+ checked: plugin.httpsBasicAuthenticationEnabled,
+ label: "HTTPS Basic Authentication Enabled:",
+ name: "httpsBasicAuthenticationEnabled"});
+ }
+ }, {
+ name: "httpSaslAuthenticationEnabled",
+ createWidget: function(plugin) {
+ return new dijit.form.CheckBox({
+ required: false,
+ checked: plugin.httpSaslAuthenticationEnabled,
+ label: "HTTP SASL Authentication Enabled:",
+ name: "httpSaslAuthenticationEnabled"});
+ }
+ }, {
+ name: "httpsSaslAuthenticationEnabled",
+ createWidget: function(plugin) {
+ return new dijit.form.CheckBox({
+ required: false,
+ checked: plugin.httpsSaslAuthenticationEnabled,
+ label: "HTTPS SASL Authentication Enabled:",
+ name: "httpsSaslAuthenticationEnabled"});
+ }
+ }, {
+ name: "sessionTimeout",
+ createWidget: function(plugin) {
+ return new dijit.form.NumberSpinner({
+ invalidMessage: "Invalid value",
+ required: false,
+ value: plugin.sessionTimeout,
+ smallDelta: 1,
+ constraints: {min:1,places:0, pattern: "#####"},
+ label: "Session timeout (s):",
+ name: "sessionTimeout"
+ });
+ }
+ }
+ ];
+ var data = this.managementHttpUpdater.pluginData;
+ util.showSetAttributesDialog(
+ widgetFactories,
+ data,
+ "rest/plugin/" + encodeURIComponent(data.name),
+ "Edit plugin - " + data.name);
+ };
+
+ function ManagementHttpUpdater(node, pluginObject, controller)
+ {
+ this.controller = controller;
+ this.query = "rest/plugin/"+encodeURIComponent(pluginObject.name);
+ this.name = pluginObject.name;
+ this.httpBasicAuthenticationEnabled = query(".httpBasicAuthenticationEnabled", node)[0];
+ this.httpsBasicAuthenticationEnabled = query(".httpsBasicAuthenticationEnabled", node)[0];
+ this.sessionTimeout = query(".sessionTimeout", node)[0];
+ this.httpsSaslAuthenticationEnabled = query(".httpsSaslAuthenticationEnabled", node)[0];
+ this.httpSaslAuthenticationEnabled = query(".httpSaslAuthenticationEnabled", node)[0];
+ }
+
+ ManagementHttpUpdater.prototype.update = function(syncRequest)
+ {
+ var that = this;
+
+ function showBoolean(val)
+ {
+ return "<input type='checkbox' disabled='disabled' "+(val ? "checked='checked'": "")+" />" ;
+ }
+
+ xhr.get({url: this.query, sync: syncRequest ? syncRequest : properties.useSyncGet, handleAs: "json"})
+ .then(function(data) {
+ that.pluginData = data[0];
+ that.httpBasicAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpBasicAuthenticationEnabled);
+ that.httpsBasicAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpsBasicAuthenticationEnabled);
+ that.httpsSaslAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpsSaslAuthenticationEnabled);
+ that.httpSaslAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpSaslAuthenticationEnabled);
+ that.sessionTimeout.innerHTML = that.pluginData.sessionTimeout;
+ });
+
+ };
+
+ return ManagementHttp;
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js
new file mode 100644
index 0000000000..64750ae403
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/parser",
+ "dojo/query",
+ "dojo/dom-construct",
+ "dojo/_base/connect",
+ "dojo/_base/window",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dijit/registry",
+ "qpid/common/util",
+ "qpid/common/properties",
+ "qpid/common/updater",
+ "dojo/domReady!"],
+ function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, updater) {
+
+ function ManagementJmx(containerNode, pluginObject, controller) {
+ var node = construct.create("div", null, containerNode, "last");
+ var that = this;
+ this.name = pluginObject.name;
+ xhr.get({
+ url: "plugin/showManagementJmx.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ that.managementJmxUpdater= new ManagementJmxUpdater(node, pluginObject, controller);
+ that.managementJmxUpdater.update(true);
+ updater.add( that.managementJmxUpdater);
+ }});
+ }
+
+ ManagementJmx.prototype.close = function() {
+ updater.remove( this.managementJmxUpdater );
+ };
+
+ function ManagementJmxUpdater(node, pluginObject, controller)
+ {
+ this.controller = controller;
+ this.query = "rest/plugin/"+encodeURIComponent(pluginObject.name);
+ this.name = pluginObject.name;
+ this.usePlatformMBeanServer = query(".usePlatformMBeanServer", node)[0];
+ }
+
+ ManagementJmxUpdater.prototype.update = function(syncRequest)
+ {
+ var that = this;
+
+ function showBoolean(val)
+ {
+ return "<input type='checkbox' disabled='disabled' "+(val ? "checked='checked'": "")+" />" ;
+ }
+
+ xhr.get({url: this.query, sync: syncRequest ? syncRequest : properties.useSyncGet, handleAs: "json"})
+ .then(function(data) {
+ that.pluginData = data[0];
+ that.usePlatformMBeanServer.innerHTML = showBoolean(that.pluginData.usePlatformMBeanServer);
+ });
+
+ };
+
+ return ManagementJmx;
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
index 05df5e24b7..8dc336b347 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
@@ -282,6 +282,8 @@ define(["dojo/_base/xhr",
controller.show("truststore", details.truststore, {broker: {type:"broker", name:""}});
} else if (details.type == 'accesscontrolprovider') {
controller.show("accesscontrolprovider", details.accesscontrolprovider, {broker: {type:"broker", name:""}});
+ } else if (details.type == 'plugin') {
+ controller.show("plugin", details.plugin, {broker: {type:"broker", name:""}});
}
};
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html
new file mode 100644
index 0000000000..ea4bfc93f8
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html
@@ -0,0 +1,48 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div>
+ <div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">Basic Authentication for HTTP enabled:</div>
+ <div class="httpBasicAuthenticationEnabled" style="float:left;"></div><br/>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">Basic Authentication for HTTPS enabled:</div>
+ <div class="httpsBasicAuthenticationEnabled" style="float:left;"></div><br/>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">SASL Authentication for HTTP enabled:</div>
+ <div class="httpSaslAuthenticationEnabled" style="float:left;"></div><br/>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">SASL Authentication for HTTPS enabled:</div>
+ <div class="httpsSaslAuthenticationEnabled" style="float:left;"></div><br/>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">Session timeout (s):</div>
+ <div class="sessionTimeout" style="float:left;"></div><br/>
+ </div>
+ </div>
+ <br/>
+ <div class="dijitDialogPaneActionBar">
+ <button data-dojo-type="dijit.form.Button" class="editPluginButton" type="button">Edit</button>
+ </div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html
new file mode 100644
index 0000000000..3abf578fbd
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html
@@ -0,0 +1,28 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div>
+ <div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">Use Platform MBean Server:</div>
+ <div class="usePlatformMBeanServer" style="float:left;"></div><br/>
+ </div>
+ </div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html
new file mode 100644
index 0000000000..f2f3134037
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html
@@ -0,0 +1,33 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div class="plugin">
+ <div>
+ <div style="both:clear">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">Name:</div>
+ <div class="name" style="float:left;"></div><br/>
+ </div>
+ <div style="both:clear">
+ <div class="formLabel-labelCell" style="float:left; width: 260px;">Type:</div>
+ <div class="type" style="float:left;"></div><br/>
+ </div>
+ </div>
+ <div class="pluginDetails"></div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java
index bb4c46826c..10bc9f941b 100644
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java
+++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java
@@ -54,7 +54,7 @@ public class HttpManagementFactoryTest extends QpidTestCase
HttpManagement management = (HttpManagement) _pluginFactory.createInstance(_id, _attributes, _broker);
- assertEquals(_broker, management.getBroker());
+ assertEquals(_broker, management.getParent(Broker.class));
assertEquals(SESSION_TIMEOUT, management.getSessionTimeout());
}
diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
index 55606af117..18d774e341 100644
--- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
+++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
@@ -55,11 +55,6 @@ public class HttpManagementTest extends QpidTestCase
_management = new HttpManagement(_id, _broker, attributes);
}
- public void testGetBroker()
- {
- assertEquals("Unexpected broker", _broker, _management.getBroker());
- }
-
public void testGetSessionTimeout()
{
assertEquals("Unexpected session timeout", 10000l, _management.getSessionTimeout());
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
index 3342aea4fb..cebfb8d9d9 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
@@ -89,16 +89,13 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
put(PluginFactory.PLUGIN_TYPE, String.class);
}};
- private final Broker _broker;
private JMXManagedObjectRegistry _objectRegistry;
private final Map<ConfiguredObject, AMQManagedObject> _children = new HashMap<ConfiguredObject, AMQManagedObject>();
public JMXManagement(UUID id, Broker broker, Map<String, Object> attributes)
{
- super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker.getTaskExecutor());
- _broker = broker;
- addParent(Broker.class, broker);
+ super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker);
}
@Override
@@ -130,9 +127,10 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
private void start() throws JMException, IOException
{
+ Broker broker = getBroker();
Port connectorPort = null;
Port registryPort = null;
- Collection<Port> ports = _broker.getPorts();
+ Collection<Port> ports = broker.getPorts();
for (Port port : ports)
{
if (State.QUIESCED.equals(port.getActualState()))
@@ -158,13 +156,13 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
throw new IllegalStateException("No JMX RMI port found supporting protocol " + Protocol.RMI);
}
- _objectRegistry = new JMXManagedObjectRegistry(_broker, connectorPort, registryPort, this);
+ _objectRegistry = new JMXManagedObjectRegistry(broker, connectorPort, registryPort, this);
- _broker.addChangeListener(this);
+ broker.addChangeListener(this);
synchronized (_children)
{
- for(VirtualHost virtualHost : _broker.getVirtualHosts())
+ for(VirtualHost virtualHost : broker.getVirtualHosts())
{
if(!_children.containsKey(virtualHost))
{
@@ -181,7 +179,7 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
createAdditionalMBeansFromProviders(virtualHost, mbean);
}
}
- Collection<AuthenticationProvider> authenticationProviders = _broker.getAuthenticationProviders();
+ Collection<AuthenticationProvider> authenticationProviders = broker.getAuthenticationProviders();
for (AuthenticationProvider authenticationProvider : authenticationProviders)
{
if(authenticationProvider instanceof PasswordCredentialManagingAuthenticationProvider)
@@ -194,7 +192,7 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
}
}
new Shutdown(_objectRegistry);
- new ServerInformationMBean(_objectRegistry, _broker);
+ new ServerInformationMBean(_objectRegistry, broker);
if (LoggingManagementFacade.getCurrentInstance() != null)
{
new LoggingManagementMBean(LoggingManagementFacade.getCurrentInstance(), _objectRegistry);
@@ -234,7 +232,7 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
}
_children.clear();
}
- _broker.removeChangeListener(this);
+ getBroker().removeChangeListener(this);
_objectRegistry.close();
}
@@ -352,12 +350,6 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
}
}
- /** Added for testing purposes */
- Broker getBroker()
- {
- return _broker;
- }
-
@Override
public String getName()
{
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java
index ed4af9881f..2867a92410 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java
@@ -26,19 +26,23 @@ import java.util.Collections;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.model.Statistics;
+import org.apache.qpid.server.security.access.Operation;
public abstract class AbstractPluginAdapter extends AbstractAdapter implements Plugin
{
+ private Broker _broker;
- protected AbstractPluginAdapter(UUID id, Map<String, Object> defaults, Map<String, Object> attributes, TaskExecutor taskExecutor)
+ protected AbstractPluginAdapter(UUID id, Map<String, Object> defaults, Map<String, Object> attributes, Broker broker)
{
- super(id, defaults, attributes, taskExecutor);
+ super(id, defaults, attributes, broker.getTaskExecutor());
+ _broker = broker;
+ addParent(Broker.class, broker);
}
@Override
@@ -104,13 +108,6 @@ public abstract class AbstractPluginAdapter extends AbstractAdapter implements P
}
@Override
- public <C extends ConfiguredObject> C createChild(Class<C> childClass, Map<String, Object> attributes,
- ConfiguredObject... otherParents)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
public Collection<String> getAttributeNames()
{
return AVAILABLE_ATTRIBUTES;
@@ -149,4 +146,46 @@ public abstract class AbstractPluginAdapter extends AbstractAdapter implements P
}
return super.getAttribute(name);
}
+
+ @Override
+ public <C extends ConfiguredObject> C createChild(Class<C> childClass, Map<String, Object> attributes,
+ ConfiguredObject... otherParents)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException
+ {
+ if(desiredState == State.DELETED)
+ {
+ if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), Plugin.class, Operation.DELETE))
+ {
+ throw new AccessControlException("Deletion of plugin is denied");
+ }
+ }
+ }
+
+ @Override
+ protected void authoriseSetAttribute(String name, Object expected, Object desired) throws AccessControlException
+ {
+ if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), Plugin.class, Operation.UPDATE))
+ {
+ throw new AccessControlException("Setting of plugin attribute is denied");
+ }
+ }
+
+ @Override
+ protected void authoriseSetAttributes(Map<String, Object> attributes) throws AccessControlException
+ {
+ if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), Plugin.class, Operation.UPDATE))
+ {
+ throw new AccessControlException("Setting of plugin attributes is denied");
+ }
+ }
+
+ protected Broker getBroker()
+ {
+ return _broker;
+ }
}
diff --git a/qpid/java/build.xml b/qpid/java/build.xml
index e3726d1c3c..37cee98b08 100644
--- a/qpid/java/build.xml
+++ b/qpid/java/build.xml
@@ -37,7 +37,7 @@
<property name="modules.plugin" value="${broker-plugins} ${client-plugins}"/>
<property name="modules.jca" value="jca"/>
<property name="modules" value="${modules.core} ${modules.examples}
- ${modules.jca} ${modules.tests} ${modules.plugin} ${modules.opt}"/>
+ ${modules.jca} ${modules.plugin} ${modules.tests} ${modules.opt}"/>
<property name="qpid.jar" location="${build.lib}/qpid-all.jar"/>
<basename property="qpid.jar.name" file="${qpid.jar}"/>
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
index ae7c648197..861b246d54 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AccessControlProvider;
import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -56,7 +57,7 @@ public class AccessControlProviderRestTest extends QpidRestTestCase
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER, OTHER_USER);
getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
- "httpBasicAuthenticationEnabled", true);
+ HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
public void testCreateAccessControlProvider() throws Exception
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
index 907b476bc4..05dee47893 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.Port;
@@ -39,7 +40,7 @@ public class AnonymousAccessRestTest extends QpidRestTestCase
// set anonymous authentication provider on http port for the tests
config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.AUTHENTICATION_PROVIDER,
TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
- config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", false);
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, false);
// reset credentials
getRestTestHelper().setUsernameAndPassword(null, null);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java
index ea63cc7f4e..1df1796e73 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java
@@ -30,6 +30,7 @@ import java.util.Collections;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.Protocol;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -86,7 +87,7 @@ public class BasicAuthRestTest extends QpidRestTestCase
public void testBasicAuthWhenDisabledWithHttp() throws Exception
{
configure(false);
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", false);
+ getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, false);
super.setUp();
// Try the attempt with authentication, it should fail because
@@ -99,7 +100,7 @@ public class BasicAuthRestTest extends QpidRestTestCase
{
configure(false);
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+ getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
super.setUp();
// Try the attempt with authentication, it should succeed because
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
new file mode 100644
index 0000000000..3a0b834cc2
--- /dev/null
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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.qpid.systest.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
+
+public class HttpManagementRestTest extends QpidRestTestCase
+{
+
+ public void testGetHttpManagement() throws Exception
+ {
+ Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
+ "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+
+ assertEquals("Unexpected session timeout", HttpManagement.DEFAULT_TIMEOUT_IN_SECONDS,
+ details.get(HttpManagement.TIME_OUT));
+ assertEquals("Unexpected http basic auth enabled", true,
+ details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https basic auth enabled", HttpManagement.DEFAULT_HTTPS_BASIC_AUTHENTICATION_ENABLED,
+ details.get(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected http sasl auth enabled", HttpManagement.DEFAULT_HTTP_SASL_AUTHENTICATION_ENABLED,
+ details.get(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https sasl auth enabled", HttpManagement.DEFAULT_HTTPS_SASL_AUTHENTICATION_ENABLED,
+ details.get(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED));
+ }
+
+ public void testUpdateAttributes() throws Exception
+ {
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ attributes.put(HttpManagement.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+ attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.TIME_OUT, 10000);
+
+ getRestTestHelper().submitRequest("/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+
+ Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
+ "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+
+ assertEquals("Unexpected session timeout", 10000, details.get(HttpManagement.TIME_OUT));
+ assertEquals("Unexpected http basic auth enabled", true, details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https basic auth enabled", false, details.get(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected http sasl auth enabled", false, details.get(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https sasl auth enabled", false, details.get(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED));
+ }
+}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java
index e5aacbba4b..4a652f2997 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManagerFactory;
@@ -98,7 +99,7 @@ public class QpidRestTestCase extends QpidBrokerTestCase
// set password authentication provider on http port for the tests
config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.AUTHENTICATION_PROVIDER,
TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
- config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
public RestTestHelper getRestTestHelper()
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
index 220d2bc574..acad55417a 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AccessControlProvider;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Broker;
@@ -74,7 +75,7 @@ public class BrokerACLTest extends QpidRestTestCase
"ACL DENY-LOG ALL ALL";
getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
- "httpBasicAuthenticationEnabled", true);
+ HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
/* === AuthenticationProvider === */
@@ -877,6 +878,63 @@ public class BrokerACLTest extends QpidRestTestCase
assertEquals("Setting of access control provider attributes should be denied", 403, responseCode);
}
+ /* === HTTP management === */
+
+ public void testSetHttpManagementAttributesAllowed() throws Exception
+ {
+ getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
+
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ attributes.put(HttpManagement.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+ attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.TIME_OUT, 10000);
+
+ int responseCode = getRestTestHelper().submitRequest(
+ "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+ assertEquals("Setting of http management should be allowed", 200, responseCode);
+
+ Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
+ "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+
+ assertEquals("Unexpected session timeout", 10000, details.get(HttpManagement.TIME_OUT));
+ assertEquals("Unexpected http basic auth enabled", true, details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https basic auth enabled", false, details.get(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected http sasl auth enabled", false, details.get(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https sasl auth enabled", false, details.get(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED));
+ }
+
+ public void testSetHttpManagementAttributesDenied() throws Exception
+ {
+ getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
+
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ attributes.put(HttpManagement.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+ attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false);
+ attributes.put(HttpManagement.TIME_OUT, 10000);
+
+ int responseCode = getRestTestHelper().submitRequest(
+ "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+ assertEquals("Setting of http management should be denied", 403, responseCode);
+
+ Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
+ "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+
+ assertEquals("Unexpected session timeout", HttpManagement.DEFAULT_TIMEOUT_IN_SECONDS,
+ details.get(HttpManagement.TIME_OUT));
+ assertEquals("Unexpected http basic auth enabled", true,
+ details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https basic auth enabled", HttpManagement.DEFAULT_HTTPS_BASIC_AUTHENTICATION_ENABLED,
+ details.get(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected http sasl auth enabled", HttpManagement.DEFAULT_HTTP_SASL_AUTHENTICATION_ENABLED,
+ details.get(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED));
+ assertEquals("Unexpected https sasl auth enabled", HttpManagement.DEFAULT_HTTPS_SASL_AUTHENTICATION_ENABLED,
+ details.get(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED));
+ }
+
/* === Utility Methods === */
private int createPort(String portName) throws Exception
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
index 3fceb27a4b..9a578d01fb 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
@@ -29,6 +29,7 @@ import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -60,7 +61,7 @@ public class GroupRestACLTest extends QpidRestTestCase
protected void customizeConfiguration() throws ConfigurationException, IOException
{
super.customizeConfiguration();
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+ getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
@Override
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
index 3b81df6fd1..4c4e219695 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
@@ -29,6 +29,7 @@ import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -62,7 +63,7 @@ public class UserRestACLTest extends QpidRestTestCase
protected void customizeConfiguration() throws ConfigurationException, IOException
{
super.customizeConfiguration();
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+ getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
@Override