public class MBeanServerFileAccessController extends MBeanServerAccessController
An object of this class implements the MBeanServerAccessController 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 SecurityException if the operation is not allowed; in this case the request is not forwarded to the wrapped object.
This class implements the checkRead() and checkWrite()
methods based on an access level properties file containing username/access
level pairs. The set of username/access level pairs is passed either as a
filename which denotes a properties file on disk, or directly as an instance
of the Properties class. In both cases, the name of each property
represents a username, and the value of the property is the associated access
level. Thus, any given username either does not exist in the properties or
has exactly one access level. The same access level can be shared by several
usernames.
The supported access level values are readonly and readwrite.
| Modifier and Type | Field and Description |
|---|---|
static String |
READONLY |
static String |
READWRITE |
| Constructor and Description |
|---|
MBeanServerFileAccessController(Properties accessFileProps)
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the
MBeanServerAccessController.setMBeanServer(javax.management.MBeanServer) method after doing access checks based on read and
write permissions. |
MBeanServerFileAccessController(Properties accessFileProps,
MBeanServer mbs)
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the
MBeanServerAccessController.setMBeanServer(javax.management.MBeanServer) method after doing access checks based on read and
write permissions. |
MBeanServerFileAccessController(String accessFileName)
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the
MBeanServerAccessController.setMBeanServer(javax.management.MBeanServer) method after doing access checks based on read and
write permissions. |
MBeanServerFileAccessController(String accessFileName,
MBeanServer mbs)
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to
mbs after doing access checks
based on read and write permissions. |
| Modifier and Type | Method and Description |
|---|---|
void |
checkRead()
Check if the caller can do read operations.
|
void |
checkWrite()
Check if the caller can do write operations.
|
void |
refresh()
Refresh the set of username/access level entries.
|
addNotificationListener, addNotificationListener, createMBean, createMBean, createMBean, createMBean, deserialize, deserialize, deserialize, getAttribute, getAttributes, getClassLoader, getClassLoaderFor, getClassLoaderRepository, getDefaultDomain, getDomains, getMBeanCount, getMBeanInfo, getMBeanServer, getObjectInstance, instantiate, instantiate, instantiate, instantiate, invoke, isInstanceOf, isRegistered, queryMBeans, queryNames, registerMBean, removeNotificationListener, removeNotificationListener, removeNotificationListener, removeNotificationListener, setAttribute, setAttributes, setMBeanServer, unregisterMBeanpublic static final String READONLY
public static final String READWRITE
public MBeanServerFileAccessController(String accessFileName) throws IOException
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the MBeanServerAccessController.setMBeanServer(javax.management.MBeanServer) method after doing access checks based on read and
write permissions.
This instance is initialized from the specified properties file.
accessFileName - name of the file which denotes a properties
file on disk containing the username/access level entries.IOException - if the file does not exist, is a
directory rather than a regular file, or for some other
reason cannot be opened for reading.IllegalArgumentException - if any of the supplied access
level values differs from "readonly" or "readwrite".public MBeanServerFileAccessController(String accessFileName, MBeanServer mbs) throws IOException
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to mbs after doing access checks
based on read and write permissions.
This instance is initialized from the specified properties file.
accessFileName - name of the file which denotes a properties
file on disk containing the username/access level entries.mbs - the MBeanServer object to which requests will be forwarded.IOException - if the file does not exist, is a
directory rather than a regular file, or for some other
reason cannot be opened for reading.IllegalArgumentException - if any of the supplied access
level values differs from "readonly" or "readwrite".public MBeanServerFileAccessController(Properties accessFileProps) throws IOException
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the MBeanServerAccessController.setMBeanServer(javax.management.MBeanServer) method after doing access checks based on read and
write permissions.
This instance is initialized from the specified properties instance.
This constructor makes a copy of the properties instance using its
clone method and it is the copy that is consulted to check
the username and access level of an incoming connection. The original
properties object can be modified without affecting the copy. If the
refresh() method is then called, the
MBeanServerFileAccessController will make a new copy of the
properties object at that time.
accessFileProps - properties list containing the username/access
level entries.IllegalArgumentException - if accessFileProps is
null or if any of the supplied access level values differs
from "readonly" or "readwrite".IOExceptionpublic MBeanServerFileAccessController(Properties accessFileProps, MBeanServer mbs) throws IOException
Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the MBeanServerAccessController.setMBeanServer(javax.management.MBeanServer) method after doing access checks based on read and
write permissions.
This instance is initialized from the specified properties instance.
This constructor makes a copy of the properties instance using its
clone method and it is the copy that is consulted to check
the username and access level of an incoming connection. The original
properties object can be modified without affecting the copy. If the
refresh() method is then called, the
MBeanServerFileAccessController will make a new copy of the
properties object at that time.
accessFileProps - properties list containing the username/access
level entries.mbs - the MBeanServer object to which requests will be forwarded.IllegalArgumentException - if accessFileProps is
null or if any of the supplied access level values differs
from "readonly" or "readwrite".IOExceptionpublic void checkRead()
checkRead in class MBeanServerAccessControllerpublic void checkWrite()
checkWrite in class MBeanServerAccessControllerpublic void refresh()
throws IOException
Refresh the set of username/access level entries.
If this instance was created using the
MBeanServerFileAccessController(String) or
MBeanServerFileAccessController(String,MBeanServer)
constructors to specify a file from which the entries are read,
the file is re-read.
If this instance was created using the
MBeanServerFileAccessController(Properties) or
MBeanServerFileAccessController(Properties,MBeanServer)
constructors then a new copy of the Properties object
is made.
IOException - if the file does not exist, is a
directory rather than a regular file, or for some other
reason cannot be opened for reading.IllegalArgumentException - if any of the supplied access
level values differs from "readonly" or "readwrite".Copyright © 2019 Terracotta, Inc.. All rights reserved.