When should AccessController.doPrivileged() be used?

前端 未结 4 1843
囚心锁ツ
囚心锁ツ 2020-12-13 09:35

If I understand AccessController.doPrivileged correctly, it is saying that untrusted code should be able to invoke methods requiring permissions (such as System.getPro

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 09:49

    Essentially, AccessController.doPriviledged() is the equivalent of a set-user-id file. It is saying "I hereby request that this method be done with my privileges, even if I was invoked by a method that does not have them."

提交回复
热议问题