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(), checkWrite(),
checkCreate(String), and checkUnregister(ObjectName)
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. The readwrite access level can be
qualified by one or more clauses, where each clause looks
like create classNamePattern or unregister. For example:
monitorRole readonly
controlRole readwrite \
create javax.management.timer.*,javax.management.monitor.* \
unregister
(The continuation lines with \ come from the parser for
Properties files.)
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static enum | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private Map | |
| pack-priv static final String | |
| private Properties | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| public | MBeanServerFileAccessController(String
name of the file which denotes a properties
file on disk containing the username/access level entries. accessFileName)Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the |
| public | MBeanServerFileAccessController(String
name of the file which denotes a properties
file on disk containing the username/access level entries. accessFileName, MBeanServer the MBeanServer object to which requests will be forwarded. mbs)Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to |
| public | MBeanServerFileAccessController(Properties
properties list containing the username/access
level entries. accessFileProps)Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the |
| public | MBeanServerFileAccessController(Properties
properties list containing the username/access
level entries. accessFileProps, MBeanServer the MBeanServer object to which requests will be forwarded. mbs)Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the |
| Modifier and Type | Method and Description |
|---|---|
| private synchronized void | |
| public void | checkCreate(String className)
Overrides com. Check if the caller can create MBeans or instances of the given class. |
| private static boolean | |
| public void | checkRead()
Implements abstract com. Check if the caller can do read operations. |
| public void | checkUnregister(ObjectName name)
Overrides com. Check if the caller can do unregister operations. |
| public void | checkWrite()
Implements abstract com. Check if the caller can do write operations. |
| private static boolean | |
| private void | |
| private static Properties | |
| public synchronized void |
| accessFileName | back to summary |
|---|---|
| private String accessFileName | |
| accessMap | back to summary |
|---|---|
| private Map<String, MBeanServerFileAccessController. | |
| CREATE | back to summary |
|---|---|
| pack-priv static final String CREATE | |
| originalProps | back to summary |
|---|---|
| private Properties originalProps | |
| READONLY | back to summary |
|---|---|
| pack-priv static final String READONLY | |
| READWRITE | back to summary |
|---|---|
| pack-priv static final String READWRITE | |
| UNREGISTER | back to summary |
|---|---|
| pack-priv static final String UNREGISTER | |
| MBeanServerFileAccessController | back to summary |
|---|---|
| public MBeanServerFileAccessController(String accessFileName) throws IOException Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the This instance is initialized from the specified properties file.
| |
| MBeanServerFileAccessController | back to summary |
|---|---|
| public MBeanServerFileAccessController(String accessFileName, MBeanServer mbs) throws IOException Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to This instance is initialized from the specified properties file.
| |
| MBeanServerFileAccessController | back to summary |
|---|---|
| public MBeanServerFileAccessController(Properties accessFileProps) throws IOException Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the This instance is initialized from the specified properties
instance. This constructor makes a copy of the properties
instance 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
| |
| MBeanServerFileAccessController | back to summary |
|---|---|
| public MBeanServerFileAccessController(Properties accessFileProps, MBeanServer mbs) throws IOException Create a new MBeanServerAccessController that forwards all the
MBeanServer requests to the MBeanServer set by invoking the This instance is initialized from the specified properties
instance. This constructor makes a copy of the properties
instance 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
| |
| checkAccess | back to summary |
|---|---|
| private synchronized void checkAccess(MBeanServerFileAccessController. | |
| checkCreate | back to summary |
|---|---|
| public void checkCreate(String className) Overrides com. Check if the caller can create MBeans or instances of the given class. This method does nothing if so, otherwise throws SecurityException.
| |
| checkCreateAccess | back to summary |
|---|---|
| private static boolean checkCreateAccess(MBeanServerFileAccessController. | |
| checkRead | back to summary |
|---|---|
| public void checkRead() Implements abstract com. Check if the caller can do read operations. This method does nothing if so, otherwise throws SecurityException.
| |
| checkUnregister | back to summary |
|---|---|
| public void checkUnregister(ObjectName name) Overrides com. Check if the caller can do unregister operations. This method does nothing if so, otherwise throws SecurityException.
| |
| checkWrite | back to summary |
|---|---|
| public void checkWrite() Implements abstract com. Check if the caller can do write operations. This method does nothing if so, otherwise throws SecurityException.
| |
| classNameMatch | back to summary |
|---|---|
| private static boolean classNameMatch(String pattern, String className) | |
| parseProperties | back to summary |
|---|---|
| private void parseProperties(Properties props) | |
| propertiesFromFile | back to summary |
|---|---|
| private static Properties propertiesFromFile(String fname) throws IOException | |
| refresh | back to summary |
|---|---|
| public synchronized void refresh() throws IOException Refresh the set of username/access level entries. If this instance was created using the
If this instance was created using the
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final String[] | |
| private final String[] | |
| private boolean | |
| pack-priv final boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| createPatterns | back to summary |
|---|---|
| pack-priv final String[] createPatterns | |
| NO_STRINGS | back to summary |
|---|---|
| private final String[] NO_STRINGS | |
| unregister | back to summary |
|---|---|
| private boolean unregister | |
| write | back to summary |
|---|---|
| pack-priv final boolean write | |
| Access | back to summary |
|---|---|
| pack-priv Access(boolean write, boolean unregister, List<String> createPatternList) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final MBeanServerFileAccessController. | |
| public static final MBeanServerFileAccessController. | |
| public static final MBeanServerFileAccessController. | |
| public static final MBeanServerFileAccessController. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static MBeanServerFileAccessController. | |
| public static MBeanServerFileAccessController. |
| CREATE | back to summary |
|---|---|
| public static final MBeanServerFileAccessController. | |
| READ | back to summary |
|---|---|
| public static final MBeanServerFileAccessController. | |
| UNREGISTER | back to summary |
|---|---|
| public static final MBeanServerFileAccessController. | |
| WRITE | back to summary |
|---|---|
| public static final MBeanServerFileAccessController. | |
| AccessType | back to summary |
|---|---|
| private AccessType() | |
| valueOf | back to summary |
|---|---|
| public static MBeanServerFileAccessController. | |
| values | back to summary |
|---|---|
| public static MBeanServerFileAccessController. | |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private static final int | |
| private int | |
| private final String | |
| private final int | |
| private final String |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| pack-priv static MBeanServerFileAccessController. | |
| private MBeanServerFileAccessController. | |
| private String | |
| private void | |
| private MBeanServerFileAccessController. | |
| private String | |
| private void | |
| private IllegalArgumentException |
| c | back to summary |
|---|---|
| private int c | |
| EOS | back to summary |
|---|---|
| private static final int EOS | |
| i | back to summary |
|---|---|
| private int i | |
| identity | back to summary |
|---|---|
| private final String identity | |
| len | back to summary |
|---|---|
| private final int len | |
| s | back to summary |
|---|---|
| private final String s | |
| Parser | back to summary |
|---|---|
| private Parser(String identity, String s) | |
| next | back to summary |
|---|---|
| private void next() | |
| parseAccess | back to summary |
|---|---|
| pack-priv static MBeanServerFileAccessController. | |
| parseAccess | back to summary |
|---|---|
| private MBeanServerFileAccessController. | |
| parseClassName | back to summary |
|---|---|
| private String parseClassName() | |
| parseCreate | back to summary |
|---|---|
| private void parseCreate(List<String> createClasses) | |
| parseReadWrite | back to summary |
|---|---|
| private MBeanServerFileAccessController. | |
| parseWord | back to summary |
|---|---|
| private String parseWord() | |
| skipSpace | back to summary |
|---|---|
| private void skipSpace() | |
| syntax | back to summary |
|---|---|
| private IllegalArgumentException syntax(String msg) | |