Package io.hawt.jmx

Class JMXSecurity

All Implemented Interfaces:
JMXSecurityMBean

public class JMXSecurity extends MBeanSupport implements JMXSecurityMBean
Dummy version that implements JMXSecurityMBean that lets the current user invoke anything
  • Constructor Details

    • JMXSecurity

      public JMXSecurity()
  • Method Details

    • canInvoke

      public boolean canInvoke(String objectName)
      Description copied from interface: JMXSecurityMBean
      Checks whether the current user can invoke any methods on a JMX MBean.
      Specified by:
      canInvoke in interface JMXSecurityMBean
      Parameters:
      objectName - The Object Name of the JMX MBean.
      Returns:
      true if there is at least one method on the MBean that the user can invoke.
    • canInvoke

      public boolean canInvoke(String objectName, String methodName)
      Description copied from interface: JMXSecurityMBean
      Checks whether the current user can invoke any overload of the given method.
      Specified by:
      canInvoke in interface JMXSecurityMBean
      Parameters:
      objectName - The Object Name of the JMX MBean.
      methodName - The name of the method to check.
      Returns:
      true if there is an overload of the specified method that the user can invoke.
    • canInvoke

      public boolean canInvoke(String objectName, String methodName, String[] argumentTypes) throws Exception
      Description copied from interface: JMXSecurityMBean
      Checks whether the current user can invoke the given method.
      Specified by:
      canInvoke in interface JMXSecurityMBean
      Parameters:
      objectName - The Object Name of the JMX MBean.
      methodName - The name of the method to check.
      argumentTypes - The argument types of to method.
      Returns:
      true if the user is allowed to invoke the method, or any of the methods with the given name if null is used for the arguments. There may still be certain values that the user does not have permission to pass to the method.
      Throws:
      Exception
    • canInvoke

      public TabularData canInvoke(Map<String,List<String>> bulkQuery) throws Exception
      Description copied from interface: JMXSecurityMBean
      Bulk operation to check whether the current user can access the requested MBeans or invoke the requested methods.
      Specified by:
      canInvoke in interface JMXSecurityMBean
      Parameters:
      bulkQuery - A map of Object Name to requested operations. Operations can be specified with or without arguments types. An operation without arguments matches any overloaded method with this name. If an empty list is provided for the operation names, a check is done whether the current user can invoke any operation on the MBean.

      Example:

      
                                         Map<String, List<String>> query = new HashMap<>();
                                         String objectName = "org.acme:type=SomeMBean";
                                         query.put(objectName, Arrays.asList(
                                             "testMethod(long,java.lang.String)", // check this testMethod
                                             "otherMethod"));                     // check any overload of otherMethod
                                         query.put("org.acme:type=SomeOtherMBean",
                                             Collections.<String>emptyList());    // check any method of SomeOtherMBean
                                         TabularData result = mb.canInvoke(query);
                                         
      Returns:
      A Tabular Data object with the result. This object conforms the structure as defined in JMXSecurityMBean.CAN_INVOKE_TABULAR_TYPE.
      Throws:
      Exception
    • getDefaultObjectName

      protected String getDefaultObjectName()
      Specified by:
      getDefaultObjectName in class MBeanSupport