T
Tomas Mikula
I can't figure out how to temporarily restrict code privileges. My code
goes like this:
// trusted code
// untrusted code
// trusted code
I would like to run untrusted code with restricted privileges and then
continue with full privileges again.
Thanks in advance!
My idea was to set a custom SecurityManager with System.setSecurityManager(s),
but then I would not be able to restore the original one. My other idea was
to use AccessController.doPrivileged(action, context), but I'm not able to
get an instance of AccessControlContext with custom permissions, and
AccessControlContext is final, so I can't implement my own.
goes like this:
// trusted code
// untrusted code
// trusted code
I would like to run untrusted code with restricted privileges and then
continue with full privileges again.
Thanks in advance!
My idea was to set a custom SecurityManager with System.setSecurityManager(s),
but then I would not be able to restore the original one. My other idea was
to use AccessController.doPrivileged(action, context), but I'm not able to
get an instance of AccessControlContext with custom permissions, and
AccessControlContext is final, so I can't implement my own.