Package io.hawt.jmx
Class JMXSecurity
- java.lang.Object
-
- io.hawt.util.MBeanSupport
-
- io.hawt.jmx.JMXSecurity
-
- All Implemented Interfaces:
JMXSecurityMBean
public class JMXSecurity extends io.hawt.util.MBeanSupport implements JMXSecurityMBean
Dummy version that implements JMXSecurityMBean that lets the current user invoke anything
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.hawt.jmx.JMXSecurityMBean
JMXSecurityMBean.SecurityMBeanOpenTypeInitializer
-
-
Field Summary
-
Fields inherited from interface io.hawt.jmx.JMXSecurityMBean
CAN_INVOKE_RESULT_COLUMNS, CAN_INVOKE_RESULT_ROW_TYPE, CAN_INVOKE_TABULAR_TYPE
-
-
Constructor Summary
Constructors Constructor Description JMXSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanInvoke(String objectName)Checks whether the current user can invoke any methods on a JMX MBean.booleancanInvoke(String objectName, String methodName)Checks whether the current user can invoke any overload of the given method.booleancanInvoke(String objectName, String methodName, String[] argumentTypes)Checks whether the current user can invoke the given method.TabularDatacanInvoke(Map<String,List<String>> bulkQuery)Bulk operation to check whether the current user can access the requested MBeans or invoke the requested methods.protected StringgetDefaultObjectName()
-
-
-
Method Detail
-
canInvoke
public boolean canInvoke(String objectName) throws Exception
Description copied from interface:JMXSecurityMBeanChecks whether the current user can invoke any methods on a JMX MBean.- Specified by:
canInvokein interfaceJMXSecurityMBean- Parameters:
objectName- The Object Name of the JMX MBean.- Returns:
trueif there is at least one method on the MBean that the user can invoke.- Throws:
Exception
-
canInvoke
public boolean canInvoke(String objectName, String methodName) throws Exception
Description copied from interface:JMXSecurityMBeanChecks whether the current user can invoke any overload of the given method.- Specified by:
canInvokein interfaceJMXSecurityMBean- Parameters:
objectName- The Object Name of the JMX MBean.methodName- The name of the method to check.- Returns:
trueif there is an overload of the specified method that the user can invoke.- Throws:
Exception
-
canInvoke
public boolean canInvoke(String objectName, String methodName, String[] argumentTypes) throws Exception
Description copied from interface:JMXSecurityMBeanChecks whether the current user can invoke the given method.- Specified by:
canInvokein interfaceJMXSecurityMBean- 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:
trueif the user is allowed to invoke the method, or any of the methods with the given name ifnullis 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:JMXSecurityMBeanBulk operation to check whether the current user can access the requested MBeans or invoke the requested methods.- Specified by:
canInvokein interfaceJMXSecurityMBean- 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:
getDefaultObjectNamein classio.hawt.util.MBeanSupport
-
-