0 Replies Latest reply on Mar 3, 2016 10:03 PM by lcheng_nj

    How to get current caller/principal in JMX mbean

    lcheng_nj

      Hi, all

        I have one case which works on JBoss4.2

        1. Client login (with JAAS, ClientLoginModule)

        2. Client get JMX connection from JBoss JMX server

        3. Client call mbean API; Server will check current caller/principal is, whether he/she has the enough privilege to do the action.

       

       

        Now with Wildfly 9, we do the similar thing, moreover, we have set the username/password when getting JMX connection

        //urlString likes:service:jmx:remote://localhost:9999

          JMXServiceURL serviceURL = new JMXServiceURL(urlString);

              Map<String, Object> env = new HashMap<String, Object>();

              String[] creds = new String[2];

              creds[0] = username_;

              creds[1] = password_;

              env.put(JMXConnector.CREDENTIALS, creds);

              JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, env);

              MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();

       

      however, at step3, JMX server find current caller/principal is null.  Do you know why? Or how to resolve this.