Re: Best Practices for Handling Client Authentication
Mark Brouwer <[email protected]>
| Newsgroups | gmane.comp.java.sun.javaspaces |
|---|---|
| Message-ID | <[email protected]> |
Brian Ferris wrote:
> If anything, #2 appeals to me. Specifically, it seems wrapping the
> Javaspace in some sort of Proxy that automatically catches method
> calls and recalls them with elevated privileges would be cool. Has
> anyone every done something like this? Are there any existing JINI
> support classes for doing this? Or should I suck it up and go with
> option #1?
Brian,
The Cheiron Utils project has a utility class that allows you to go for
option #2, the cool stuff ;-), we have used it to wrap invocations from
the AWT event thread and from within application servers. For the
specification see
http://www.cheiron.org/utils/release/v0.2/api/org/cheiron/util/proxy/ProxyWrapper.html.
You can download the source and binaries under the Apache License,
Version 2.0 from http://www.cheiron.org/utils/index.html
Example
JavaSpace spaceProxy = ...; // prepared JavaSpace proxy from LUS
SecurityContext sc = ...;
ClassLoader ccl = ...;
spaceProxy = (JavaSpace) ProxyWrapper.wrap(spaceProxy, sc, ccl);
spaceProxy.take(...); // take operation will take place with correct
// security context (subject, etc.) and context
// class loader
Depending on the place you are going to wrap sc and ccl these can be
null, in that case the utility will snapshot the current values for the
security context and thread context class loader.
Beware of any side effects, but these are specified in the javadoc as
well as (hopefully) all the other relevant stuff. If you have any
additional questions feel free to ask.
--
Mark
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS". For general help, send email to
[email protected] and include in the body of the message "help".
To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html