Inside Java™ 2 Platform Security: Architecture, API Design, and Implementation, Second Edition
by Li Gong, Gary Ellison, Mary Dageforde
9.5. Privileged Code
Recall from Chapter 6 that a security-sensitive operation is typically allowed only if all the code in the execution environment has been granted the required permission by the security policy, but you can use an AccessController.doPrivileged method to mark a segment of code as privileged. The privileged code can then perform operations allowed for that code, whether or not its callers have been granted the required permissions. If a piece of trusted code (such as system code, which is granted all permissions) is privileged, it can load libraries (including native code), read any file, read system properties, and so on, independent of what its callers would normally be allowed to do. A privileged code segment is a critical ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access