Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
WebSphere Application Server run as server
* Run code with the server subject
* (having the authorization to do any administration operation)
PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>() {
public Void run() {
return null;
try {
// run the priviledged action as the system
Also possible:
Subject serverSubject = ContextManagerFactory.getInstance().getServerSubject();
WSSubject.doAs(serverSubject, action);
} catch (PrivilegedActionException e) {
Throable thrownException = e.getCause();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment