Author: jmesnil
Date: 2009-06-10 11:46:44 -0400 (Wed, 10 Jun 2009)
New Revision: 7296
Modified:
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
Log:
JBMESSAGING-1629: do not hard-code management cluster admin user
* check if the security manager is null before using it (the server
can be started w/o a security manager)
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-06-10 15:33:16 UTC (rev 7295)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-06-10 15:46:44 UTC (rev 7296)
@@ -70,6 +70,7 @@
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.remoting.server.RemotingService;
import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.security.JBMSecurityManager;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.Divert;
import org.jboss.messaging.core.server.MessagingServer;
@@ -209,13 +210,17 @@
this.storageManager = storageManager;
this.messagingServer = messagingServer;
- messagingServer.getSecurityManager().addUser(managementClusterUser, managementClusterPassword);
- messagingServer.getSecurityManager().addRole(managementClusterUser, CLUSTER_MANAGEMENT_ROLE);
- Set<Role> roles = new HashSet<Role>();
- roles.add(new Role(CLUSTER_MANAGEMENT_ROLE, true, true, true, true, true, true, true));
- messagingServer.getSecurityRepository().addMatch(configuration.getManagementAddress().toString(), roles);
- messagingServer.getSecurityRepository().addMatch(configuration.getManagementAddress() + ".*", roles);
-
+ JBMSecurityManager sm = messagingServer.getSecurityManager();
+ if (sm != null)
+ {
+ sm.addUser(managementClusterUser, managementClusterPassword);
+ sm.addRole(managementClusterUser, CLUSTER_MANAGEMENT_ROLE);
+ Set<Role> roles = new HashSet<Role>();
+ roles.add(new Role(CLUSTER_MANAGEMENT_ROLE, true, true, true, true, true, true, true));
+ messagingServer.getSecurityRepository().addMatch(configuration.getManagementAddress().toString(), roles);
+ messagingServer.getSecurityRepository().addMatch(configuration.getManagementAddress() + ".*", roles);
+ }
+
messagingServerControl = new MessagingServerControlImpl(postOffice,
configuration,
resourceManager,