Re: Domains of permissions
Charlie Lai (charlie@angeles.eng.sun.com)
Tue, 12 Jan 1999 17:42:59 -0800 (PST)
> I'm trying to create a "component loader" which loads components into the
> JVM. Each component provides some specific services which it publishes via
> interfaces. I want to provide different domains/contexts of security to
> each of these components. To give an example, I have a component A which is
> build by the classes A1, A2, ... and a component B built from the classes
> B1, B2, ... Now I want to give the component A the right/permission to read
> a file from a certain directory d1. Note, that the actual method call to do
> the file read may be in any of the classes A1, A2, A3 etc. To the component
> B I want to give another right/permission, for example write a file to a
> directory d2. Note, again, that any instance of the classes of component B
> (B1, B2, etc) may then actually do the writing.
>
> My question is if it's possible to do this in one JVM? What would I have to
> use, custom classloaders? How do I ensure, that if I load the main class of
> component B, say B1, by my custom classloader, that any other class (B2, B3
> etc) will also be loaded by this class?
hi,
if you use jdk 1.2,
i believe you could simply load Component A classes from
one Codebase (URL), and Component B classes from another Codebase (URL).
then, assign the appropriate permissions to each Codebase.
whenever classes are loaded, they should get assigned
the correct permissions. i don't believe you have to write
your classloader.
for more security information, check out:
http://java.sun.com/products/jdk/1.2/docs/guide/security/index.html
thanks,
charlie