[jboss-cvs] JBossAS SVN: r103644 - in trunk/server/src: resources/jmx-invoker-adaptor/META-INF and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 7 12:58:42 EDT 2010


Author: smarlow at redhat.com
Date: 2010-04-07 12:58:42 -0400 (Wed, 07 Apr 2010)
New Revision: 103644

Modified:
   trunk/server/src/main/java/org/jboss/Shutdown.java
   trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml
Log:
JBAS-7871 Create a JMXAuthenticator implementation.  secure our JSR-160 jmxconnector

Modified: trunk/server/src/main/java/org/jboss/Shutdown.java
===================================================================
--- trunk/server/src/main/java/org/jboss/Shutdown.java	2010-04-07 16:57:40 UTC (rev 103643)
+++ trunk/server/src/main/java/org/jboss/Shutdown.java	2010-04-07 16:58:42 UTC (rev 103644)
@@ -32,22 +32,14 @@
 import java.lang.reflect.UndeclaredThrowableException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Hashtable;
 
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
-import javax.naming.Context;
-import javax.naming.InitialContext;
 
 import org.jboss.bootstrap.api.as.server.JBossASServer;
-import org.jboss.naming.HttpNamingContextFactory;
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SecurityContextAssociation;
-import org.jboss.security.SimplePrincipal;
-import org.jnp.interfaces.NamingContext;
 
 /**
  * A JMX client that uses an MBeanServerConnection to shutdown a remote JBoss
@@ -185,11 +177,9 @@
                break;
             case 'u':
                username = getopt.getOptarg();
-               SecurityAssociation.setPrincipal(new SimplePrincipal(username));
                break;
             case 'p':
                password = getopt.getOptarg();
-               SecurityAssociation.setCredential(password);
                break;
             // host name
             case 'o':
@@ -207,7 +197,6 @@
          }
       }
 
-      InitialContext ctx;
 
       // If there was a username specified, but no password prompt for it
       if( username != null && password == null )
@@ -215,7 +204,6 @@
          System.out.print("Enter password for "+username+": ");
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          password = br.readLine();
-         SecurityAssociation.setCredential(password);
       }
 
       if( serverURL == null)
@@ -232,6 +220,18 @@
          System.out.println("JMX server url=" + serverURL);
       }
       HashMap env = new HashMap();
+      if (username != null && password != null)
+      {
+         if (verbose )
+         {
+            System.out.println("will connect with username=" + username);
+         }
+         String[] creds = new String[2];
+         creds[0] = username;
+         creds[1] = password;
+         env.put(JMXConnector.CREDENTIALS, creds);
+      }
+
       JMXServiceURL url = new JMXServiceURL(serverURL);
       JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
       MBeanServerConnection adaptor = jmxc.getMBeanServerConnection();

Modified: trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml	2010-04-07 16:57:40 UTC (rev 103643)
+++ trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml	2010-04-07 16:58:42 UTC (rev 103644)
@@ -35,16 +35,6 @@
       <depends optional-attribute-name="MBeanServerConnection">jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory</depends>
    </mbean>
 
-   <!-- Create a mapping from the legacy jmx-rmi-adaptor.sar binding to the
-   jmx-invoker-adaptor-server.sar JndiName specified above for backwards
-   portability.
-   -->
-   <mbean code="org.jboss.naming.NamingAlias" name="jboss.jmx:alias=jmx/rmi/RMIAdaptor">
-      <attribute name="FromName">jmx/rmi/RMIAdaptor</attribute>
-      <attribute name="ToName">jmx/invoker/RMIAdaptor</attribute>
-      <depends>jboss:service=Naming</depends>
-   </mbean>
-
    <!-- This is the service that handles the RMIAdaptor invocations by routing
    them to the MBeanServer the service is deployed under.  -->
    <mbean code="org.jboss.jmx.connector.invoker.InvokerAdaptorService"
@@ -122,10 +112,6 @@
             </descriptors>            
          </operation>
       </xmbean>
-      
-      <attribute name="ExportedInterfaces">org.jboss.jmx.adaptor.rmi.RMIAdaptor,
-         org.jboss.jmx.adaptor.rmi.RMIAdaptorExt
-      </attribute>
    </mbean>
 
 </server>




More information about the jboss-cvs-commits mailing list