summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java46
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java10
-rw-r--r--java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java2
-rw-r--r--java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java44
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java2
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java12
6 files changed, 67 insertions, 49 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
index 74ca0399a1..0ee5763d91 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
@@ -38,7 +38,6 @@ import javax.management.MBeanOperationInfo;
import javax.management.JMException;
import javax.management.NotificationListener;
import javax.management.Notification;
-import javax.management.OperationsException;
import javax.security.auth.Subject;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
@@ -140,8 +139,6 @@ public class MBeanInvocationHandlerImpl implements InvocationHandler, Notificati
Principal principal = principals.iterator().next();
String identity = principal.getName();
-
- checkCompatibility(proxy, method, args);
if (isAdminMethod(args))
{
@@ -171,49 +168,6 @@ public class MBeanInvocationHandlerImpl implements InvocationHandler, Notificati
throw new SecurityException("Access denied");
}
- private void checkCompatibility(final Object proxy, final Method method, final Object[] args) throws Throwable
- {
- if (args[0] instanceof ObjectName && method.getName().equals("invoke"))
- {
- //get the ObjectName and invoked Method name
- final ObjectName objectName = (ObjectName) args[0];
-
- final String mbeanMethod = (args.length > 1) ? (String) args[1] : null;
- if (mbeanMethod == null)
- {
- return;
- }
-
- //UserManagement MBean compatibility checks
- if(objectName.getKeyProperty("type").equals(UserManagement.TYPE))
- {
- if (mbeanMethod.equals("createUser") || mbeanMethod.equals("setPassword"))
- {
- //get the provided argument values and types for the method
- if( args.length > 2 && args[2] != null && args[2] instanceof Object[] &&
- args.length > 3 && args[3] != null && args[3] instanceof String[])
- {
- //check the 2nd argument value is a char[]
- final Object[] argValues = (Object[]) args[2];
- final String[] argTypes = (String[]) args[3];
-
- final Object actualValue = (argValues.length > 1) ? argValues[1] : null;
- final String expectedType = (argTypes.length > 1) ? (String) argTypes[1] : null;
-
- if (expectedType != null && expectedType.equals("[C"))
- {
- if (actualValue != null && actualValue instanceof String)
- {
- throw new OperationsException("Incorrect parameter type provided.\n" +
- "Please upgrade to a newer management console release to correct this issue.");
- }
- }
- }
- }
- }
- }
- }
-
private boolean isAdminMethod(Object[] args)
{
if (args[0] instanceof ObjectName)
diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java
index 45ab57ca90..5a2965cb32 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java
@@ -108,6 +108,11 @@ public class AMQUserManagementMBean extends AMQManagedObject implements UserMana
return UserManagement.TYPE;
}
+ public boolean setPassword(String username, String password)
+ {
+ return setPassword(username, password.toCharArray());
+ }
+
public boolean setPassword(String username, char[] password)
{
try
@@ -196,6 +201,11 @@ public class AMQUserManagementMBean extends AMQManagedObject implements UserMana
return true;
}
+
+ public boolean createUser(String username, String password, boolean read, boolean write, boolean admin)
+ {
+ return createUser(username, password.toCharArray(), read, write, admin);
+ }
public boolean createUser(String username, char[] password, boolean read, boolean write, boolean admin)
{
diff --git a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java
index 7bc0e717b8..c6f7829e59 100644
--- a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java
+++ b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java
@@ -42,7 +42,7 @@ public interface ServerInformation
* Qpid JMX API 1.1 can be assumed.
*/
int QPID_JMX_API_MAJOR_VERSION = 1;
- int QPID_JMX_API_MINOR_VERSION = 6;
+ int QPID_JMX_API_MINOR_VERSION = 7;
/**
diff --git a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
index 4a43071c3b..d83d534428 100644
--- a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
+++ b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
@@ -45,18 +45,37 @@ public interface UserManagement
* set password for user.
*
* Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
+ *
+ * @deprecated since Qpid JMX API 1.7
*
* @param username The username to create
* @param password The password for the user
*
* @return The result of the operation
*/
+ @Deprecated
@MBeanOperation(name = "setPassword", description = "Set password for user.",
impact = MBeanOperationInfo.ACTION)
boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
@MBeanOperationParameter(name = "passwd", description = "Password")char[] password);
/**
+ * Set password for a given user.
+ *
+ * @since Qpid JMX API 1.7
+ *
+ * @param username The username to create
+ * @param password The password for the user
+ *
+ * @return The result of the operation
+ */
+ @MBeanOperation(name = "setPassword", description = "Set password for user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ @MBeanOperationParameter(name = "password", description = "Password")String password);
+
+ /**
* set rights for users with given details
*
* @param username The username to create
@@ -78,6 +97,8 @@ public interface UserManagement
*
* Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
*
+ * @deprecated since Qpid JMX API 1.7
+ *
* @param username The username to create
* @param password The password for the user
* @param read The set of permission to give the new user
@@ -86,15 +107,38 @@ public interface UserManagement
*
* @return The result of the operation
*/
+ @Deprecated
@MBeanOperation(name = "createUser", description = "Create new user from system.",
impact = MBeanOperationInfo.ACTION)
boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
@MBeanOperationParameter(name = "passwd", description = "Password")char[] password,
@MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
@MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
@MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
/**
+ * Create users with given details.
+ *
+ * @since Qpid JMX API 1.7
+ *
+ * @param username The username to create
+ * @param password The password for the user
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return The result of the operation
+ */
+ @MBeanOperation(name = "createUser", description = "Create a new user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ @MBeanOperationParameter(name = "password", description = "Password")String password,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+ /**
* View users returns all the users that are currently available to the system.
*
* @param username The user to delete
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
index f3fc135efb..13485df718 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
@@ -47,7 +47,7 @@ public abstract class ApplicationRegistry
//max supported broker management interface supported by this release of the management console
public static final int SUPPORTED_QPID_JMX_API_MAJOR_VERSION = 1;
- public static final int SUPPORTED_QPID_JMX_API_MINOR_VERSION = 6;
+ public static final int SUPPORTED_QPID_JMX_API_MINOR_VERSION = 7;
public static final String DATA_DIR = System.getProperty("user.home") + File.separator + ".qpidmc";
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
index 2051beafac..d7cd19e705 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
@@ -792,7 +792,17 @@ public class UserManagementTabControl extends TabControl
shell.dispose();
try
{
- boolean result = _ummb.createUser(username, passwordChars, read, write, admin);
+ boolean result = false;
+ // If we have Qpid JMX API 1.7 or above, use newer createUser method with String based password.
+ if (_ApiVersion.greaterThanOrEqualTo(1,7))
+ {
+ result = _ummb.createUser(username, password, read, write, admin);
+ }
+ else
+ {
+ result = _ummb.createUser(username, passwordChars, read, write, admin);
+ }
+
ViewUtility.operationResultFeedback(result, "Created user", "Failed to create user");
}
catch(Exception e5)