Java Security Manager – what does it check for?
This @ l about Java Security_ 419_ 1 @ said:
So what does that mean? Say, if I implement my own security administrator and enable it for the entire JVM Now, does the Java runtime consult my security administrator for each Java call (such as system. Out. Println ()), or just consult someone like system Exit(), file operation and other dangerous API calls?
Editor: let me clarify my question,
I'm not questioning the possibility of a safety supervisor I'm just asking if security checks are done separately for dangerous APIs, or for each method call In the case of a large number of code applications, which internal causes huge performance degradation
resolvent
Solution
If the code describes, it will only query securitymanager It does not do for every operation
For example, at runtime In exit, you will see that the securitymanager is viewed:
public void exit(int status) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkExit(status); } Shutdown.exit(status); }
Similarly, in file, you will see that most methods can refer to securitymanager Example:
public boolean canWrite() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite(path); } return fs.checkAccess(this,FileSystem.ACCESS_WRITE); }
If you are writing methods that may be "dangerous", you should also consult securitymanager
The above is the Java Security Manager compiled by programming house for you – what does it check? I hope this article can help you solve the Java Security Manager - what does it check? Program development problems encountered.
If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.