Package javax.management.remote

Examples of javax.management.remote.JMXAuthenticator


            startRMIRegistry(port);
            /* start the connector server */
            JMXServiceURL url = new JMXServiceURL(
              "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/testApp");
            Map<String, Object> env = new HashMap<String, Object>();
            JMXAuthenticator authenticator = new MyJMXAuthenticator();
            env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
            JMXConnectorServer cs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url,
                 env, getMBeanServer());
            cs.start();
View Full Code Here


        try {
            /* start the connector server */
            JMXServiceURL url = new JMXServiceURL(
              "service:jmx:jmxmp://localhost:" + port);
            Map<String, Object> env = new HashMap<String, Object>();
            JMXAuthenticator authenticator = new MyJMXAuthenticator();
            env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
            JMXConnectorServer cs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url,
                 env, getMBeanServer());
            cs.start();
View Full Code Here

        if (_config.getString("wrapper.jmx.rmi.user", null) != null)
        {
          final String myUser = _config.getString("wrapper.jmx.rmi.user");
          final String myPassword = _config.getString("wrapper.jmx.rmi.password", "");
          environment = new HashMap();
          JMXAuthenticator authenticator = new JMXAuthenticator()
          {

            public Subject authenticate(Object credentials)
            {
              if (!(credentials instanceof String[]))
View Full Code Here

            accessFile = (String) env.get("jmx.remote.x.access.file");
            properties = propertiesFromFile(accessFile);
        }

        public Subject authenticate(Object credentials) {
            final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(
                    environment);
            final Subject subject = authenticator.authenticate(credentials);
            checkAccessFileEntries(subject);
            return subject;
        }
View Full Code Here

   protected Subject authenticate(Object credentials) throws IOException, SecurityException
   {
      Map environment = getEnvironment();
      if (environment != null)
      {
         JMXAuthenticator authenticator = (JMXAuthenticator)environment.get(JMXConnectorServer.AUTHENTICATOR);
         if (authenticator != null)
         {
            return authenticator.authenticate(credentials);
         }
      }
      return null;
   }
View Full Code Here

   private Subject authenticate(Map env, final Object credentials) throws SecurityException
   {
      Logger logger = getLogger();

      Subject subject = null;
      final JMXAuthenticator authenticator = (JMXAuthenticator)env.get(JMXConnectorServer.AUTHENTICATOR);
      if (authenticator != null)
      {
         if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Authenticating new client using JMXAuthenticator " + authenticator);
         try
         {
            // We must check that the code that provided the JMXAuthenticator
            // has the permission to create a Subject
            subject = (Subject)AccessController.doPrivileged(new PrivilegedAction()
            {
               public Object run()
               {
                  return authenticator.authenticate(credentials);
               }
            }, getContext());
            if (subject == null) throw new SecurityException("JMXAuthenticator returned null Subject");
            if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Authentication successful");
         }
View Full Code Here

      JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx");

      // Specify the authenticator in the environment Map, using the
      // standard property JMXConnector.AUTHENTICATOR
      Map environment = new HashMap();
      JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE));
      environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);

      // Create and register the connector server
      JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null);
      ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol());
View Full Code Here

      JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx");

      // Specify the authenticator in the environment Map, using the
      // standard property JMXConnector.AUTHENTICATOR
      Map environment = new HashMap();
      JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE));
      environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);

      // Create and register the connector server
      JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null);
      ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol());
View Full Code Here

        if (getMBeanServer() == null)
            throw new IllegalStateException("Not attached to an MBean server");

        Subject subject = null;
        JMXAuthenticator authenticator =
            (JMXAuthenticator) env.get(JMXConnectorServer.AUTHENTICATOR);
        if (authenticator == null) {
            /*
             * Create the JAAS-based authenticator only if authentication
             * has been enabled
             */
            if (env.get("jmx.remote.x.password.file") != null ||
                env.get("jmx.remote.x.login.config") != null) {
                authenticator = new JMXPluggableAuthenticator(env);
            }
        }
        if (authenticator != null) {
            if (tracing) logger.trace("newClient","got authenticator: " +
                               authenticator.getClass().getName());
            try {
                subject = authenticator.authenticate(credentials);
            } catch (SecurityException e) {
                logger.trace("newClient", "Authentication failed: " + e);
                throw e;
            }
        }
View Full Code Here

      return client;
   }

   private Subject authenticateCaller(Map environment, Object credentials)
   {
      JMXAuthenticator authenticator = (JMXAuthenticator) environment.get(JMXConnectorServer.AUTHENTICATOR);

      Subject subject = null;
      if(authenticator != null)
      {
         subject = authenticator.authenticate(credentials);
      }

      return subject;
   }
View Full Code Here

TOP

Related Classes of javax.management.remote.JMXAuthenticator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.