Question

I have a program that is running a basic RMISecurityManager in all its threads. But I would like to do more control to several threads and set another SecurityManager specially for these threads.

How can I do that ? ...if this is possible !?

thank you by advance.

Edit : I have found my solution. See here for more details.

Was it helpful?

Solution

It doesn't make a great deal of sense. What if code (malicious or not) causes execution on a different thread? This can even happen within the Java library, with security context transferred (which may use java.security.AccessController.getContext/doPrivileged).

Applets do use a slightly difficult system involving ThreadGroups, but I wouldn't recommend it. JAAS allows a Subject to be added to the AccessControlContext, but personally I'd suggest not using this style of programming.

Give downloaded code (if any) appropriate permissions, and don't give sensitive objects to code you don't trust with them.

OTHER TIPS

The SecurityManager performs checks based on the security context of the running thread, perhaps you want to make your SecurityManager to behave differently based on whatever it finds in the context?

Or maybe, you want to implement your SecurityManager using the strategy pattern.

yc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top