The largest Interview Solution Library on the web


java tutorials/
« Previous | 1 | 2 | 3 | Next »

Example doAs()


  • Lexically scoped Subject
. . .

// Authenticate user & build a Subject wUser

. . .

// Switch to the authenticated user

Subject.doAs(wUser, new PrivilegedAction() {

public Object Run(){

// Work to be done as wUser requiring

// the addition of the user's privileges

return processUserRequest();

}

} // end of PrivilegedAction

);
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com