public class DoAsAction<T> extends Object implements PrivilegedAction<T>
Subject.doAs(javax.security.auth.Subject, java.security.PrivilegedAction<T>) call as a privileged action.
This class is used to work around a JAAS implementation issue causing Subject.getSubject(java.security.AccessControlContext) not to return the Subject associated with the thread of execution inside of a AccessController.doPrivileged(java.security.PrivilegedAction<T>) code block.
| Constructor and Description |
|---|
DoAsAction(PrivilegedAction<T> action)
Construct a privileged action.
|
DoAsAction(Subject subject, PrivilegedAction<T> action)
Construct a privileged action.
|
public DoAsAction(PrivilegedAction<T> action)
action - the action to run with privileges of the current subjectpublic DoAsAction(Subject subject, PrivilegedAction<T> action)
subject - the subject that the specified action will run asaction - the action to run with privileges of the specified subjectpublic T run()
run in interface PrivilegedAction<T>