forked from jnode/jnode
-
Notifications
You must be signed in to change notification settings - Fork 0
DriverPermission
opencode-agent[bot] edited this page May 11, 2026
·
1 revision
Security permission class for controlling access to driver resource operations.
DriverPermission is a Java Security permission class (java.security.BasicPermission) used to control access to privileged driver operations in JNode. Similar to NetPermission, it follows the standard Java Security Manager model for granting or denying access to sensitive device operations.
| Class | Location | Purpose |
|---|---|---|
DriverPermission |
core/src/driver/org/jnode/driver/DriverPermission.java |
Main permission class |
KeyboardAPI |
core/src/driver/org/jnode/driver/input/KeyboardAPI.java |
Uses setPreferredListener permission |
PointerAPI |
core/src/driver/org/jnode/driver/input/PointerAPI.java |
Uses setPreferredListener permission |
DriverPermission extends BasicPermission, which provides a name-based permission model. The permission system works as follows:
In plugin descriptors, permissions are declared with a class and name:
<permission class="org.jnode.driver.DriverPermission" name="setPreferredListener"/>This declares that the plugin grants the setPreferredListener permission, allowing code from that plugin to perform the protected operation.
| Permission Name | Used By | Purpose |
|---|---|---|
setPreferredListener |
KeyboardAPI, PointerAPI
|
Allows a listener to claim priority over other listeners for input events |
- Permission Declaration: The plugin containing the protected operation declares the required permission in its descriptor XML.
- Permission Grant: Code that loads from the plugin receives the grant, associating the permission with the plugin's protection domain.
-
Permission Check: When a sensitive operation is invoked (e.g.,
setPreferredListener()), the implementation callsSecurityManager.checkPermission()with an appropriately constructedDriverPermissioninstance. - Access Decision: The security manager traverses the protection domains of the calling code, checking if any domain has been granted the required permission.
// In KeyboardAPI.java
public static final DriverPermission SET_PREFERRED_LISTENER_PERMISSION =
new DriverPermission("setPreferredListener");
// In the implementation (e.g., AbstractKeyboardDriver)
public void setPreferredListener(KeyboardListener l) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(SET_PREFERRED_LISTENER_PERMISSION);
}
// ... perform the operation
}- Driver-Framework
- Input-Drivers
- NetPermission — Similar permission class for network operations
- DeviceManager — Central registry for devices and drivers
- Plugin-System — Plugin lifecycle and security model