|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jmx.remote.opt.security.MBeanServerAccessController
public abstract class MBeanServerAccessController
An object of this class implements the MBeanServer interface and, for each of its methods, calls an appropriate checking method and then forwards the request to a wrapped MBeanServer object. The checking method may throw a RuntimeException if the operation is not allowed; in this case the request is not forwarded to the wrapped object.
A typical use of this class is to insert it between a connector server
such as the RMI connector and the MBeanServer with which the connector
is associated. Requests from the connector client can then be filtered
and those operations that are not allowed, or not allowed in a particular
context, can be rejected by throwing a SecurityException
in the corresponding check* method.
This is an abstract class, because in its implementation none of the checking methods does anything. To be useful, it must be subclassed and at least one of the checking methods overridden to do some checking. Some or all of the MBeanServer methods may also be overridden, for instance if the default checking behaviour is inappropriate.
If there is no SecurityManager, then the access controller will refuse to create an MBean that is a ClassLoader, which includes MLets, or to execute the method addURL on an MBean that is an MLet. This prevents people from opening security holes unintentionally. Otherwise, it would not be obvious that granting write access grants the ability to download and execute arbitrary code in the target MBean server. Advanced users who do want the ability to use MLets are presumably advanced enough to handle policy files and security managers.
| Constructor Summary | |
|---|---|
MBeanServerAccessController()
|
|
| Method Summary | |
|---|---|
void |
addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Call checkRead(), then forward this method to the
wrapped object. |
void |
addNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
Call checkRead(), then forward this method to the
wrapped object. |
protected abstract void |
checkRead()
Check if the caller can do read operations. |
protected abstract void |
checkWrite()
Check if the caller can do write operations. |
ObjectInstance |
createMBean(String className,
ObjectName name)
Call checkWrite(), then forward this method to the
wrapped object. |
ObjectInstance |
createMBean(String className,
ObjectName name,
Object[] params,
String[] signature)
Call checkWrite(), then forward this method to the
wrapped object. |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName)
Call checkWrite(), then forward this method to the
wrapped object. |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName,
Object[] params,
String[] signature)
Call checkWrite(), then forward this method to the
wrapped object. |
ObjectInputStream |
deserialize(ObjectName name,
byte[] data)
Call checkRead(), then forward this method to the
wrapped object. |
ObjectInputStream |
deserialize(String className,
byte[] data)
Call checkRead(), then forward this method to the
wrapped object. |
ObjectInputStream |
deserialize(String className,
ObjectName loaderName,
byte[] data)
Call checkRead(), then forward this method to the
wrapped object. |
Object |
getAttribute(ObjectName name,
String attribute)
Call checkRead(), then forward this method to the
wrapped object. |
AttributeList |
getAttributes(ObjectName name,
String[] attributes)
Call checkRead(), then forward this method to the
wrapped object. |
ClassLoader |
getClassLoader(ObjectName loaderName)
Call checkRead(), then forward this method to the
wrapped object. |
ClassLoader |
getClassLoaderFor(ObjectName mbeanName)
Call checkRead(), then forward this method to the
wrapped object. |
ClassLoaderRepository |
getClassLoaderRepository()
Call checkRead(), then forward this method to the
wrapped object. |
String |
getDefaultDomain()
Call checkRead(), then forward this method to the
wrapped object. |
String[] |
getDomains()
Call checkRead(), then forward this method to the
wrapped object. |
Integer |
getMBeanCount()
Call checkRead(), then forward this method to the
wrapped object. |
MBeanInfo |
getMBeanInfo(ObjectName name)
Call checkRead(), then forward this method to the
wrapped object. |
MBeanServer |
getMBeanServer()
|
ObjectInstance |
getObjectInstance(ObjectName name)
Call checkRead(), then forward this method to the
wrapped object. |
Object |
instantiate(String className)
Call checkWrite(), then forward this method to the
wrapped object. |
Object |
instantiate(String className,
Object[] params,
String[] signature)
Call checkWrite(), then forward this method to the
wrapped object. |
Object |
instantiate(String className,
ObjectName loaderName)
Call checkWrite(), then forward this method to the
wrapped object. |
Object |
instantiate(String className,
ObjectName loaderName,
Object[] params,
String[] signature)
Call checkWrite(), then forward this method to the
wrapped object. |
Object |
invoke(ObjectName name,
String operationName,
Object[] params,
String[] signature)
Call checkWrite(), then forward this method to the
wrapped object. |
boolean |
isInstanceOf(ObjectName name,
String className)
Call checkRead(), then forward this method to the
wrapped object. |
boolean |
isRegistered(ObjectName name)
Call checkRead(), then forward this method to the
wrapped object. |
Set |
queryMBeans(ObjectName name,
QueryExp query)
Call checkRead(), then forward this method to the
wrapped object. |
Set |
queryNames(ObjectName name,
QueryExp query)
Call checkRead(), then forward this method to the
wrapped object. |
ObjectInstance |
registerMBean(Object object,
ObjectName name)
Call checkWrite(), then forward this method to the
wrapped object. |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener)
Call checkRead(), then forward this method to the
wrapped object. |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Call checkRead(), then forward this method to the
wrapped object. |
void |
removeNotificationListener(ObjectName name,
ObjectName listener)
Call checkRead(), then forward this method to the
wrapped object. |
void |
removeNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
Call checkRead(), then forward this method to the
wrapped object. |
void |
setAttribute(ObjectName name,
Attribute attribute)
Call checkWrite(), then forward this method to the
wrapped object. |
AttributeList |
setAttributes(ObjectName name,
AttributeList attributes)
Call checkWrite(), then forward this method to the
wrapped object. |
void |
setMBeanServer(MBeanServer mbs)
|
void |
unregisterMBean(ObjectName name)
Call checkWrite(), then forward this method to the
wrapped object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MBeanServerAccessController()
| Method Detail |
|---|
public MBeanServer getMBeanServer()
getMBeanServer in interface MBeanServerForwarderpublic void setMBeanServer(MBeanServer mbs)
setMBeanServer in interface MBeanServerForwarderprotected abstract void checkRead()
protected abstract void checkWrite()
public void addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException
checkRead(), then forward this method to the
wrapped object.
addNotificationListener in interface MBeanServeraddNotificationListener in interface MBeanServerConnectionInstanceNotFoundException
public void addNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException
checkRead(), then forward this method to the
wrapped object.
addNotificationListener in interface MBeanServeraddNotificationListener in interface MBeanServerConnectionInstanceNotFoundException
public ObjectInstance createMBean(String className,
ObjectName name)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException
checkWrite(), then forward this method to the
wrapped object.
createMBean in interface MBeanServercreateMBean in interface MBeanServerConnectionReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
public ObjectInstance createMBean(String className,
ObjectName name,
Object[] params,
String[] signature)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException
checkWrite(), then forward this method to the
wrapped object.
createMBean in interface MBeanServercreateMBean in interface MBeanServerConnectionReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
InstanceNotFoundException
checkWrite(), then forward this method to the
wrapped object.
createMBean in interface MBeanServercreateMBean in interface MBeanServerConnectionReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName,
Object[] params,
String[] signature)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
InstanceNotFoundException
checkWrite(), then forward this method to the
wrapped object.
createMBean in interface MBeanServercreateMBean in interface MBeanServerConnectionReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException
public ObjectInputStream deserialize(ObjectName name,
byte[] data)
throws InstanceNotFoundException,
OperationsException
checkRead(), then forward this method to the
wrapped object.
deserialize in interface MBeanServerInstanceNotFoundException
OperationsException
public ObjectInputStream deserialize(String className,
byte[] data)
throws OperationsException,
ReflectionException
checkRead(), then forward this method to the
wrapped object.
deserialize in interface MBeanServerOperationsException
ReflectionException
public ObjectInputStream deserialize(String className,
ObjectName loaderName,
byte[] data)
throws InstanceNotFoundException,
OperationsException,
ReflectionException
checkRead(), then forward this method to the
wrapped object.
deserialize in interface MBeanServerInstanceNotFoundException
OperationsException
ReflectionException
public Object getAttribute(ObjectName name,
String attribute)
throws MBeanException,
AttributeNotFoundException,
InstanceNotFoundException,
ReflectionException
checkRead(), then forward this method to the
wrapped object.
getAttribute in interface MBeanServergetAttribute in interface MBeanServerConnectionMBeanException
AttributeNotFoundException
InstanceNotFoundException
ReflectionException
public AttributeList getAttributes(ObjectName name,
String[] attributes)
throws InstanceNotFoundException,
ReflectionException
checkRead(), then forward this method to the
wrapped object.
getAttributes in interface MBeanServergetAttributes in interface MBeanServerConnectionInstanceNotFoundException
ReflectionException
public ClassLoader getClassLoader(ObjectName loaderName)
throws InstanceNotFoundException
checkRead(), then forward this method to the
wrapped object.
getClassLoader in interface MBeanServerInstanceNotFoundException
public ClassLoader getClassLoaderFor(ObjectName mbeanName)
throws InstanceNotFoundException
checkRead(), then forward this method to the
wrapped object.
getClassLoaderFor in interface MBeanServerInstanceNotFoundExceptionpublic ClassLoaderRepository getClassLoaderRepository()
checkRead(), then forward this method to the
wrapped object.
getClassLoaderRepository in interface MBeanServerpublic String getDefaultDomain()
checkRead(), then forward this method to the
wrapped object.
getDefaultDomain in interface MBeanServergetDefaultDomain in interface MBeanServerConnectionpublic String[] getDomains()
checkRead(), then forward this method to the
wrapped object.
getDomains in interface MBeanServergetDomains in interface MBeanServerConnectionpublic Integer getMBeanCount()
checkRead(), then forward this method to the
wrapped object.
getMBeanCount in interface MBeanServergetMBeanCount in interface MBeanServerConnection
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
IntrospectionException,
ReflectionException
checkRead(), then forward this method to the
wrapped object.
getMBeanInfo in interface MBeanServergetMBeanInfo in interface MBeanServerConnectionInstanceNotFoundException
IntrospectionException
ReflectionException
public ObjectInstance getObjectInstance(ObjectName name)
throws InstanceNotFoundException
checkRead(), then forward this method to the
wrapped object.
getObjectInstance in interface MBeanServergetObjectInstance in interface MBeanServerConnectionInstanceNotFoundException
public Object instantiate(String className)
throws ReflectionException,
MBeanException
checkWrite(), then forward this method to the
wrapped object.
instantiate in interface MBeanServerReflectionException
MBeanException
public Object instantiate(String className,
Object[] params,
String[] signature)
throws ReflectionException,
MBeanException
checkWrite(), then forward this method to the
wrapped object.
instantiate in interface MBeanServerReflectionException
MBeanException
public Object instantiate(String className,
ObjectName loaderName)
throws ReflectionException,
MBeanException,
InstanceNotFoundException
checkWrite(), then forward this method to the
wrapped object.
instantiate in interface MBeanServerReflectionException
MBeanException
InstanceNotFoundException
public Object instantiate(String className,
ObjectName loaderName,
Object[] params,
String[] signature)
throws ReflectionException,
MBeanException,
InstanceNotFoundException
checkWrite(), then forward this method to the
wrapped object.
instantiate in interface MBeanServerReflectionException
MBeanException
InstanceNotFoundException
public Object invoke(ObjectName name,
String operationName,
Object[] params,
String[] signature)
throws InstanceNotFoundException,
MBeanException,
ReflectionException
checkWrite(), then forward this method to the
wrapped object.
invoke in interface MBeanServerinvoke in interface MBeanServerConnectionInstanceNotFoundException
MBeanException
ReflectionException
public boolean isInstanceOf(ObjectName name,
String className)
throws InstanceNotFoundException
checkRead(), then forward this method to the
wrapped object.
isInstanceOf in interface MBeanServerisInstanceOf in interface MBeanServerConnectionInstanceNotFoundExceptionpublic boolean isRegistered(ObjectName name)
checkRead(), then forward this method to the
wrapped object.
isRegistered in interface MBeanServerisRegistered in interface MBeanServerConnection
public Set queryMBeans(ObjectName name,
QueryExp query)
checkRead(), then forward this method to the
wrapped object.
queryMBeans in interface MBeanServerqueryMBeans in interface MBeanServerConnection
public Set queryNames(ObjectName name,
QueryExp query)
checkRead(), then forward this method to the
wrapped object.
queryNames in interface MBeanServerqueryNames in interface MBeanServerConnection
public ObjectInstance registerMBean(Object object,
ObjectName name)
throws InstanceAlreadyExistsException,
MBeanRegistrationException,
NotCompliantMBeanException
checkWrite(), then forward this method to the
wrapped object.
registerMBean in interface MBeanServerInstanceAlreadyExistsException
MBeanRegistrationException
NotCompliantMBeanException
public void removeNotificationListener(ObjectName name,
NotificationListener listener)
throws InstanceNotFoundException,
ListenerNotFoundException
checkRead(), then forward this method to the
wrapped object.
removeNotificationListener in interface MBeanServerremoveNotificationListener in interface MBeanServerConnectionInstanceNotFoundException
ListenerNotFoundException
public void removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException,
ListenerNotFoundException
checkRead(), then forward this method to the
wrapped object.
removeNotificationListener in interface MBeanServerremoveNotificationListener in interface MBeanServerConnectionInstanceNotFoundException
ListenerNotFoundException
public void removeNotificationListener(ObjectName name,
ObjectName listener)
throws InstanceNotFoundException,
ListenerNotFoundException
checkRead(), then forward this method to the
wrapped object.
removeNotificationListener in interface MBeanServerremoveNotificationListener in interface MBeanServerConnectionInstanceNotFoundException
ListenerNotFoundException
public void removeNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException,
ListenerNotFoundException
checkRead(), then forward this method to the
wrapped object.
removeNotificationListener in interface MBeanServerremoveNotificationListener in interface MBeanServerConnectionInstanceNotFoundException
ListenerNotFoundException
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException
checkWrite(), then forward this method to the
wrapped object.
setAttribute in interface MBeanServersetAttribute in interface MBeanServerConnectionInstanceNotFoundException
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
public AttributeList setAttributes(ObjectName name,
AttributeList attributes)
throws InstanceNotFoundException,
ReflectionException
checkWrite(), then forward this method to the
wrapped object.
setAttributes in interface MBeanServersetAttributes in interface MBeanServerConnectionInstanceNotFoundException
ReflectionException
public void unregisterMBean(ObjectName name)
throws InstanceNotFoundException,
MBeanRegistrationException
checkWrite(), then forward this method to the
wrapped object.
unregisterMBean in interface MBeanServerunregisterMBean in interface MBeanServerConnectionInstanceNotFoundException
MBeanRegistrationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||