See: Description
Interface | Description |
---|---|
ActionExecutor |
Interface to execute a
PrivilegedExceptionAction . |
Class | Description |
---|---|
AccessControllerExecutor |
Execution of a
PrivilegedExceptionAction with the AccessController . |
DirectExecutor |
Direct execution of a
PrivilegedExceptionAction . |
Privileging<T> |
Toy factory to create proxies executing the method calls as privileged actions.
|
Privileging.PrivilegingBuild<T> | |
Privileging.PrivilegingExecutedByOrBuild<T> | |
Privileging.PrivilegingWith<T> | |
PrivilegingInvoker<T> |
Invoker that creates for the invoked method a
PrivilegedExceptionAction and runs this action with the provided
ActionExecutor . |
SubjectExecutor |
Execution of a
PrivilegedExceptionAction with a Subject . |
A toy to run method calls as privileged actions.
The package provides a proxy factory creating proxies, that wrap each
method call into a security.PrivilegedExceptionAction
and
pass this action to a user provided
ActionExecutor
. The toy is
delivered with three predefined action executors:
DirectExecutor
, an
implementation that simply runs the provided action.AccessControllerExecutor
,
an implementation that runs the provided action using the
AccessController.doPrivileged(java.security.PrivilegedAction<T>)
. method like it is
common in environments with an active SecurityManager.SubjectExecutor
,
an implementation that runs the provided action using the
auth.Subject
. method like it is necessary in
JEE environments executing functionality with a technical user.The following using the AccessController to perform privileged read actions on the file:
File file = Privileging.proxy(new File("src/main/java/" + PoolToyExample.class.getName().replace('.', '/') + ".java")) .executedBy(new AccessControllerExecutor()) .build(new CglibProxyFactory()); LineNumberReader reader = new LineNumberReader(new FileReader(file), 16 * 1024); while (reader.readLine() != null); System.out.println("Lines of code: " + reader.getLineNumber()); reader.close();
Copyright © 2005–2023 Codehaus. All rights reserved.